Skip to content

feat(workflows): add shared Go lint, test, build, release, and e2e reusable workflows#65

Open
onuryilmaz wants to merge 28 commits into
mainfrom
feat/shared-go-workflows
Open

feat(workflows): add shared Go lint, test, build, release, and e2e reusable workflows#65
onuryilmaz wants to merge 28 commits into
mainfrom
feat/shared-go-workflows

Conversation

@onuryilmaz

@onuryilmaz onuryilmaz commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Adds 5 new reusable (workflow_call) workflows to cloudoperators/common as part of #2086 — GHA Streamlining across cloudoperators repos.

New file Purpose
shared-go-lint.yaml golangci-lint + optional govulncheck (enable-govulncheck: true). Go version read from go.mod.
shared-go-test.yaml Parameterized make test target + optional coverage artifact upload. Go version read from go.mod.
shared-go-build.yaml Go binary build + optional Docker multi-arch build/push to GHCR. Go version read from go.mod.
shared-release.yaml Semver bump: reads VERSION from Makefile, updates Makefile + Chart.yaml, commits directly to the default branch, creates an annotated tag, creates a GitHub release via actions/github-script@v7, and optionally dispatches to greenhouse-extensions via GitHub App token (actions/create-github-app-token@v3 + peter-evans/repository-dispatch@v4).
shared-e2e.yaml Wraps the existing workflows/e2e composite action for KinD-based Greenhouse e2e tests.

Design notes

  • shared-release.yaml commits directly to the default branch — no release branch, no PR. The version bump commit is tagged in-place and the GitHub release points at that exact commit.
  • go-version input removed from all three Go workflows — version is always read from go.mod.
  • GitHub App token (dispatch-app-id + dispatch-app-private-key) replaces the old dispatch-token PAT for greenhouse-extensions dispatch.
  • Chart.yaml appVersion is controlled separately via bump-chart-app-version input (default true) to support chart-template-only bumps.
  • GHCR only for shared-go-build Docker push — image-name must start with ghcr.io/.
  • All external actions are pinned to full commit SHAs. Same-org references (cloudoperators/common) use @main by convention.

Consumer PRs (depend on this merging first)

Copilot AI review requested due to automatic review settings June 24, 2026 15:09
@onuryilmaz onuryilmaz requested a review from a team as a code owner June 24, 2026 15:09

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

