Skip to content

Port Old Bash to New Go CI Tool - #23540

Merged
kalverra merged 3 commits into
developfrom
DX-5065/go-ci-tool-first-ports
Sep 1, 2026
Merged

Port Old Bash to New Go CI Tool#23540
kalverra merged 3 commits into
developfrom
DX-5065/go-ci-tool-first-ports

Conversation

@kalverra

@kalverra kalverra commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Intent

Port a few low-risk bash scripts over to the new Go CI tool (tools/ci) to prove the concept works end-to-end before migrating more of the critical-path CI flow. This is the first in a series of ports toward replacing untested bash embedded in workflows with a tested Go CLI.

Big Changes

ci image resolve replaces resolve-chainlink-image.sh

A new image command (with resolve subcommand) replaces .github/scripts/resolve-chainlink-image.sh. Domain logic lives in internal/image (pure function: options in, (resolvedURI, error) out, with trimming/lowercasing/validation), and cmd/image.go is a thin cobra shell that reads flags with env fallbacks and renders human or --json output. When GITHUB_OUTPUT is set, it writes resolved_image via internal/ghaction.

This moves untested bash (and its bespoke bash test harness + dedicated workflow) into Go with a proper test suite, matching the tool's internal/cmd separation and dual-output conventions.

ci changeset check-tags replaces check-changeset-tags.sh

A new changeset command (with check-tags subcommand) replaces .github/scripts/check-changeset-tags.sh. internal/changeset parses changeset frontmatter (validating the chainlink semver), scans content for release tags loaded from an embedded tags.txt, and returns a Result. A golden test (TestAllowedTags) guards the exact tag set against unintentional drift.

This replaces an unvalidated inline tag list with an embedded golden file, and adds real tests where the shell script had none.

Small Changes

  • Updated legacy-non-functional-tests.yml, legacy-system-tests.yml, and changeset.yml to invoke ci image resolve / ci changeset check-tags via a new setup-ci-cli action instead of running the bash scripts inline.
  • Deleted .github/scripts/resolve-chainlink-image.sh, resolve-chainlink-image_test.sh, check-changeset-tags.sh, and the resolve-chainlink-image-tests.yml workflow (all superseded by the Go commands and tests).
  • Documented the two new commands in tools/ci/README.md.
  • Added gopkg.in/yaml.v3 dependency for changeset frontmatter parsing.

Callouts

  • changeset output consistencychangeset.go unconditionally calls SetOutput while image.go guards on GITHUB_OUTPUT. Local human output may pick up has_tags=/found_tags= lines. Worth deciding on a single convention.
  • Multi-file changesetsCHANGESET_FILE_PATH comes from dorny/paths-filter (list-files: shell) and can contain multiple space-separated paths; a single path is currently assumed, which can produce confusing os.Stat failures. This is a known follow-up, not addressed in this port.
  • Duplicate logic parity — reviewers should confirm the Go implementations preserve the bash behavior exactly (case-insensitivity, whitespace trimming, case-sensitive image tag, error exit codes), since these scripts feed onward CI steps.

@github-actions

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@trunk-io

trunk-io Bot commented Aug 25, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

"#wip",
"#bugfix",
"#internal",
}

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 need some mechanism to validate/expand this list automatically, when what release process expects changes?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The tags list was previously stored in the shell script, so I think this is a lateral move at-worst.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've slightly improved it further by moving it to a golden file, tags.txt, instead of directly in code.

Comment thread tools/ci/cmd/changeset_test.go Outdated
Comment thread tools/ci/cmd/image_test.go Outdated
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch 2 times, most recently from facea06 to 89920d2 Compare August 26, 2026 17:29
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch from 89920d2 to 8639ad2 Compare August 26, 2026 18:22
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch from 8639ad2 to a04336e Compare August 26, 2026 18:49
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch 2 times, most recently from 7ddd53d to cd7898b Compare August 26, 2026 20:07
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch from cd7898b to 1a26b6b Compare August 27, 2026 17:59
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch from 1a26b6b to 036d4b7 Compare August 27, 2026 18:22
erikburt
erikburt previously approved these changes Aug 28, 2026
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch from 036d4b7 to 271269c Compare August 31, 2026 15:22
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch from 271269c to 700902a Compare August 31, 2026 18:17
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch from 700902a to f5e830e Compare September 1, 2026 13:29
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch from f5e830e to e8de231 Compare September 1, 2026 13:34
Base automatically changed from DX-5065/go-ci-tool-delete-dead to develop September 1, 2026 16:10
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch 2 times, most recently from 7e583e9 to e8de231 Compare September 1, 2026 16:54
@kalverra
kalverra force-pushed the DX-5065/go-ci-tool-first-ports branch from e8de231 to f161e3a Compare September 1, 2026 16:55
@kalverra kalverra closed this Sep 1, 2026
@kalverra kalverra reopened this Sep 1, 2026
@kalverra
kalverra requested review from Tofel and erikburt and a lite review from Copilot September 1, 2026 17:30

