From 62aeae3a20921f9d786df0e2db560c6d0d70afa5 Mon Sep 17 00:00:00 2001 From: Mikhail Koliada <88318005+mikhailkoliada@users.noreply.github.com> Date: Wed, 27 Dec 2023 16:00:04 +0100 Subject: [PATCH] [macOS] pin pwsh-core in toolset (#9070) --- images/macos/scripts/build/install-powershell.sh | 12 ++++++++++-- images/macos/toolsets/toolset-11.json | 3 +++ images/macos/toolsets/toolset-12.json | 3 +++ images/macos/toolsets/toolset-13.json | 3 +++ images/macos/toolsets/toolset-14.json | 3 +++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/images/macos/scripts/build/install-powershell.sh b/images/macos/scripts/build/install-powershell.sh index b38ff10e7..557d0f767 100644 --- a/images/macos/scripts/build/install-powershell.sh +++ b/images/macos/scripts/build/install-powershell.sh @@ -10,8 +10,16 @@ echo Installing PowerShell... arch=$(get_arch) metadata_json_path=$(download_with_retry "https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json") -version=$(jq -r '.LTSReleaseTag[0]' "$metadata_json_path") -download_url=$(resolve_github_release_asset_url "PowerShell/PowerShell" "contains(\"osx-$arch.pkg\")" "$version" "$API_PAT") +pwshVersionToolset=$(get_toolset_value '.pwsh.version') +pwshVersions=$(jq -r '.LTSReleaseTag[]' "$metadata_json_path") + +for version in ${pwshVersions[@]}; do + if [[ "$version" =~ "$pwshVersionToolset" ]]; then + download_url=$(resolve_github_release_asset_url "PowerShell/PowerShell" "contains(\"osx-$arch.pkg\")" "$version" "$API_PAT") + break + fi +done + pkg_path=$(download_with_retry "$download_url") # Work around the issue on macOS Big Sur 11.5 or higher for possible error message ("can't be opened because Apple cannot check it for malicious software") when installing the package diff --git a/images/macos/toolsets/toolset-11.json b/images/macos/toolsets/toolset-11.json index d278f8ed8..e7bdd309e 100644 --- a/images/macos/toolsets/toolset-11.json +++ b/images/macos/toolsets/toolset-11.json @@ -361,5 +361,8 @@ }, "postgresql": { "version": "14" + }, + "pwsh": { + "version": "7.2" } } diff --git a/images/macos/toolsets/toolset-12.json b/images/macos/toolsets/toolset-12.json index 8e9e51711..979e24819 100644 --- a/images/macos/toolsets/toolset-12.json +++ b/images/macos/toolsets/toolset-12.json @@ -349,5 +349,8 @@ }, "postgresql": { "version": "14" + }, + "pwsh": { + "version": "7.2" } } diff --git a/images/macos/toolsets/toolset-13.json b/images/macos/toolsets/toolset-13.json index 5f29d86fb..0de30a0f6 100644 --- a/images/macos/toolsets/toolset-13.json +++ b/images/macos/toolsets/toolset-13.json @@ -234,5 +234,8 @@ "version": "3.15.4", "sha256": "356dab61433b5be76b76fd0e2e979bda56d164f6d85a900e55c3a4a5fffa28de" } + }, + "pwsh": { + "version": "7.2" } } diff --git a/images/macos/toolsets/toolset-14.json b/images/macos/toolsets/toolset-14.json index b5a71ba03..b06ee6c07 100644 --- a/images/macos/toolsets/toolset-14.json +++ b/images/macos/toolsets/toolset-14.json @@ -126,6 +126,9 @@ "php": { "version": "8.3" }, + "pwsh": { + "version": "7.2" + }, "mono": { "framework":{ "version": "6.12.0.188",