Castis-only release tools
Castis-only tooling. Left out of releases (.releaseignore).
publish-release.sh: release the product to partners¶
Turns a commit of this repo into a versioned release in edge-release: the
product partners run. A partner config repo uses a release as its product/
submodule, pinned to a tag (see gitops/render.sh for how its values are layered):
ibc-iac stable ──► copy, leave out .releaseignore paths, refuse private keys
──► commit to edge-release, tag v1.4.0
tools/publish-release.sh v1.4.0 # release the stable branch
tools/publish-release.sh v1.4.0 --push # ...and push to GitLab
Which repo it publishes to¶
The script works on a local checkout of edge-release (--target, default
../edge-release, next to this repo) and pushes to that checkout's origin.
Which GitLab repo that is comes from --repo (or EDGE_RELEASE_REPO), default
https://mashup.castis.io/playtelly/edge-release.git:
| Situation | What the script does |
|---|---|
| No local checkout yet, GitLab repo reachable | Clones it into --target |
| No local checkout yet, GitLab repo not reachable (not created yet) | Creates a local repo with that origin; --push refuses until it exists |
Local checkout exists, origin = --repo |
Uses it |
Local checkout exists, origin is something else |
Refuses, so a release can't be pushed to the wrong repo |
--repo none |
Local only, no origin (previews) |
tools/publish-release.sh v1.4.0 --push # default repo
EDGE_RELEASE_REPO=git@mashup.castis.io:playtelly/edge-release.git tools/publish-release.sh v1.4.0 --push
Safety checks¶
- Private keys: refuses PEM keys (plain or base64) and raw base64 keys
written as
...PRIVATE_KEY=<value>/...PRIVATE_KEY: <value>.--redactreplaces base64 PEM keys with a placeholder for previews only; anything else must be removed from ibc-iac or listed in.releaseignore. - Versions are never reused, and a release always comes from a commit
(
--ref) unless--working-treeis given for a preview.
Rules:
- Release from stable only: what partners get has already run on Castis hotels.
- Versions are never reused. The script refuses an existing tag.
- No private keys. The script refuses to publish one. Fix ibc-iac instead.
- Never edit edge-release by hand. Change ibc-iac and publish again.
Version numbers (vMAJOR.MINOR.PATCH):
| Change | Bump | Example |
|---|---|---|
| Bug fix, new image tags only | PATCH | v1.4.0 → v1.4.1 |
| New feature or setting, old config still works | MINOR | v1.4.1 → v1.5.0 |
| Partners must change their config (renamed setting, ...) | MAJOR | v1.5.0 → v2.0.0, with upgrade notes |
Later: run it from CI¶
Once edge-release exists in GitLab, a job in this repo's .gitlab-ci.yml can
publish on every change to stable. Sketch:
publish-release:
stage: release
rules:
- if: $CI_COMMIT_BRANCH == "stable"
when: manual # a person picks the version number
variables:
VERSION: "" # set when running the job, e.g. v1.4.0
script:
- git clone "https://ci:${RELEASE_PUSH_TOKEN}@mashup.castis.io/playtelly/edge-release.git" ../edge-release
- tools/publish-release.sh "$VERSION" --ref "$CI_COMMIT_SHA" --push
--repo "https://ci:${RELEASE_PUSH_TOKEN}@mashup.castis.io/playtelly/edge-release.git"
RELEASE_PUSH_TOKEN is a project access token with write access to
edge-release only, stored as a masked CI variable.