diff options
author | Davide Beatrici <git@davidebeatrici.dev> | 2021-01-06 21:35:05 +0300 |
---|---|---|
committer | Davide Beatrici <git@davidebeatrici.dev> | 2021-01-08 01:19:30 +0300 |
commit | ab6b6d142c3a40bd8beaa3cfdb1d16ad2002a5ed (patch) | |
tree | 32b371d334ae543feda3a8b448e6098c405c4d71 /.ci/azure-pipelines/build_linux.bash | |
parent | d8a5133b090cbffd920a861bb3ca787a8f524998 (diff) |
CI(azure): Get unique build number from our server
BUILD_NUMBER_TOKEN is defined on Azure Pipelines and contains a secret token that is used to access the endpoint on our server.
Restricted access is in place for the sole purpose of preventing the build number from being increased when accessing the page outside of the CI environment.
This commit also improves the descriptive header of the build script files.
Diffstat (limited to '.ci/azure-pipelines/build_linux.bash')
-rwxr-xr-x | .ci/azure-pipelines/build_linux.bash | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/.ci/azure-pipelines/build_linux.bash b/.ci/azure-pipelines/build_linux.bash index a4ca8a8e7..d9bcbe5ed 100755 --- a/.ci/azure-pipelines/build_linux.bash +++ b/.ci/azure-pipelines/build_linux.bash @@ -7,20 +7,34 @@ # # Below is a list of configuration variables used from environment. # +# Predefined variables: +# # BUILD_BINARIESDIRECTORY - The local path on the agent that can be used # as an output folder for compiled binaries. # BUILD_SOURCESDIRECTORY - The local path on the agent where the # repository is downloaded. # +# Defined on Azure Pipelines: +# +# BUILD_NUMBER_TOKEN - Access token for the build number page on our server. +# -VER=$(python scripts/mumble-version.py) +if [[ -n "$BUILD_NUMBER_TOKEN" ]]; then + VERSION=$(python "scripts/mumble-version.py" --project) + BUILD_NUMBER=$(curl "https://mumble.info/get-build-number?version=$VERSION&token=$BUILD_NUMBER_TOKEN") +else + BUILD_NUMBER=0 +fi + +RELEASE_ID=$(python "scripts/mumble-version.py") cd $BUILD_BINARIESDIRECTORY -cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=appdir/usr -Dtests=ON Donline-tests=ON -Dversion=$VER -Dsymbols=ON \ - -Donline-tests=ON -Dgrpc=ON -Ddisplay-install-paths=ON $BUILD_SOURCESDIRECTORY +cmake -G Ninja -DCMAKE_INSTALL_PREFIX=appdir/usr \ + -DCMAKE_BUILD_TYPE=Release -DRELEASE_ID=$RELEASE_ID -DBUILD_NUMBER=$BUILD_NUMBER \ + -Dtests=ON -Donline-tests=ON -Dsymbols=ON -Dgrpc=ON \ + -Ddisplay-install-paths=ON $BUILD_SOURCESDIRECTORY cmake --build . ctest --verbose cmake --install . - |