diff options
author | Connor Adsit <connor.adsit@gmail.com> | 2022-11-07 21:22:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-07 21:22:17 +0300 |
commit | 62896c2ce7bcede2e0a877c243417e08c279de79 (patch) | |
tree | 510dcef409b5614b7c5a29a492edee497f96e234 | |
parent | eab74420661dd4d42e6b17d1fafc65009c0b94dd (diff) | |
parent | b9621acae92010cd213f443d0277b4f7daca1d3f (diff) |
Merge pull request #823 from xamarin/dev/msylvia/update-provisionator-bootstrap
Update provisionator bootstrap
-rw-r--r-- | .build/automation/stages/validate.yml | 4 | ||||
-rwxr-xr-x | bot-provisioning/provisionator-bootstrap.sh | 40 |
2 files changed, 39 insertions, 5 deletions
diff --git a/.build/automation/stages/validate.yml b/.build/automation/stages/validate.yml index 5e55b70..e6942cb 100644 --- a/.build/automation/stages/validate.yml +++ b/.build/automation/stages/validate.yml @@ -15,7 +15,7 @@ stages: - task: provisionator@2 displayName: Provision Dependencies inputs: - github_token: $(GitHub.Token) + github_token: $(github-pat) provisioning_script: $(System.DefaultWorkingDirectory)/bot-provisioning/dependencies.csx provisioning_extra_args: -vv DEVDIV_PKGS_NUGET_TOKEN=$(DevDiv.NuGet.Token) SECTOOLS_PKGS_NUGET_TOKEN=$(SecTools.NuGet.Token) @@ -54,7 +54,7 @@ stages: - task: provisionator@2 displayName: Provision Dependencies inputs: - github_token: $(GitHub.Token) + github_token: $(github-pat) provisioning_script: $(System.DefaultWorkingDirectory)/bot-provisioning/dependencies.csx provisioning_extra_args: -vv DEVDIV_PKGS_NUGET_TOKEN=$(DevDiv.NuGet.Token) SECTOOLS_PKGS_NUGET_TOKEN=$(SecTools.NuGet.Token) diff --git a/bot-provisioning/provisionator-bootstrap.sh b/bot-provisioning/provisionator-bootstrap.sh index 520e2eb..8eea110 100755 --- a/bot-provisioning/provisionator-bootstrap.sh +++ b/bot-provisioning/provisionator-bootstrap.sh @@ -4,13 +4,34 @@ # D6F71FB5-F2A7-4A62-86D3-10DFE08301CC # https://github.com/xamarin/provisionator +while getopts ":t:" opt; do + case "${opt}" in + t) + TOKEN=${OPTARG} + shift 2 + ;; + esac +done + function selfdir { (cd "$(dirname "$1")"; echo "$PWD"; ) } selfdir=$(selfdir "$0") channel="${PROVISIONATOR_CHANNEL:-latest}" -base_url="https://bosstoragemirror.blob.core.windows.net/provisionator/664bd334021e3102cdef1af66c4fc9f1b2ecd2a21b47419e80d08da1f6c61c2a/${channel}" +# Grab auth token from Environment first +# Otherwise set to provided option, if available +base_url="https://dl.internalx.com/provisionator/664bd334021e3102cdef1af66c4fc9f1b2ecd2a21b47419e80d08da1f6c61c2a/${channel}" +auth_token=$AUTH_TOKEN_GITHUB_COM +if [ -z $auth_token ]; then + auth_token=$TOKEN +fi +if [ -z $auth_token ]; then + echo "WARNING: Please set AUTH_TOKEN_GITHUB_COM to a GitHub PAT before running provisionator or run provisionator.sh -t <TOKEN> ..." + echo "At a future point, Provisionator will not be able to bootstrap without the PAT set properly" + base_url="https://bosstoragemirror.blob.core.windows.net/provisionator/664bd334021e3102cdef1af66c4fc9f1b2ecd2a21b47419e80d08da1f6c61c2a/${channel}" +fi + latest_version_url="${base_url}/version" archive_name="provisionator.osx.10.11-x64.zip" @@ -20,9 +41,14 @@ archive_url="${base_url}/${archive_name}" binary_path="${archive_extract_path}/provisionator" set +e -latest_version="$(curl -fsL "${latest_version_url}")" +if [ -z $auth_token ]; then + latest_version="$(curl -fsL "${latest_version_url}")" +else + latest_version="$(curl -fsL -H "Authorization: token ${auth_token}" "${latest_version_url}")" +fi if [ $? != 0 ]; then echo "Unable to determine latest version from ${latest_version_url}" + echo "Please check to make sure a valid GitHub PAT was provided" exit 1 fi set -e @@ -31,7 +57,11 @@ function update_in_place { echo "Downloading Provisionator $latest_version..." local progress_type="-s" tty -s && progress_type="-#" - curl -f $progress_type -o "$archive_path" "$archive_url" + if [ -z $auth_token ]; then + curl -fL $progress_type -o "$archive_path" "$archive_url" + else + curl -fLH "Authorization: token ${auth_token}" $progress_type -o "$archive_path" "$archive_url" + fi rm -rf "$archive_extract_path" unzip -q -o -d "$archive_extract_path" "$archive_path" rm -f "$archive_path" @@ -47,4 +77,8 @@ else update_in_place fi +# Opt out of macOS backward compat so correct Big Sur OS versions can be obtained. +# More info https://github.com/ziglang/zig/issues/7569 +export SYSTEM_VERSION_COMPAT=0 + exec "$binary_path" "$@" |