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
This commit is contained in:
JohnHolmesII 2020-03-27 17:19:44 -07:00 committed by Ivan
parent cc100f4008
commit 8581a2775a
4 changed files with 23 additions and 30 deletions

View File

@ -1,27 +1,7 @@
#!/bin/sh -ex #!/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 # 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" ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY"
BUILD=$(trim_quotes "$BUILD")
# Remove unecessary files # Remove unecessary files
rm -f ./bin/rpcs3.exp ./bin/rpcs3.lib ./bin/rpcs3.pdb rm -f ./bin/rpcs3.exp ./bin/rpcs3.lib ./bin/rpcs3.pdb

View File

@ -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"

View File

@ -107,13 +107,10 @@ else
BUILD="rpcs3-v${AVVER}-${COMM_HASH}_win64.7z" BUILD="rpcs3-v${AVVER}-${COMM_HASH}_win64.7z"
fi fi
# Export variables for later stages of the Azure pipeline # BRANCH is used for experimental build warnings for pr builds, used in main_window.cpp.
# Values done in this manner will appear as environment variables # BUILD is the name of the release artifact
# in later stages, but are not added to environment variables # AVVER is used for GitHub releases, it is the version number.
# 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="${REPO_NAME}/${REPO_BRANCH}" BRANCH="${REPO_NAME}/${REPO_BRANCH}"
echo "##vso[task.setvariable variable=branch]$BRANCH" echo "BRANCH=$BRANCH" > .travis/azure-vars.env
echo "##vso[task.setvariable variable=build]$BUILD" echo "BUILD=$BUILD" >> .travis/azure-vars.env
echo "##vso[task.setvariable variable=avver]$AVVER" echo "AVVER=$AVVER" >> .travis/azure-vars.env

View File

@ -66,6 +66,9 @@ jobs:
- bash: .travis/setup-windows.sh - bash: .travis/setup-windows.sh
displayName: Download and unpack dependencies displayName: Download and unpack dependencies
- bash: .travis/export-azure-vars.sh
displayName: Export Variables
- task: VSBuild@1 - task: VSBuild@1
inputs: inputs:
solution: 'rpcs3.sln' solution: 'rpcs3.sln'