Skip to content

Commit b4e2e8c

Browse files
brunolins16wtgodbe
authored andcommitted
Adding nuget --version workaround
1 parent 8599521 commit b4e2e8c

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

.azure/pipelines/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,13 @@ stages:
489489
$(_InternalRuntimeDownloadArgs)
490490
displayName: Run build.sh
491491
- script: git clean -xfd src/**/obj/;
492-
./dockerbuild.sh bionic --ci --nobl --arch x64 --build-installers --no-build-deps --no-build-nodejs
492+
./dockerbuild.sh bionic --ci --nobl --arch x64 --build-installers --no-build-deps --no-build-nodejs --init-nuget
493493
-p:OnlyPackPlatformSpecificPackages=true -p:BuildRuntimeArchive=false -p:LinuxInstallerType=deb
494494
$(_BuildArgs)
495495
$(_InternalRuntimeDownloadArgs)
496496
displayName: Build Debian installers
497497
- script: git clean -xfd src/**/obj/;
498-
./dockerbuild.sh rhel --ci --nobl --arch x64 --build-installers --no-build-deps --no-build-nodejs
498+
./dockerbuild.sh rhel --ci --nobl --arch x64 --build-installers --no-build-deps --no-build-nodejs --init-nuget
499499
-p:OnlyPackPlatformSpecificPackages=true -p:BuildRuntimeArchive=false -p:LinuxInstallerType=rpm
500500
-p:AssetManifestFileName=aspnetcore-Linux_x64.xml
501501
$(_BuildArgs)

eng/build.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ target_arch='x64'
3333
configuration=''
3434
runtime_source_feed=''
3535
runtime_source_feed_key=''
36+
init_nuget=false
3637

3738
if [ "$(uname)" = "Darwin" ]; then
3839
target_os_name='osx'
@@ -82,6 +83,8 @@ Options:
8283
--runtime-source-feed Additional feed that can be used when downloading .NET runtimes and SDKs
8384
--runtime-source-feed-key Key for feed that can be used when downloading .NET runtimes and SDKs
8485
86+
--init-nuget Run nuget --version.
87+
8588
Description:
8689
This build script installs required tools and runs an MSBuild command on this repository
8790
This script can be used to invoke various targets, such as targets to produce packages
@@ -208,6 +211,9 @@ while [[ $# -gt 0 ]]; do
208211
-ci)
209212
ci=true
210213
;;
214+
-init-nuget)
215+
init_nuget=true
216+
;;
211217
-binarylog|-bl)
212218
binary_log=true
213219
;;
@@ -359,6 +365,30 @@ export MSBUILDDEBUGPATH="$log_dir"
359365
_tmp_restore=$restore
360366
restore=true
361367

368+
if [[ "$init_nuget" == true ]]; then
369+
InitializeBuildTool
370+
371+
function RunBuildTool {
372+
"$_InitializeBuildTool" "$@" || {
373+
local exit_code=$?
374+
# We should not Write-PipelineTaskError here because that message shows up in the build summary
375+
# The build already logged an error, that's the reason it failed. Producing an error here only adds noise.
376+
echo "Build failed with exit code $exit_code. Check errors above."
377+
if [[ "$ci" == "true" ]]; then
378+
Write-PipelineSetResult -result "Failed" -message "nuget execution failed."
379+
# Exiting with an exit code causes the azure pipelines task to log yet another "noise" error
380+
# The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error
381+
ExitWithExitCode 0
382+
else
383+
ExitWithExitCode $exit_code
384+
fi
385+
}
386+
}
387+
388+
echo 'Running dotnet nuget --version (issue: https://github.com/NuGet/Home/issues/12159#issuecomment-1278360511)'
389+
RunBuildTool "nuget" "--version"
390+
fi
391+
362392
InitializeToolset
363393

364394
restore=$_tmp_restore=

0 commit comments

Comments
 (0)