Skip to content

ci: approve library chart releases - #520

Merged
uniqueg merged 5 commits into
devfrom
ci/approve-chart-releases
Oct 26, 2026
Merged

uniqueg merged 5 commits into
devfrom
ci/approve-chart-releases

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Releases of the library chart foca-common now wait for a maintainer's approval before anything is published, as FOCA's own releases do with the pypi environment.

  • release-chart.yml: publish (package, push, attest and sign) runs in the environment chart-release, after test. The tag and version checks (signed annotated tag of the checked-out commit, on dev, matching version) moved from publish to the start of test. The maintainer therefore approves a run whose tag and chart have passed all checks. The check that the version is not yet published stays in publish, right before the push. publish reads the version from needs.test.outputs.version.
  • The environment url points to the chart's package page.
  • Docs: "Releases" in docs/helm-chart.md describes the new order and the environment, and says that a re-run of the publishing job needs a new approval. It also says that the environment must exist before the workflow first runs. The release section of docs/contributing.md mentions the approval.

The tag ruleset and the existing checks are unchanged. Job IDs and names are unchanged, so no required checks are affected.

Closes #449

Repository settings (maintainer, before merging)

The environment must exist before the next chart-v* tag is pushed. Otherwise GitHub creates it on first use without protection rules.

Settings → Environments → New environment chart-release:

  • Required reviewers: the maintainer(s) who approve pypi releases.
  • Deployment branches and tags: "Selected branches and tags", one tag rule chart-v*.
  • Optional, decide like for pypi: "Prevent self-review" and turning off "Allow administrators to bypass configured protection rules". With the defaults, the admin who pushes the tag (only admins can) may approve their own run.

Verification

  • actionlint .github/workflows/release-chart.yml: no findings.
  • zizmor --offline .github/workflows/release-chart.yml: the same 2 low self-repository findings as on dev, none new.
  • pre-commit run --files <changed files>: passed (check-yaml, whitespace, semgrep).
  • mkdocs build --strict: passed. pytest tests/test_docs_hooks.py: 27 passed.
  • Dry run of the moved "Check tag and version" script (extracted with yq) against the existing tag chart-v0.2.0 at its commit, with read-only API calls: passed and wrote version=0.2.0. With a mismatched tag (chart-v0.1.0 at that commit) it failed as expected.
  • Not verified: an actual run with the environment (approval gate, needs outputs on "Re-run failed jobs"). This needs the environment and a chart tag. A dry run in a fork could cover it. I did not check whether the environment already exists, because reading the repo's environments was not permitted.
  • CI: all checks passed (CI passed, Chart, Chart install, Lint, tests, scans, CodeQL, Read the Docs).

Declined review findings

  • The environment url 404s before the first release: the package already exists (chart-v0.1.0 and chart-v0.2.0 are released) and is linked to this repo. The URL returns 200.
  • Rename test to reflect that it now also runs the tag checks: kept so that job IDs and names stay stable (CI naming rules, no check churn). The job comment documents the contract.
  • Order of the listed checks in the docs (signed, on dev, version) differs from the order in the script: no behavioural effect.
  • Require "Prevent self-review" and no admin bypass in the docs: this is a policy decision for the maintainer, listed above as an option. The docs of the pypi environment don't prescribe it either.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Gate library chart publication on successful validation and maintainer approval through a protected GitHub Actions environment.

New Features:

  • Require maintainer approval in the chart-release environment before publishing library chart releases.

Enhancements:

  • Run tag, version, and chart validation before the approval gate while preserving existing job IDs and checks.
  • Expose the validated chart version to the publishing job and retain the unpublished-version check immediately before publication.

Deployment:

  • Configure the chart publishing job to use the protected chart-release environment and link it to the published package.

Documentation:

  • Document the approval workflow, re-approval requirement for publishing reruns, and required environment setup.

uniqueg and others added 3 commits October 26, 2026 16:55
Run the job that pushes, attests and signs foca-common in the protected
environment `chart-release`, after the chart tests and the kind
installation, so that a maintainer approves a tested chart before
anything irreversible is published. Document the approval and the
environment's settings in the chart's release docs and the contributing
guide.