Copilot AI left a comment

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.

Pull request overview

Risk Rating: MEDIUM — This ports CI-critical workflow logic from bash to a Go CLI (tools/ci) and wires it into multiple GitHub Actions workflows. While the logic itself is small, any mismatch in CLI behavior/outputs can break CI pipelines.

Summary:
Ports the legacy “resolve Chainlink image” and “changeset tag checking” bash scripts to the ci Go tool, updates workflows to use the new commands, and removes the old scripts and their dedicated workflow tests.

Changes:

  • Add ci image resolve (plus unit tests) to compute public/SDLC ECR image URIs and set resolved_image output.
  • Add ci changeset check-tags (plus unit tests) to validate changeset semver frontmatter and detect allowed release tags.
  • Update workflows to call the new Go CLI and delete the legacy bash scripts and the resolver bash test workflow.

Areas needing scrupulous human review:

  • ci changeset check-tags input contract vs dorny/paths-filter output format (*_files may include multiple paths).
  • GitHub Actions output behavior (ensuring outputs go to GITHUB_OUTPUT file only when expected; avoid polluting stdout in non-Actions runs).
  • Workflow integration points (legacy-*-tests.yml, changeset.yml) to confirm step outputs are still consumed as intended.

Reviewed changes

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

Show a summary per file
File Description
tools/ci/README.md Documents new ci image resolve and ci changeset check-tags commands.
tools/ci/internal/image/image.go Implements image URI resolution for public vs SDLC ECR.
tools/ci/internal/image/image_test.go Unit tests for image URI resolution + normalization/validation.
tools/ci/internal/changeset/tags.txt Adds canonical allowed changeset tags list (embedded).
tools/ci/internal/changeset/changeset.go Implements frontmatter semver validation + tag detection using embedded tags list.
tools/ci/internal/changeset/changeset_test.go Golden test for allowed tags + functional tests for CheckTags.
tools/ci/go.mod Adds YAML dependency for changeset frontmatter parsing.
tools/ci/go.sum Updates checksums for new YAML dependency and transitive modules.
tools/ci/cmd/root.go Registers new image and changeset command groups.
tools/ci/cmd/image.go Adds ci image resolve command (flags/env + JSON + GitHub output).
tools/ci/cmd/image_test.go CLI-level tests for ci image resolve output + GITHUB_OUTPUT writing.
tools/ci/cmd/changeset.go Adds ci changeset check-tags command (file arg/env + JSON + outputs).
tools/ci/cmd/changeset_test.go CLI-level tests for ci changeset check-tags JSON/human modes + outputs.
.github/workflows/resolve-chainlink-image-tests.yml Removes legacy bash-based resolver test workflow.
.github/workflows/legacy-system-tests.yml Switches resolver step to ci image resolve (after setting up CI CLI).
.github/workflows/legacy-non-functional-tests.yml Switches resolver step to ci image resolve (after setting up CI CLI).
.github/workflows/changeset.yml Switches changeset tag check step to ci changeset check-tags (after setting up CI CLI).
.github/scripts/resolve-chainlink-image.sh Deletes legacy bash resolver implementation.
.github/scripts/resolve-chainlink-image_test.sh Deletes legacy bash resolver tests.
.github/scripts/check-changeset-tags.sh Deletes legacy bash changeset tag checker.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tools/ci/cmd/changeset.go
Comment thread tools/ci/cmd/changeset.go Outdated
Comment thread tools/ci/internal/changeset/changeset.go
@cl-sonarqube-production

Copy link
Copy Markdown

@kalverra
kalverra added this pull request to the merge queue Sep 1, 2026
Merged via the queue into develop with commit 4294790 Sep 1, 2026
226 checks passed
@kalverra
kalverra deleted the DX-5065/go-ci-tool-first-ports branch September 1, 2026 21:40
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.

6 participants