Skip to content

ci(dependabot): released merged Dependabot updates through a gated release - #4

Open
karlspace wants to merge 3 commits into
mainfrom
ci/dependabot-release-dispatch
Open

karlspace wants to merge 3 commits into
mainfrom
ci/dependabot-release-dispatch

Conversation

@karlspace

Copy link
Copy Markdown
Contributor

Why

The Dependabot auto-merge merges with the GITHUB_TOKEN, which starts no push workflow - a merged update was never released until the next human push. docker-maintenance-dependabot.yml can now dispatch the release itself (release-workflow, automation-templates #132). This PR wires that up and makes the release workflow safe to be dispatched: no broken images, no broken releases.

Changes

ci(release) - .github/workflows/docker-release.yml

  • The image build (no push) now runs on every event (docker-build-validate, formerly the PR-only docker-build-pr). The release job needs: it plus both validations and requires their success - a failed build skips the release and the image push. Before, the first image build on main happened only after semantic-release had already tagged.
  • modules-semantic-release.yml is called with ref: ${{ github.sha }}: the run releases exactly the commit it validated and built.
  • The image push (docker-build-release) stays gated on release-created == 'true'.
  • workflow_dispatch (no required inputs) already existed; the release job already ran on it; no concurrency:; registry secrets are org Actions secrets.

ci(dependabot) - .github/workflows/docker-maintenance.yml

  • release-workflow: .github/workflows/docker-release.yml
  • permissions: actions: write (dispatch, read the run), plus checks: read / statuses: read as documented by the module. required-workflows and the unfiltered trigger unchanged.

ci(dependabot) - .github/dependabot.yml

  • docker: dropped include: "scope" - with prefix: "fix(docker)" it yields fix(docker)(deps): ....
  • pip /src: new entry so Dependabot security updates use fix(deps) (they arrived as chore(deps) and released nothing, see chore(deps): bump flask from 3.1.2 to 3.1.3 in /src #1). Version updates stay off (open-pull-requests-limit: 0); raise it to also get weekly pip version PRs.
  • github-actions keeps chore(ci).

Proof

  • PR CI on this PR (see checks).
  • Branch dispatch of docker-release.yml on this branch: validation + image build ran and passed, semantic-release ran and released nothing (it only releases from main), the image push job was skipped. Run link in the comments below.

The release run tagged a version before anything had built the image on
main: the only pre-release gates were compose and shell validation, and
the image was built for the first time after semantic-release had
published. A build error then left a version tag and GitHub release
without an image. The release was also not pinned, so a push landing
during the run was tagged without being built or validated by it.

* The PR-only image build now runs on every event without pushing
  (docker-build-validate) and the release job needs it and requires its
  success - a failed build skips the release and the image push
* modules-semantic-release is called with ref: github.sha, so the run
  releases exactly the commit it validated and built; if main moved on,
  it releases nothing and the newer run releases both
* The image push stays gated on release-created == 'true', so a PR run,
  a branch dispatch or a run without a release publishes nothing

Prepares the workflow for being dispatched by the Dependabot auto-merge
after a merge (workflow_dispatch already existed, no required inputs).
The auto-merge merges with the GITHUB_TOKEN, and a push made with it
starts no workflow, so a merged Dependabot update was never released
until the next human push.

* release-workflow set to docker-release.yml: after a merge - and only
  then - the module dispatches it on main, waits for the run and fails
  the job if the release does not succeed
* actions: write granted for the dispatch and reading the run; checks
  and statuses read added as documented by the module, so CI results
  stay readable should the repository ever become private
* required-workflows and the unfiltered pull_request trigger unchanged
The commit prefix of a merged Dependabot update decides whether
semantic-release cuts a release and the image is rebuilt.

* docker: dropped include: "scope" - with a prefix that already has a
  scope Dependabot appends "(deps)" and produces the malformed
  "fix(docker)(deps): ..." subject
* pip (/src): added an entry so security updates of the packages
  installed into the image use fix(deps) instead of the detected
  chore(deps), which released nothing (see the flask update in #1).
  Version updates stay off (open-pull-requests-limit: 0) as before;
  security updates are not subject to the limit
* github-actions keeps chore(ci); labels and schedules unchanged

This branch has not been deployed

No deployments
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.

1 participant