Closes #449

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move the tag and version checks into the test job, so that the
maintainer approves a run whose tag is already known to be signed, on
dev and matching the chart's version. The check that the version is
not published yet stays right before the push. Note in the docs that a
re-run of the publishing job needs a new approval.

Refs #449

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg added this to the v0.18.0 milestone Oct 26, 2026
@sourcery-ai

sourcery-ai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR gates foca-common chart publication behind maintainer approval by moving all tag and chart validation into the existing test job, passing its validated version to the protected publish job, and documenting the required chart-release environment and rerun behavior.

Flow diagram for the approved chart release

flowchart LR
    Tag["chart-vX.Y.Z tag"] --> Test[test job]
    Test --> Checks["Tag and chart checks"]
    Checks --> Version["Validated version output"]
    Version --> Publish[publish job]
    Publish --> Approval["chart-release environment approval"]
    Approval --> Unpublished["Version not published"]
    Unpublished --> Package["Package, push, attest, and sign"]
Loading

File-Level Changes

Change Details Files
Move chart release validation ahead of a protected publishing gate while preserving existing workflow job identities.
  • Run tag signature, branch, and chart-version validation in the test job.
  • Expose the validated chart version as a test-job output.
  • Keep chart linting, testing, and installation before approval.
  • Retain the publish job ID and name so required checks remain stable.
.github/workflows/release-chart.yml
Require maintainer approval before any chart publication or supply-chain operations.
  • Attach publishing to the chart-release environment restricted to chart-v* tags.
  • Run the unpublished-version check immediately before package push after approval.
  • Use the validated version from test outputs for publication.
  • Configure the package page as the environment deployment URL.
.github/workflows/release-chart.yml
Document the approval workflow and required repository environment configuration.
  • Describe the test-then-approval-then-publish order.
  • Document that re-running publishing requires renewed approval.
  • Require chart-release to exist before the first matching tag workflow run.
  • Mention approval in the contributor release guidance.
docs/helm-chart.md
docs/contributing.md

Assessment against linked issues

Issue Objective Addressed Explanation
#449 Run chart tag and version checks, chart tests, and kind installation before requiring approval; gate publishing, attestation, and signing behind the protected chart-release environment. ✅
#449 Configure the chart-release environment with a required reviewer and a deployment rule limited to chart-v* tags before the workflow first runs. ❌ The PR documents the required environment settings and references the environment in the workflow, but does not establish that the repository environment and its protection rules are configured. The PR says this was not verified and leaves setup to a maintainer.
#449 Document the approval step in the chart release instructions and contributor release steps. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4e2e1b0) to head (cf38153).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #520   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           55        55           
  Lines         6611      6611           
=========================================
  Hits          6611      6611           
Flag Coverage Δ
test_unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review October 26, 2026 16:50

@sourcery-ai sourcery-ai Bot 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/release-chart.yml" line_range="109-110" />
<code_context>
+    needs: test
+    runs-on: ubuntu-latest
+    timeout-minutes: 15
+    environment:
+      name: chart-release
+      url: https://github.com/elixir-cloud-aai/foca/pkgs/container/charts%2Ffoca-common
+    permissions:
</code_context>
<issue_to_address>
**Chart publishes without approval**

When the chart-release environment is absent or lacks a required reviewer or chart-tag restriction when a chart tag triggers the workflow, the `publish` job proceeds without verifying environment protections; GitHub creates a missing environment without protection rules, so the chart is published, attested, and signed without maintainer approval.

Provision the `chart-release` environment with a required reviewer and a `chart-v*` tag restriction before chart tags trigger the workflow.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: .github/workflows/release-chart.yml:110


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/release-chart.yml Resolved
@uniqueg
uniqueg merged commit ff98df9 into dev Oct 26, 2026
30 checks passed
@uniqueg
uniqueg deleted the ci/approve-chart-releases branch October 26, 2026 19:36
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.

ci: approve library chart releases

1 participant