Skip to content

Add go.mod replace directive guard to release workflows - #4671

Merged
efiacor merged 1 commit into
kptdev:mainfrom
Nordix:release-guard-replace-directives
Jul 30, 2026
Merged

Add go.mod replace directive guard to release workflows#4671
efiacor merged 1 commit into
kptdev:mainfrom
Nordix:release-guard-replace-directives

Conversation

@aravindtga

Copy link
Copy Markdown
Contributor

Description

  • What changed: Added a reusable composite action (.github/actions/check-go-mod-replace) and integrated it into both
    release.yml and release-api.yml workflows.
  • Why it's needed: Accidentally releasing with active replace directives in go.mod (e.g. local path overrides left from development) produces a broken module, consumers cannot resolve local replace targets. This gate catches the mistake before GoReleaser runs.
  • How it works: The composite action uses go mod edit -json and jq to semantically parse the module file and detect active replace directives. Commented-out replacements are ignored. An allowed-replacements input (JSON array of module paths) supports repos that have legitimate permanent replacements (e.g. porch's k8s.io/apiserver). If unexpected replacements
    are found, the step emits a GitHub Actions error annotation and exits non-zero, blocking the release.

The action is designed to be reusable across repos (porch, catalog, sdk) via uses: kptdev/kpt/.github/actions/check-go-mod-replace@main.

Related Issue(s)

  • None

Type of Change

  • Bug fix
  • New feature
  • Enhancement
  • Refactor
  • Documentation
  • Tests
  • Other: ________

Checklist

  • Code follows project style guidelines
  • Self-reviewed changes
  • Tests added/updated
  • Documentation added/updated
  • All tests and gating checks pass

AI Disclosure

  • I have used AI in the creation of this PR.

If so, please describe how:
- Kiro to locally validate the composite action and workflow changes and draft PR Message.

Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 94aa400
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6a6a1f2a6c3c2800081eeaf0
😎 Deploy Preview https://deploy-preview-4671--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud

Copy link
Copy Markdown

@aravindtga aravindtga self-assigned this Jul 29, 2026
@aravindtga
aravindtga marked this pull request as ready for review July 29, 2026 15:42
@aravindtga
aravindtga requested review from a team July 29, 2026 15:42
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. area/devops area/release kpt release issues labels Jul 29, 2026
@efiacor
efiacor merged commit 900e538 into kptdev:main Jul 30, 2026
26 checks passed
@efiacor
efiacor deleted the release-guard-replace-directives branch July 30, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/devops area/release kpt release issues lgtm size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants