From 935605ba21cb1d806d1c0d95f68a80e54cd8286e Mon Sep 17 00:00:00 2001 From: Quim Muntal Date: Thu, 13 Feb 2025 19:08:08 +0000 Subject: [PATCH] don't install custom pwsh on Linux (#1561) --- eng/init-pwsh.sh | 61 --------------------------- eng/pipeline/stages/run-stage.yml | 1 - eng/pipeline/steps/init-pwsh-task.yml | 17 -------- 3 files changed, 79 deletions(-) delete mode 100755 eng/init-pwsh.sh delete mode 100644 eng/pipeline/steps/init-pwsh-task.yml diff --git a/eng/init-pwsh.sh b/eng/init-pwsh.sh deleted file mode 100755 index 82123bce5fe..00000000000 --- a/eng/init-pwsh.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) Microsoft Corporation. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -# This script sets up a copy of PowerShell (pwsh command) in $HOME that can run on Linux. This is -# used in CI to set up PowerShell in a container that doesn't have pwsh installed already. It is not -# intended for use on dev machines. - -set -euo pipefail - -# Default values for x64. -pwsh_version='7.2.1' -pwsh_sha256='337d9864799ad09b46d261071b9f835f69f078814409bc2681f4cc2857b6bda5' -pwsh_arch='x64' - -# 'uname' approach adapted from .NET install script: https://github.com/dotnet/install-scripts/blob/df8f863720a462448ad244f03ffeb619f0631bad/src/dotnet-install.sh#L295-L315 -if command -v uname > /dev/null; then - CPUName=$(uname -m) - case $CPUName in - armv*l) - echo "armv*l was detected, but it is not supported by the microsoft/go build infrastructure." - exit 1 - ;; - aarch64|arm64) - pwsh_sha256='f0d6c9c36d69e1466e5a9412085ef52cafd10b73f862d29479b806279a2975f4' - pwsh_arch='arm64' - ;; - esac -else - echo "uname command not detected. Assuming $pwsh_arch." -fi - -pwsh_url="https://github.com/PowerShell/PowerShell/releases/download/v$pwsh_version/powershell-$pwsh_version-linux-$pwsh_arch.tar.gz" - -# pwsh must be installed outside of the Go repo. If it's in the repo, longtest "TestAllDependencies" -# fails. It tries to traverse the pwsh directory and can't handle the "no such file or directory" -# error caused by the symlink in the extracted dir: "libcrypto.so.1.0.0 -> /lib64/libcrypto.so.10". -# Ideally this should be in the repository. Tracked by: https://github.com/microsoft/go/issues/12 -pwsh_dir="$HOME/.go-ci-prereq/pwsh/$pwsh_version" -download_complete_indicator="$pwsh_dir/.downloaded" - -if [ ! -f "$download_complete_indicator" ]; then - echo "Downloading PowerShell $pwsh_version and extracting to '$pwsh_dir' ..." - echo "URL: $pwsh_url" - - # Clear existing dir in case it's in a broken state. - rm -rf "$pwsh_dir" - mkdir -p "$pwsh_dir" - - tarball="$pwsh_dir/pwsh.tar.gz" - - curl -SL --output "$tarball" "$pwsh_url" - echo "$pwsh_sha256 $tarball" | sha256sum -c - - tar -C "$pwsh_dir" -xzf "$tarball" - rm "$tarball" - - touch "$download_complete_indicator" - - echo "Done extracting to '$pwsh_dir'" -fi diff --git a/eng/pipeline/stages/run-stage.yml b/eng/pipeline/stages/run-stage.yml index f9e8bc7f17f..1da8b938cd9 100644 --- a/eng/pipeline/stages/run-stage.yml +++ b/eng/pipeline/stages/run-stage.yml @@ -133,7 +133,6 @@ stages: displayName: Cleanup - template: ../steps/checkout-unix-task.yml - - template: ../steps/init-pwsh-task.yml - pwsh: | New-Item eng/artifacts/bin -ItemType Directory -ErrorAction Ignore diff --git a/eng/pipeline/steps/init-pwsh-task.yml b/eng/pipeline/steps/init-pwsh-task.yml deleted file mode 100644 index e3a903aa8ba..00000000000 --- a/eng/pipeline/steps/init-pwsh-task.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -# On Linux, set up PowerShell and add to PATH. This allows it to be used in later "pwsh" steps in -# yml. We need to set this up using a script rather than pre-installing it into the container -# because we're using an existing container. - -steps: - - script: | - set -euo pipefail - - . eng/init-pwsh.sh - echo "##vso[task.prependpath]$pwsh_dir" - # Enable invariant mode to make .NET/PowerShell work without libicu installed. - echo "##vso[task.setvariable variable=DOTNET_SYSTEM_GLOBALIZATION_INVARIANT]1" - displayName: Init PowerShell