From 8581a2775af56d2e965b9d035ef4b5a399272a6d Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Fri, 27 Mar 2020 17:19:44 -0700 Subject: [PATCH] CI: Add workaround for exporting variables in Azure Using '-x' to echo commands in the shell causes the Azure process commands to be processed twice --- .travis/deploy-windows.sh | 22 +--------------------- .travis/export-azure-vars.sh | 13 +++++++++++++ .travis/setup-windows.sh | 15 ++++++--------- azure-pipelines.yml | 3 +++ 4 files changed, 23 insertions(+), 30 deletions(-) create mode 100644 .travis/export-azure-vars.sh diff --git a/.travis/deploy-windows.sh b/.travis/deploy-windows.sh index fe33307e8f..c612701e5f 100644 --- a/.travis/deploy-windows.sh +++ b/.travis/deploy-windows.sh @@ -1,32 +1,12 @@ #!/bin/sh -ex -# From pure sh bible, strips rogue quotes -# Does single and double quotes -trim_quotes() -{ - set -f - - old_ifs=$IFS - IFS=\"\' - - set -- $1 - IFS= - printf '%s\n' "$*" - IFS=$old_ifs - - set +f -} - # BUILD_blablabla is Azure specific, so we wrap it for portability -# The BUILD var is passed from a previous stage, so it is cleaned -# due to a bug in Azure ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY" -BUILD=$(trim_quotes "$BUILD") # Remove unecessary files rm -f ./bin/rpcs3.exp ./bin/rpcs3.lib ./bin/rpcs3.pdb -# Prepare compatibility database for packaging, as well as +# Prepare compatibility database for packaging, as well as # certificate for ssl (auto-updater) curl -sL 'https://rpcs3.net/compatibility?api=v1&export' | iconv -t UTF-8 > ./bin/GuiConfigs/compat_database.dat curl -sL 'https://curl.haxx.se/ca/cacert.pem' > ./bin/cacert.pem diff --git a/.travis/export-azure-vars.sh b/.travis/export-azure-vars.sh new file mode 100644 index 0000000000..a54c2b7bff --- /dev/null +++ b/.travis/export-azure-vars.sh @@ -0,0 +1,13 @@ +#!/bin/sh -e + +# Export variables for later stages of the Azure pipeline +# Values done in this manner will appear as environment variables +# in later stages. + +# From pure-sh-bible +# Setting 'IFS' tells 'read' where to split the string. +while IFS='=' read -r key val; do + # Skip over lines containing comments. + [ "${key##\#*}" ] || continue + echo "##vso[task.setvariable variable=$key]$val" +done < ".travis/azure-vars.env" diff --git a/.travis/setup-windows.sh b/.travis/setup-windows.sh index b71d993590..f66cd89620 100644 --- a/.travis/setup-windows.sh +++ b/.travis/setup-windows.sh @@ -107,13 +107,10 @@ else BUILD="rpcs3-v${AVVER}-${COMM_HASH}_win64.7z" fi -# Export variables for later stages of the Azure pipeline -# Values done in this manner will appear as environment variables -# in later stages, but are not added to environment variables -# in *this* stage. Thank azure for that one. -# BRANCH is used for experimental build warnings for pr builds -# used in main_window.cpp. AVVER is used for GitHub releases. +# BRANCH is used for experimental build warnings for pr builds, used in main_window.cpp. +# BUILD is the name of the release artifact +# AVVER is used for GitHub releases, it is the version number. BRANCH="${REPO_NAME}/${REPO_BRANCH}" -echo "##vso[task.setvariable variable=branch]$BRANCH" -echo "##vso[task.setvariable variable=build]$BUILD" -echo "##vso[task.setvariable variable=avver]$AVVER" +echo "BRANCH=$BRANCH" > .travis/azure-vars.env +echo "BUILD=$BUILD" >> .travis/azure-vars.env +echo "AVVER=$AVVER" >> .travis/azure-vars.env diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e5c08d7ee0..2ed2c172fc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -66,6 +66,9 @@ jobs: - bash: .travis/setup-windows.sh displayName: Download and unpack dependencies + - bash: .travis/export-azure-vars.sh + displayName: Export Variables + - task: VSBuild@1 inputs: solution: 'rpcs3.sln'