ci: write the image tag of a develop build into a deployment repository #29

Merged
crapougnax merged 1 commit from ci/28-deploy-develop-tag into develop 2026-11-17 10:09:15 +00:00
Member

Closes #28

What

  • .forgejo/scripts/deploy-tag.sh: clones a deployment repository, sets newTag of the image in one kustomization file, commits and pushes; does nothing when the tag is already there; retries when someone pushed in between.
  • Last step of the image workflow, for pushes to develop only, after the image is pushed.

Settings (Actions of this repository)

Name Kind Value
DEPLOY_REPOSITORY variable owner/name of the deployment repository on the same forge. The step is skipped when it is not set.
DEPLOY_KUSTOMIZATION variable Path of the kustomization file in that repository
DEPLOY_BRANCH variable Branch to write to (default develop)
DEPLOY_TOKEN secret Token allowed to push to that repository

Nothing about a deployment is written in this repository.

Security

  • The token reaches git through a credential helper: it is not in a URL, in the cloned configuration nor in the output.
  • The step runs for pushes to develop only, never for a pull request: a pull request cannot make it run with the token.
  • The tag and the path are checked before use (plain characters, path inside the repository). The script rewrites one line of one file and fails unless it finds exactly one newTag for the image.
  • Give the token the narrowest right the forge allows: write access to the deployment repository only.

Verified

  • The script was run with dash against a local copy of a deployment repository: new tag (one line changed, one commit), same tag again (nothing pushed), unknown image, unsafe tag, path outside the repository, missing file (all refused), and a run with a token whose value never appears in the output.

Not verified

  • The step has not run in the pipeline: it is skipped until the variables exist, and I cannot set variables nor secrets.
  • The push uses the forge with a token as password; this was only exercised against a local repository.

🤖 Generated with Claude Code

Closes #28 ## What - `.forgejo/scripts/deploy-tag.sh`: clones a deployment repository, sets `newTag` of the image in one kustomization file, commits and pushes; does nothing when the tag is already there; retries when someone pushed in between. - Last step of the image workflow, for pushes to `develop` only, after the image is pushed. ## Settings (Actions of this repository) | Name | Kind | Value | | :--- | :--- | :--- | | `DEPLOY_REPOSITORY` | variable | `owner/name` of the deployment repository on the same forge. The step is skipped when it is not set. | | `DEPLOY_KUSTOMIZATION` | variable | Path of the kustomization file in that repository | | `DEPLOY_BRANCH` | variable | Branch to write to (default `develop`) | | `DEPLOY_TOKEN` | secret | Token allowed to push to that repository | Nothing about a deployment is written in this repository. ## Security - The token reaches git through a credential helper: it is not in a URL, in the cloned configuration nor in the output. - The step runs for pushes to `develop` only, never for a pull request: a pull request cannot make it run with the token. - The tag and the path are checked before use (plain characters, path inside the repository). The script rewrites one line of one file and fails unless it finds exactly one `newTag` for the image. - Give the token the narrowest right the forge allows: write access to the deployment repository only. ## Verified - The script was run with `dash` against a local copy of a deployment repository: new tag (one line changed, one commit), same tag again (nothing pushed), unknown image, unsafe tag, path outside the repository, missing file (all refused), and a run with a token whose value never appears in the output. ## Not verified - The step has not run in the pipeline: it is skipped until the variables exist, and I cannot set variables nor secrets. - The push uses the forge with a token as password; this was only exercised against a local repository. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ci: write the image tag of a develop build into a deployment repository (#28)
All checks were successful
Build and Publish OCI Image / Build & Push ARM64 OCI Image (pull_request) Successful in 3m56s
a6bc3941a9
Optional last step of the image workflow, for pushes to develop: it sets the tag
sha-<commit> in the kustomization file of a deployment repository and pushes, so
that a GitOps controller deploys the build. Skipped unless the variable
DEPLOY_REPOSITORY is set; nothing about the deployment lives in this repository.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
crapougnax merged commit f3045337d6 into develop 2026-11-17 10:09:15 +00:00
crapougnax deleted branch ci/28-deploy-develop-tag 2026-11-17 10:09:15 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
modaka/studio!29
No description provided.