Adds a set of reusable (workflow_call) GitHub Actions workflows intended to standardize Go CI (lint/test/build), releases, and KinD-based e2e execution across cloudoperators/* repositories as part of GHA streamlining.

Changes:

  • Introduces reusable Go lint, test, and build workflows with configurable runner, Go version (or go.mod), working directory, and targets.
  • Adds a reusable release workflow that bumps Makefile VERSION, optionally updates Chart.yaml, creates a release PR, creates a GitHub release, and optionally dispatches an event to cloudoperators/greenhouse-extensions.
  • Adds a reusable e2e workflow that wraps the existing workflows/e2e composite action and runs a caller-provided make e2e target.

Reviewed changes

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

Show a summary per file
File Description
.github/workflows/shared-go-lint.yaml Reusable Go lint workflow (golangci-lint + optional govulncheck).
.github/workflows/shared-go-test.yaml Reusable Go test workflow with configurable make target and optional coverage artifact upload.
.github/workflows/shared-go-build.yaml Reusable Go build workflow with optional Docker multi-arch build/push via GHCR.
.github/workflows/shared-release.yaml Reusable release automation workflow (version bump, optional chart update, PR, release, optional dispatch).
.github/workflows/shared-e2e.yaml Reusable e2e wrapper around the existing KinD-based workflows/e2e composite action.

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

Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-e2e.yaml Outdated
Comment thread .github/workflows/shared-e2e.yaml Outdated
Comment thread .github/workflows/shared-e2e.yaml Outdated
Comment thread .github/workflows/shared-go-build.yaml
Comment thread .github/workflows/shared-go-build.yaml
…usable workflows

Adds 5 new reusable workflows to support standardized CI/CD across
cloudoperators repos (shoot-grafter, repo-guard, permission-manager,
cloudctl, greenhouse-extensions):

- shared-go-lint.yaml: golangci-lint + optional govulncheck
- shared-go-test.yaml: parameterized make test target + optional coverage upload
- shared-go-build.yaml: Go binary build + optional Docker multi-arch build/push
- shared-release.yaml: semver bump, Chart.yaml update, release PR + GitHub release + optional greenhouse-extensions dispatch
- shared-e2e.yaml: KinD-based e2e wrapping the existing workflows/e2e composite action

Closes #2086

Signed-off-by: I313226 <onur.yilmaz@sap.com>
shared-release.yaml:
- Replace non-POSIX \s with [[:space:]] in grep and sed expressions
- Add -E flag to sed for portable extended regex
- Add fail-fast VERSION parse validation (must match X.Y.Z)
- Add environment input so callers can gate on protection rules
- Fall back to release-token when dispatch-token is not provided

shared-e2e.yaml:
- Checkout calling repo into path: caller to avoid workspace
  collision with the greenhouse checkout in the e2e composite action
- Run e2e make target in caller/<working-directory>
- Remove unused with-remote-cluster input
- Remove unused kubeconfig secret

shared-go-build.yaml:
- Add packages: write permission when push is true
- Add early validation step when docker-build is true and image-name is empty

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 5 out of 5 changed files in this pull request and generated 6 comments.

Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-go-lint.yaml Outdated
…-test job

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 5 out of 5 changed files in this pull request and generated 9 comments.

Comment thread .github/workflows/shared-release.yaml
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-go-lint.yaml Outdated
Comment thread .github/workflows/shared-e2e.yaml
Comment thread .github/workflows/shared-go-build.yaml
- Checkout default branch explicitly (ref: default_branch) so releases
  are never cut from a feature branch
- Use github.event.repository.default_branch instead of hard-coded 'main'
  for PR base and release --target, supporting non-main default branches
- Quote ${{ inputs.makefile-path }} in grep invocation
- Quote ${{ inputs.chart-path }} in both sed commands
- Create GitHub release targeting the default branch after fetching
  latest, so the tag points at the correct merged commit

Signed-off-by: I313226 <onur.yilmaz@sap.com>
Comment thread .github/workflows/shared-go-test.yaml

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 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-go-lint.yaml
Comment thread .github/workflows/shared-release.yaml
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml
Comment thread .github/workflows/shared-go-build.yaml Outdated
- shared-go-test: drop go-version input, always use go-version-file from go.mod
- shared-release: add if condition to Update Makefile VERSION step (skip when makefile-path is empty)
- shared-release: split Chart.yaml update into two steps with separate bump-chart-app-version input
- shared-release: replace gh CLI release creation with actions/github-script@v7
- shared-release: replace dispatch-token with GitHub App token via actions/create-github-app-token@v3 and peter-evans/repository-dispatch@v4

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 5 out of 5 changed files in this pull request and generated 7 comments.

Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-release.yaml
Comment thread .github/workflows/shared-e2e.yaml
Comment thread .github/workflows/shared-e2e.yaml
Comment thread .github/workflows/shared-release.yaml

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 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-e2e.yaml
Move all ${{ inputs.* }}, ${{ steps.*.outputs.* }}, and ${{ secrets.* }}
references out of run: shell scripts into env: blocks to prevent potential
shell injection and improve security posture across all five workflows:

- shared-go-test: validate extra-env lines match KEY=VALUE format before
  appending to GITHUB_ENV to give callers a clear error on malformed input
- shared-go-build: pass push/docker-build and image-name via env vars in
  both validate steps instead of inline template expressions
- shared-go-lint: pass govulncheck-version via env var in run: step
- shared-release: pass makefile-path, chart-path, bump, new-version, and
  plugin-name via env vars in all run: steps; remove all inline expressions
  from grep/sed/git commands

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/shared-release.yaml
Comment thread .github/workflows/shared-go-lint.yaml Outdated
Wrap the module@version argument in double quotes to prevent word-splitting
or globbing if GOVULNCHECK_VERSION contains unexpected characters.

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/shared-go-test.yaml
Comment thread .github/workflows/shared-go-build.yaml
Comment thread .github/workflows/shared-e2e.yaml
Add a preflight check that fails fast with a clear error if a Windows
runner is used, since both workflows require make which is not available
by default on Windows GitHub-hosted runners. Also update runs-on
descriptions to document the Linux/macOS requirement.

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/shared-e2e.yaml
Comment thread .github/workflows/shared-release.yaml
Comment thread .github/workflows/shared-release.yaml Outdated
GH_TOKEN was set in the env block of the git commit/tag/push step but
never used there — git authenticates via the release-token from checkout
and the GitHub release is created in a separate step. Remove it to avoid
implying gh CLI is needed and to reduce confusion.

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/shared-release.yaml Outdated
Comment thread .github/workflows/shared-e2e.yaml
…to shared-e2e

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/shared-release.yaml
Comment thread .github/workflows/shared-release.yaml
…criptions

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/shared-e2e.yaml
… inputs.remote-k8s-version

Signed-off-by: I313226 <onur.yilmaz@sap.com>

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 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/shared-release.yaml Outdated
Comment on lines +87 to +94
if [ -z "$MAKEFILE_PATH" ]; then
echo "ERROR: makefile-path is required for version computation"
exit 1
fi
if [ ! -f "$MAKEFILE_PATH" ]; then
echo "ERROR: makefile-path '$MAKEFILE_PATH' does not exist"
exit 1
fi
Comment on lines +102 to +112
env:
MAKEFILE_PATH: ${{ inputs.makefile-path }}
BUMP: ${{ inputs.bump }}
run: |
CURRENT_VERSION=$(grep -E '^VERSION[[:space:]]*[:?]?=' "$MAKEFILE_PATH" | head -1 | sed 's/.*=[[:space:]]*//' | tr -d '[:space:]' || true)
echo "Current version: $CURRENT_VERSION"

if ! echo "$CURRENT_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "ERROR: could not parse VERSION from $MAKEFILE_PATH (got: '$CURRENT_VERSION')"
exit 1
fi
… is now truly optional

Signed-off-by: I313226 <onur.yilmaz@sap.com>
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.

3 participants