Skip to content

upstream_merge: Extract pipeline tool installation#366

Open
Shreejit-03 wants to merge 1 commit into
ni:nilrt/master/scarthgapfrom
Shreejit-03:automation_upstream_merge
Open

upstream_merge: Extract pipeline tool installation#366
Shreejit-03 wants to merge 1 commit into
ni:nilrt/master/scarthgapfrom
Shreejit-03:automation_upstream_merge

Conversation

@Shreejit-03

@Shreejit-03 Shreejit-03 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings July 2, 2026 10:20
@Shreejit-03 Shreejit-03 requested a review from a team as a code owner July 2, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh to set up a tools directory, install git-send-email, and install gh (GitHub CLI).
  • Verifies the downloaded GitHub CLI archive using the published SHA-256 checksums before installing.
  • Prepares TOOLS_DIR and updates PATH so subsequent steps can use the installed tools.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/dev/upstream_merge/install_tools.sh Outdated
Comment thread scripts/dev/upstream_merge/install_tools.sh Outdated
Comment thread scripts/dev/upstream_merge/install_tools.sh
Comment thread scripts/dev/upstream_merge/install_tools.sh Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread scripts/dev/upstream_merge/install_tools.sh Outdated
Comment thread scripts/dev/upstream_merge/install_tools.sh Outdated
Comment thread scripts/dev/upstream_merge/install_tools.sh Outdated
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>
@Shreejit-03 Shreejit-03 force-pushed the automation_upstream_merge branch from 1c64c6c to d679ea5 Compare July 5, 2026 18:52
mkdir -p -- "$TOOLS_DIR"
TOOLS_DIR="$(cd -P -- "$TOOLS_DIR" && pwd -P)"

if [[ "$TOOLS_DIR" == "/" || "$TOOLS_DIR" == "$cwd" || "$TOOLS_DIR" == "$parent" ]]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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..."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

[nit] Missing newline at end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants