Skip to content

Universal Go CI Tool - #23538

Open
kalverra wants to merge 11 commits into
developfrom
DX-5065/universal-go-ci-tool
Open

Universal Go CI Tool#23538
kalverra wants to merge 11 commits into
developfrom
DX-5065/universal-go-ci-tool

Conversation

@kalverra

Copy link
Copy Markdown
Collaborator

Intent

Create a Go tool to use in CI instead of ad-hoc bash scripts and complex YAML. Much easier to understand and test, and maybe a little faster to execute.


Stack created with GitHub Stacks CLIGive Feedback 💬

@github-actions

Copy link
Copy Markdown
Contributor

👋 kalverra, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@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

Failed Test Failure Summary Logs
Test_CRE_V2_HTTP_Action_CRUD_Regression The test 'Test_CRE_V2_HTTP_Action_CRUD_Regression' failed without providing specific error details. Logs ↗︎
Test_CRE_V2_HTTP_Action_CRUD_Regression/HTTP_Action_fails_with_oversized_request_body The test failed due to an error in compiling the workflow caused by a stream error while downloading a dependency. Logs ↗︎

View Full Report ↗︎Docs

Comment thread .github/workflows/ci-core.yml Outdated
@kalverra
kalverra requested a review from Tofel August 26, 2026 17:26
@kalverra
kalverra force-pushed the DX-5065/universal-go-ci-tool branch from ee01cd9 to 5ebc9f7 Compare August 26, 2026 17:27
@kalverra
kalverra requested a lite review from Copilot August 26, 2026 17:29

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

Introduces a new tools/ci Go-based CLI intended to centralize CI helper logic (matrix generation, GitHub Actions outputs, version reporting) and replaces repeated gotestsum-install snippets with reusable composite actions, while extending ci-core to run tools unit tests from a generated matrix.

Changes:

  • Added tools/ci Go module with Cobra CLI (version, tools matrix) plus internal helpers (ghaction, target discovery/matrix filtering) and tests.
  • Updated ci-core to build/cache the CI CLI, generate a tools test matrix, and run tools tests as a separate matrix job.
  • Replaced inline gotestsum installation/caching in multiple workflows with a new setup-gotestsum composite action; added a setup-ci-cli composite action.

Areas for scrupulous human review

  • tools/ci/cmd/tools.go:getGitChangedFiles + matrix generation path (error handling and correctness in shallow checkouts / PR contexts).
  • .github/workflows/ci-core.yml filter job’s “Generate tools test matrix” step (ensuring the matrix is non-empty when tools changes occur, and that git refs/history are sufficient).
  • .github/actions/setup-ci-cli/action.yml cache key correctness across runner architectures.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/ci/README.md Documents the new unified CI CLI tool and basic usage/testing.
tools/ci/main.go CLI entrypoint calling the Cobra root command.
tools/ci/internal/tools/target.go Discovers tool test targets and computes a filtered matrix based on changes/events.
tools/ci/internal/tools/target_test.go Unit tests for target discovery and matrix filtering behavior.
tools/ci/internal/ghaction/ghaction.go Wrapper for GitHub Actions outputs/env/summary and grouping.
tools/ci/internal/ghaction/ghaction_test.go Tests for GitHub Actions wrapper behavior and fallbacks.
tools/ci/go.mod New Go module for the CI CLI and its dependencies.
tools/ci/go.sum Dependency checksums for the new CI CLI module.
tools/ci/cmd/root.go Root Cobra command and repo-root discovery helper.
tools/ci/cmd/version.go ci version subcommand with text/JSON output.
tools/ci/cmd/version_test.go Tests for help output, version output, and repo-root discovery.
tools/ci/cmd/tools.go ci tools matrix command to emit matrix output (stdout and/or GHA outputs).
tools/ci/cmd/tools_test.go Tests for matrix JSON output, GHA output writing, and change filtering.
tools/ci/AGENTS.md Adds development rules/conventions for tools/ci.
GNUmakefile Adds make ci-cli target to build tools/ci binary locally.
.github/workflows/ci-core.yml Generates tools matrix via ci and adds a tools-tests matrix job.
.github/actions/setup-ci-cli/action.yml Composite action to build/cache tools/ci binary and export it to PATH.
.github/actions/setup-gotestsum/action.yml Composite action to cache/install gotestsum and add it to PATH.
.github/workflows/cre-wf-caching-test.yml Switches to setup-gotestsum composite action.
.github/workflows/cre-system-tests.yaml Switches to setup-gotestsum composite action.
.github/workflows/cre-soak-memory-leak.yml Switches to setup-gotestsum composite action.
.github/workflows/cre-regression-system-tests.yaml Switches to setup-gotestsum composite action.
.github/workflows/cre-mixed-env-tests.yaml Switches to setup-gotestsum composite action.
.github/workflows/ccip-system-tests.yaml Switches to setup-gotestsum composite action.

💡 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/tools.go
Comment thread tools/ci/internal/tools/target.go
Comment thread .github/actions/setup-ci-cli/action.yml Outdated
Comment thread .github/workflows/ci-core.yml
Comment thread tools/ci/AGENTS.md Outdated
@kalverra
kalverra force-pushed the DX-5065/universal-go-ci-tool branch from 77df296 to 6e6188f Compare August 27, 2026 17:59
@kalverra
kalverra requested a lite review from Copilot August 27, 2026 18:00

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

Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.

Suppressed comments (2)

tools/ci/internal/ghaction/ghaction_test.go:73

  • This fallback test is skipped in CI due to GITHUB_ENV being set. It can be made hermetic by clearing GITHUB_ENV via t.Setenv and running unconditionally in CI.
func TestGHAction_SetEnv_FallbackStdout(t *testing.T) {
	if os.Getenv("CI") == "true" || os.Getenv("GITHUB_ACTIONS") == "true" {
		t.Skip("skipping in CI: GITHUB_ENV is set in CI environment")
	}
	t.Parallel()
	var stdout bytes.Buffer
	act := ghaction.New(&stdout, "", "")

tools/ci/internal/ghaction/ghaction_test.go:104

  • This fallback test is skipped in CI due to GITHUB_STEP_SUMMARY being set. It can run in CI by clearing GITHUB_STEP_SUMMARY via t.Setenv before constructing the action context.
func TestGHAction_AddStepSummary_FallbackStdout(t *testing.T) {
	if os.Getenv("CI") == "true" || os.Getenv("GITHUB_ACTIONS") == "true" {
		t.Skip("skipping in CI: GITHUB_STEP_SUMMARY is set in CI environment")
	}
	t.Parallel()
	var stdout bytes.Buffer
	act := ghaction.NewWithOptions(&stdout, "", "", "")

Comment thread tools/ci/internal/ghaction/ghaction_test.go Outdated
Comment thread .github/actions/setup-ci-cli/action.yml Outdated
Comment thread GNUmakefile
Comment thread .github/workflows/ci-core.yml
@cl-sonarqube-production

Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
1 New Blocker Issues (required ≤ 0)
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

./coverage.txt
retention-days: 7

tools-tests:

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.

I'm curious if it makes sense for this to live in it's own workflow? We have ci-deployments now, so maybe tools should be in ci-tools?

Comment on lines +11 to +12
// Target represents a runnable Go test target in the tools directory.
type Target struct {

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.

I haven't seen the rest of the PR stack but this seem like it could/should be generic enough to apply to all go test targets?

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