From 1c03bd1317ac295767be9dae0646276f4307f58f Mon Sep 17 00:00:00 2001 From: Patrick Meinecke Date: Thu, 10 Oct 2024 13:16:28 -0400 Subject: [PATCH] Change snapcraft to read base url from buildinfo (#111) --- lts/snap/snapcraft.yaml | 14 +++++++------- preview/snap/snapcraft.yaml | 14 +++++++------- stable/snap/snapcraft.yaml | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lts/snap/snapcraft.yaml b/lts/snap/snapcraft.yaml index 25913ef..91ef4b4 100644 --- a/lts/snap/snapcraft.yaml +++ b/lts/snap/snapcraft.yaml @@ -52,26 +52,26 @@ parts: snapcraftctl set-grade "stable" override-build: | file="./version.txt" + buildinfo=$(curl -s -L https://aka.ms/pwsh-buildinfo-7-4) + baseurl=$(echo $buildinfo | jq -r .BaseUrl) if [ -f "$file" ] then echo "using version file" version=$(cat $file) else echo "getting latest version from GitHub" - version=$(curl -s -L https://aka.ms/pwsh-buildinfo-7-4| jq -r .ReleaseTag | sed 's/v//') + version=$(echo $buildinfo | jq -r .ReleaseTag | sed 's/v//') echo "Writing version to file" echo $version > $file fi - container=$(echo v$version| sed 's/\./-/g') - echo "getting powershell $version - $container" - # These urls are subject to change. + echo "getting powershell $version - $baseurl/v$version" case "$SNAPCRAFT_ARCH_TRIPLET" in aarch64-linux-gnu) - curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm64.tar.gz ;; + curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm64.tar.gz ;; arm-linux-gnueabihf) - curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm32.tar.gz ;; + curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm32.tar.gz ;; x86_64-linux-gnu) - curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-x64.tar.gz ;; + curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-x64.tar.gz ;; *) # fail because we don't have a build for the requested platform echo "The $SNAPCRAFT_ARCH_TRIPLET platform does not have an available build. Exiting." diff --git a/preview/snap/snapcraft.yaml b/preview/snap/snapcraft.yaml index 8cd87a7..3e3387b 100644 --- a/preview/snap/snapcraft.yaml +++ b/preview/snap/snapcraft.yaml @@ -50,26 +50,26 @@ parts: snapcraftctl set-grade "stable" override-build: | file="./version.txt" + buildinfo=$(curl -s -L https://aka.ms/pwsh-buildinfo-preview) + baseurl=$(echo $buildinfo | jq -r .BaseUrl) if [ -f "$file" ] then echo "using version file" version=$(cat $file) else echo "getting latest version from GitHub" - version=$(curl -s -L https://aka.ms/pwsh-buildinfo-preview | jq -r .ReleaseTag | sed 's/v//') + version=$(echo $buildinfo | jq -r .ReleaseTag | sed 's/v//') echo "Writing version to file" echo $version > $file fi - container=$(echo v$version| sed 's/\./-/g') - echo "getting powershell $version - $container" - # These urls are subject to change. + echo "getting powershell $version - $baseurl/v$version" case "$SNAPCRAFT_ARCH_TRIPLET" in aarch64-linux-gnu) - curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm64.tar.gz ;; + curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm64.tar.gz ;; arm-linux-gnueabihf) - curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm32.tar.gz ;; + curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm32.tar.gz ;; x86_64-linux-gnu) - curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-x64.tar.gz ;; + curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-x64.tar.gz ;; *) # fail because we don't have a build for the requested platform echo "The $SNAPCRAFT_ARCH_TRIPLET platform does not have an available build. Exiting." diff --git a/stable/snap/snapcraft.yaml b/stable/snap/snapcraft.yaml index 525aa9b..2f217cf 100644 --- a/stable/snap/snapcraft.yaml +++ b/stable/snap/snapcraft.yaml @@ -52,26 +52,26 @@ parts: snapcraftctl set-grade "stable" override-build: | file="./version.txt" + buildinfo=$(curl -s -L https://aka.ms/pwsh-buildinfo-7-4) + baseurl=$(echo $buildinfo | jq -r .BaseUrl) if [ -f "$file" ] then echo "using version file" version=$(cat $file) else echo "getting latest version from GitHub" - version=$(curl -s -L https://aka.ms/pwsh-buildinfo-7-4| jq -r .ReleaseTag | sed 's/v//') + version=$(echo $buildinfo | jq -r .ReleaseTag | sed 's/v//') echo "Writing version to file" echo $version > $file fi - container=$(echo v$version| sed 's/\./-/g') - echo "getting powershell $version - $container" - # These urls are subject to change. + echo "getting powershell $version - $baseurl/v$version" case "$SNAPCRAFT_ARCH_TRIPLET" in aarch64-linux-gnu) - curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm64.tar.gz ;; + curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm64.tar.gz ;; arm-linux-gnueabihf) - curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm32.tar.gz ;; + curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm32.tar.gz ;; x86_64-linux-gnu) - curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-x64.tar.gz ;; + curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-x64.tar.gz ;; *) # fail because we don't have a build for the requested platform echo "The $SNAPCRAFT_ARCH_TRIPLET platform does not have an available build. Exiting."