2022-12-29 12:56:54 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# Depends on PowerShell
|
|
|
|
# Reference https://github.com/Azure/arm-ttk
|
|
|
|
# Reference https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/test-toolkit
|
|
|
|
|
2023-12-15 05:59:36 -05:00
|
|
|
url=$(
|
|
|
|
set -euo pipefail
|
|
|
|
curl -s \
|
|
|
|
-H "Accept: application/vnd.github+json" \
|
|
|
|
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
|
|
|
|
https://api.github.com/repos/Azure/arm-ttk/releases/latest | jq -r '.tarball_url'
|
|
|
|
)
|
2023-01-03 22:23:45 -05:00
|
|
|
mkdir -p /usr/lib/microsoft
|
2022-12-29 12:56:54 -05:00
|
|
|
curl --retry 5 --retry-delay 5 -sL \
|
|
|
|
-H "Accept: application/vnd.github+json" \
|
2023-01-04 00:41:31 -05:00
|
|
|
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
|
2022-12-29 12:56:54 -05:00
|
|
|
"${url}" | tar -xz -C /usr/lib/microsoft
|
2023-01-03 23:18:52 -05:00
|
|
|
mv /usr/lib/microsoft/Azure-arm-ttk-*/arm-ttk /usr/lib/microsoft/arm-ttk
|
|
|
|
rm -rf /usr/lib/microsoft/Azure-arm-ttk-*
|
|
|
|
chmod a+x /usr/lib/microsoft/arm-ttk/arm-ttk.psd1
|
|
|
|
ln -sTf /usr/lib/microsoft/arm-ttk/arm-ttk.psd1 /usr/bin/arm-ttk
|