Skip to content

Fix kubectl plugin release

What this PR does / why we need it:

Fixes build and release of the kubectl plugin using GitHub Actions and publishes updates to krew-index. Fixes #12226 #10738

Since GoReleaser and krew-index require semantic version tags, the controller-vx.x.x tags violate SemVer. The GitHub Action has been modified to run only on tags prefixed with controller- and to extract only the vx.x.x part for versioning.

Some workarounds were implemented, such as setting the git tag within the pipeline because goreleaser release requires a valid SemVer tag in git. The release functionality of GoReleaser is not used, as it would create a new GitHub release without the controller- prefix. Instead, the softprops/action-gh-release action is used to upload artifacts to the existing release.

Another issue is that krew’s plugin manifest requires the version field to be a valid SemVer tag. The rajatjindal/krew-release-bot action uses {{ .Tag }} as the git tag when the action starts (controller-vx.x.x), which fails validation. To resolve this, the krew manifest generation has been changed to use GoReleaser’s Krew publish.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • CVE Report (Scanner found CVE and adding report)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only

Which issue/s this PR fixes

fixes #12226 fixes #10738

How Has This Been Tested?

I have created test releases in a forked repository. See the controller-v1.12.1 release and the GitHub Action. A test PR to krew-index has been created by the GitHub Workflow.

The helm-4.12.1 release skips the workflow.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added unit and/or e2e tests to cover my changes.
  • All new and existing tests passed.

Merge request reports

Loading