upstream_merge: Extract pipeline tool installation#366
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a reusable shell script to install and validate tools needed by the upstream-merge workflow, aiming to centralize logic previously embedded in the CI pipeline.
Changes:
- Adds
install_tools.shto set up a tools directory, installgit-send-email, and installgh(GitHub CLI). - Verifies the downloaded GitHub CLI archive using the published SHA-256 checksums before installing.
- Prepares
TOOLS_DIRand updatesPATHso subsequent steps can use the installed tools.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
781a04d to
1c64c6c
Compare
Move the tool installation logic from the Azure DevOps pipeline into a reusable install_tools.sh script. The script installs git-send-email and the GitHub CLI, verifies the downloaded GitHub CLI archive using its published checksum, and prepares the tool directory for the upstream merge workflow. Update the pipeline to invoke the helper script for both CURRENT and NEXT branch jobs, reducing duplicated logic and making future maintenance easier. Signed-off-by: Shreejit-03 <shreejit.c@emerson.com>
1c64c6c to
d679ea5
Compare
| mkdir -p -- "$TOOLS_DIR" | ||
| TOOLS_DIR="$(cd -P -- "$TOOLS_DIR" && pwd -P)" | ||
|
|
||
| if [[ "$TOOLS_DIR" == "/" || "$TOOLS_DIR" == "$cwd" || "$TOOLS_DIR" == "$parent" ]]; then |
There was a problem hiding this comment.
Shouldn't this check happen before the dir is even created in line 19?
|
|
||
| set -euo pipefail | ||
|
|
||
| : "${TOOLS_DIR:?TOOLS_DIR environment variable is not set}" |
There was a problem hiding this comment.
Any reason we've to use a user provided TOOLS_DIR? Can't we just create a temp dir using mktemp -d? If we do that we can get rid of most of sanity checks below.
|
|
||
| export PATH="$TOOLS_DIR:$PATH" | ||
|
|
||
| echo "Installing git-send-email..." |
There was a problem hiding this comment.
Why not just use a docker image with all required tools installed? I assume this is run in a pipeline in which case docker will be available.
|
|
||
| ARCH=$(uname -m) | ||
|
|
||
| case "$ARCH" in |
There was a problem hiding this comment.
Do we really need this check? Are we expecting this script to be run on any other machine than x86/64? If not, let's remove; no need to complicate the script.
|
|
||
| gh --version | ||
|
|
||
| echo "All required tools are ready." No newline at end of file |

Changes
Move the tool installation logic from the Azure DevOps pipeline into a reusable install_tools.sh script.
The script installs git-send-email and the GitHub CLI, verifies the downloaded GitHub CLI archive using its published checksum, and prepares the tool directory for the upstream merge workflow.
Update the pipeline to invoke the helper script for both CURRENT and NEXT branch jobs, reducing duplicated logic and making future maintenance easier.
Justification
AB#3174387.