Repository navigation
build!: release from version tags - #112
Conversation
Take the package version from Git tags (setuptools-scm). Signed `vX.Y.Z` tags on `main` trigger a release workflow: it builds and pushes the image as `X.Y.Z` (and `latest` for the highest release), packages the Helm chart with version and appVersion from the tag, and creates a GitHub release with the chart attached, after approval in the `release` environment. Images from `dev` are tagged `dev` and `sha-<commit>` in the `dev-images` environment; the date tags and philips-software/docker-ci-scripts are gone. The chart takes the image tag from the new value `cloud_registry.tag`, which defaults to the chart's appVersion. Closes #81 BREAKING CHANGE: Docker Hub `latest` now points to the latest release, not to the latest `dev` build; use `dev` or `sha-<commit>` for those. Date-tagged images are no longer pushed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Scope the release concurrency group per tag, so that a run waiting for approval is not cancelled by the run of another tag. - Decide `latest` in the `publish` job, after approval, from stable release tags merged into `main`, so that re-runs of older releases and stray tags do not move or freeze it. - Accept pre-release tags (`vX.Y.ZaN`, `bN`, `rcN`): GitHub pre-release, chart version `X.Y.Z-rcN`, never `latest`. - Check out the commit verified by `prepare` in `publish`. - Build and load the release image first, check that the app reports the release version, then push. - Pass the version build argument in Docker Compose, and check it in the smoke test. - Pin setuptools-scm for dev image versions in requirements_dev.txt (as a constraint), where Dependabot updates it. - README: tag requirements, pre-releases, environment-only Docker Hub secrets and the tag ruleset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Check that the installed package version and the setuptools-scm fallback version are valid PEP 440 versions. Compare the default image tag with the chart's appVersion, package charts with pre-release versions, and cover registries with a port and a tag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Build the release image once, check its version, then push exactly that image; log in to Docker Hub only after the check. - Push the version tag first; decide `latest` last, from freshly fetched tags on `main`, then push `latest` and pass the same decision to the GitHub release (also on reruns). - Accept canonical versions only (no leading zeros), also when ranking stable releases for `latest`. - Require a signature verified by GitHub (API of the tag object) instead of looking for an armored signature block. - Tests: use `packaging` for PEP 440 versions, check that SETUPTOOLS_SCM_PRETEND_VERSION is honoured and that a tag `v1.2.3` yields `1.2.3`; cover `a`/`b` pre-release chart versions. Declare `packaging` and `tomli` (Python 3.10) in requirements_dev.txt. - Chart placeholder `version: 0.0.0`; docs: verified signatures, the repository settings the workflows rely on, and no release number before the first release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewer's GuideThe PR establishes signed Git tags as the single release source, derives package, image, and Helm versions consistently, separates protected dev and release publishing workflows, and updates chart image configuration and documentation for the new lifecycle. Sequence diagram for the signed tag release workflowsequenceDiagram
participant Maintainer
participant GitHub
participant Prepare as ReleasePrepare
participant Approval as ReleaseEnvironment
participant Publish as ReleasePublish
participant DockerHub
participant GitHubRelease
Maintainer->>GitHub: git push vX.Y.Z
GitHub->>Prepare: Trigger release workflow
Prepare->>Prepare: git merge-base --is-ancestor
Prepare->>GitHub: gh api verification
Prepare->>Prepare: helm package
Prepare->>GitHub: Upload chart artifact
Prepare->>Approval: Request environment approval
Approval-->>Publish: Approve release
Publish->>Publish: docker build with SETUPTOOLS_SCM_PRETEND_VERSION
Publish->>Publish: docker run version check
Publish->>DockerHub: docker push X.Y.Z
Publish->>Publish: Determine highest stable release
opt Highest stable release
Publish->>DockerHub: docker push latest
end
Publish->>GitHubRelease: gh release create with chart
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #112 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 573 573
=========================================
Hits 573 573 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The Sphinx config read the version from pyproject.toml, which no longer has one, so the Read the Docs build failed. Derive it with setuptools-scm instead (the package is not installed for the docs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They are generated by sphinx-apidoc on each build and were committed by mistake; ignore them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. The workflow can publish an incorrectly versioned image under a release tag or latest, and the chart now defaults to the mutable dev image. Reverting the change would not remove published tags or release artifacts, nor switch deployments that already pulled the image back.
# Conflicts: # deployment/Chart.yaml # deployment/values.yaml # tests/helm.py # tests/test_chart.py
With charts released from Git tags (0.3.0 and later) and the repository chart at 0.0.0, there is no chart version 4. Refer to the charts 2.x and 3.0.0 as the legacy charts and to the new one as the current chart, in the upgrade guide, the template comments and the error messages of the removed `cloud_registry.appName` and of upgrades of legacy releases, and in the tests that match them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Releases now come from signed version tags, like FOCA's (#81), without PyPI:
versionis dynamic inpyproject.toml); builds without Git metadata fall back to0.0.0.dev0. The Docker build takes the version via the build argumentSETUPTOOLS_SCM_PRETEND_VERSION..github/workflows/release.yaml), onv*tags:vX.Y.Zor pre-releasevX.Y.Z(a|b|rc)N, annotated, signature verified by GitHub, commit onmain;X.Y.Z-rcN);releaseenvironment: builds the image once, checks that it reports the release version, pushes it asX.Y.Z, then decideslatest(highest stable release onmain, never pre-releases) and creates the GitHub release with the chart attached.devpublishdevandsha-<commit>in thedev-imagesenvironment; date tags and philips-software/docker-ci-scripts are gone.cloud_registry.tag, defaulting to the chart's appVersion; images with a tag or digest incloud_registry.imagekeep working.Chart.yamlholds placeholders (version: 0.0.0,appVersion: dev), set from the tag at release.Closes #81
Breaking change
Docker Hub
latestnow points to the latest release, not to the latestdevbuild; usedevorsha-<commit>for those. Date-tagged images are no longer pushed.Verification
Locally (Python 3.10 venv with the dev requirements, Helm 3.18.6):
ruff check .,ruff format --check .: passedmypy cloud_registry tests: no issues in 26 filesast-grep scan,ast-grep test: passedpytest(chart tests included): 258 passedhelm lint --strict(with and without MongoDB auth): passed.semgrep), gitleaks: no findingsSETUPTOOLS_SCM_PRETEND_VERSION; tag regex and chart version mapping checked for stable,a,b,rcand malformed tagsNot run locally (no Docker): image builds and the Compose smoke test (run in CI). The release job's Docker steps, the GitHub signature check and the
lateststep first run at the first release.CI: all checks passed (static code analysis; tests on Python 3.10 and 3.12; Helm chart; Docker Compose, including the new version check; Read the Docs, after fixing the docs version in db40156).
Notes
release(required reviewer, tag rulev*) anddev-images(branchdev), each with the Docker Hub secrets; then remove the repository-level Docker Hub secrets.🤖 Generated with Claude Code
Summary by Sourcery
Adopt signed Git tags as the single source for application, image, chart, and GitHub release versions.
New Features:
Enhancements:
Build:
CI:
Documentation:
Tests: