diff options
author | Robert Adam <krzmbrzl@gmail.com> | 2021-01-29 11:07:28 +0300 |
---|---|---|
committer | Robert Adam <krzmbrzl@gmail.com> | 2021-01-29 13:19:20 +0300 |
commit | 7280013efe499ebf87fedf4b8efcc10fae345e18 (patch) | |
tree | 06ba7a9a23cc2d45de753856c23a740307e489e6 /.ci | |
parent | 799559844c2fde292f85ce24a267cadf7eb4c9c4 (diff) |
CI(windows): Fix build number fetching script
I have no idea why but these changes make this work on my Windows 10 VM.
If this really solves the issue then this is a perfect illustration for
why batch is weird.
Diffstat (limited to '.ci')
-rw-r--r-- | .ci/azure-pipelines/build_windows.bat | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/.ci/azure-pipelines/build_windows.bat b/.ci/azure-pipelines/build_windows.bat index 3e3fd80bf..9e9d66740 100644 --- a/.ci/azure-pipelines/build_windows.bat +++ b/.ci/azure-pipelines/build_windows.bat @@ -35,12 +35,17 @@ @echo on +:: The method we use to store a command's output into a variable: +:: https://stackoverflow.com/a/6362922 +for /f "tokens=* USEBACKQ" %%g in (`python "scripts\mumble-version.py" --project`) do (set "VERSION=%%g") + +:: For some really stupid reason we can't have this statement and the one where we set the VERSION variable in the same if body as +:: in that case the variable substitution of that variable in the expression below fails (is replaced with empty string) +:: Also we can't anything else inside the if body as this will cause the curl command to always be executed. if defined MUMBLE_BUILD_NUMBER_TOKEN ( - :: The method we use to store a command's output into a variable: - :: https://stackoverflow.com/a/6362922 - for /f "tokens=* USEBACKQ" %%g in (`python "scripts\mumble-version.py" --project`) do (set "VERSION=%%g") for /f "tokens=* USEBACKQ" %%g in (`curl "https://mumble.info/get-build-number?version=%VERSION%_%AGENT_JOBNAME%&token=%MUMBLE_BUILD_NUMBER_TOKEN%"`) do (set "BUILD_NUMBER=%%g") ) else ( + echo Build number token not set - defaulting to 0 set BUILD_NUMBER=0 ) |