Skip to content

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

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#1144
efiacor merged 1 commit into
kptdev:mainfrom
Nordix:release-guard-replace-directives

Conversation

@aravindtga

Copy link
Copy Markdown
Contributor

Description

  • What changed: Added a pre-release validation step to both release.yaml and image-build-push-release.yaml workflows that checks for active replace directives in go.mod and api/go.mod.
  • Why it's needed: Accidentally releasing with active replace directives (e.g. local path overrides left from development) produces broken images or binaries, consumers cannot resolve local replace targets. This gate catches the mistake before the build proceeds.
  • How it works: Uses the shared composite action from kptdev/kpt/.github/actions/check-go-mod-replace@main (introduced in Add go.mod replace directive guard to release workflows kpt#4671). The action semantically parses go.mod using go mod edit -json and jq, filtering out allowed replacements (k8s.io/apiserver). If unexpected replacements are found, the step emits a GitHub Actions error annotation and exits non-zero, blocking the release.

For image-build-push-release.yaml, a new check-replace-directives job gates the build-and-push-image matrix job via needs.

Related Issue(s)

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 implement and locally validate the 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 kpt-porch ready!

Name Link
🔨 Latest commit bfd9518
🔍 Latest deploy log https://app.netlify.com/projects/kpt-porch/deploys/6a6a2b530295fc00083ff83b
😎 Deploy Preview https://deploy-preview-1144--kpt-porch.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.

@aravindtga aravindtga self-assigned this Jul 29, 2026
@sonarqubecloud

Copy link
Copy Markdown

@aravindtga
aravindtga marked this pull request as ready for review July 29, 2026 16:52
@aravindtga
aravindtga requested review from a team July 29, 2026 16:52
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 29, 2026
@dosubot dosubot Bot added the lgtm #ededed label Jul 30, 2026
@aravindtga
aravindtga requested review from a team July 30, 2026 08:30
Comment thread .github/workflows/image-build-push-release.yaml
@efiacor
efiacor merged commit ecb185f into kptdev:main Jul 30, 2026
28 of 30 checks passed
@efiacor
efiacor deleted the release-guard-replace-directives branch July 30, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm #ededed 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