Skip to content

release: publish trust-manager.crds.yaml as a GitHub Release artifact#948

Open
Sanil2108 wants to merge 1 commit into
cert-manager:mainfrom
Sanil2108:feat/release-crds-artifact
Open

release: publish trust-manager.crds.yaml as a GitHub Release artifact#948
Sanil2108 wants to merge 1 commit into
cert-manager:mainfrom
Sanil2108:feat/release-crds-artifact

Conversation

@Sanil2108

Copy link
Copy Markdown

Summary

Fixes #142. Adds a new `render-crds` make target that produces a stand-alone `trust-manager.crds.yaml` and attaches it to each draft GitHub Release — same convenience cert-manager itself ships as `cert-manager.crds.yaml`.

What changed

`make/release-crds.mk` (new)

```make
$(crds_release_artifact): $(helm_chart_archive) | $(NEEDS_HELM) $(NEEDS_YQ) $(bin_dir)/scratch
$(HELM) template trust-manager $(helm_chart_archive) \
--set crds.enabled=true \
--set crds.keep=false \
--show-only templates/crd-trust.cert-manager.io_bundles.yaml \
--no-hooks \
| $(YQ) 'del(.metadata.labels."app.kubernetes.io/managed-by", .metadata.labels."helm.sh/chart")' \
> $@
```

Rendering against `$(helm_chart_archive)` (the packaged tarball) rather than `$(helm_chart_source_dir)` is deliberate — `helm package --app-version` rewrites the chart's version, so the rendered CRD picks up the actual release tag in its `app.kubernetes.io/version` label. Templating against the source dir directly would ship a CRD labelled `v0.0.0`.

The yq filter strips the Helm-runtime-only labels (`app.kubernetes.io/managed-by`, `helm.sh/chart`) and `crds.keep=false` removes the `helm.sh/resource-policy: keep` annotation, so the artifact is suitable for plain `kubectl apply`.

`make/02_mod.mk`

Includes the new file and runs `render-crds` as the last step of `make release`. Echoes `RELEASE_CRDS_ARTIFACT=$(crds_release_artifact)` to `$GITHUB_OUTPUT` so the workflow can find it.

`.github/workflows/release.yaml`

The `build_and_push` job uploads `_bin/scratch/trust-manager.crds.yaml` as a workflow artifact (pinned `actions/upload-artifact@v7.0.1` SHA, matching the repo's existing SHA-pinning convention). The `github_release` job downloads it and passes it as a positional file argument to `gh release create` so it's attached to the draft release.

Test plan

  • `helm template … | yq …` renders cleanly against the current chart locally — output is well-formed CRD YAML, no Helm-runtime labels left.
  • Full release pipeline (only verifiable on a tag push). Worth flagging: `render-crds` is fatal in `make release` — if the template or yq filter fails, the release blocks. That's intentional (you'd want to know your release artifact pipeline broke), but happy to make it best-effort if you'd prefer.

Notes

Fixes #142

Adds a new \`render-crds\` make target (in make/release-crds.mk) that
renders the bundle CRD via \`helm template\` against deploy/charts/trust-manager
and strips the Helm-runtime-only labels (\`app.kubernetes.io/managed-by\`,
\`helm.sh/chart\`) plus the \`helm.sh/resource-policy: keep\` annotation
(via crds.keep=false). The result is dropped at
\`_bin/scratch/trust-manager.crds.yaml\` — the same shape cert-manager
ships as \`cert-manager.crds.yaml\`.

The release workflow now:
1. Runs \`render-crds\` as part of \`make release\` (added to the existing
   release target alongside the OCI/Helm pushes).
2. Uploads the rendered file from the build_and_push job as a
   workflow artifact.
3. Downloads the artifact in the github_release job and attaches it to
   the draft GitHub Release via \`gh release create ... <file>\`.

This unblocks the workflow described in cert-manager#142 — consumers (umbrella
charts, GitOps tooling, cdk8s import pipelines) can now pin trust-manager's
CRD by GitHub release tag without parsing the Helm chart out-of-band.

Fixes cert-manager#142

Signed-off-by: Sanil2108 <sanilkhurana7@gmail.com>
@cert-manager-prow cert-manager-prow Bot added the dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. label Apr 25, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hjoshi123 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 25, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

Hi @Sanil2108. Thanks for your PR.

I'm waiting for a cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@cert-manager-prow cert-manager-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 25, 2026
@Sanil2108

Copy link
Copy Markdown
Author

Hi @erikgb — just checking in on this one. It's been about three weeks since I opened the PR and I wanted to make sure I haven't missed any feedback. Happy to make changes if anything needs adjusting. Thanks!

@erikgb

erikgb commented May 15, 2026

Copy link
Copy Markdown
Member

@Sanil2108, thanks for the ping! This PR appears like an AI-generated PR. 🤠 Please confirm that you personally understand all the proposed changes and describe how you have tested the changes. Some of it will need to be tested when performing a release. I can cut an alpha release to test this after the PR is merged.

@cert-manager-prow cert-manager-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 21, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expose bundles CRD as release artifact

2 participants