Launch: public image on GHCR, GitHub's copy of each release #26

Merged
jcoffey-dev merged 1 commits from launch into main 2026-11-15 20:54:22 +00:00
9 changed files with 131 additions and 12 deletions

No files matched your search

+3 -3
View File
@@ -5,9 +5,9 @@
# linux/arm64, the .deb and .rpm packages, the Windows agent zip and SHA256SUMS, attached to a
# Release on this repo (scripts/build-release.sh builds them all).
#
# Private until launch: the Release lives only on this
# private repo, so only people with access to it can download. There is no
# announce job and no GitHub copy on purpose.
# GitHub's copy of the Release and the server image on GHCR are made from
# these same files by .github/workflows/release.yml, once this Release is
# out.
#
# The tag must be annotated and on main, named vX.Y.Z or vX.Y.Z-rc.N; its
# annotation is the release notes. A release candidate is a pre-release. The
+107
View File
@@ -0,0 +1,107 @@
# SPDX-FileCopyrightText: 2026 Coffey Labs LLC
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# The public copies of a release, on GitHub. Gitea is the source of truth:
# its .gitea/workflows/release.yml builds every file and makes the Release
# there. Gitea push-mirrors the tag here, and this workflow waits for that
# Release, checks it (the minisign signature on SHA256SUMS, then every file
# against SHA256SUMS), and from the same files makes:
#
# - the GitHub Release, with the same notes and files (PR and issue
# numbers become links to Gitea, where they are), and
# - the server image, ghcr.io/coffey-labs/cairnobs:<version>, for
# linux/amd64 and arm64, with scripts/build-image.sh; a final release
# also moves :latest. The image holds the binaries that were checked.
#
# Gitea doesn't run this file: it reads .gitea/workflows. Here every job
# waits on the organization variable BUILD_ON=github, as in the other
# mirrored repositories. Run it by hand with a tag to publish one again.
#
# Every `uses:` is pinned to a full commit SHA with its release in the
# comment.
name: release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: The tag to publish again, e.g. v0.1.0
required: true
permissions:
contents: read
concurrency:
group: release-${{ inputs.tag || github.ref_name }}
cancel-in-progress: false
jobs:
publish:
if: ${{ vars.BUILD_ON == 'github' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: write
packages: write
env:
GITEA_URL: ${{ vars.GITEA_URL }}
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag || github.ref_name }}
# The release key's public half, as docs/install.md prints it.
MINISIGN_PUBLIC_KEY: RWTkUAZH2N3bJSX65If0MZANPBxw9mxjByMWuMkIuEBrUiAB1+7XZupZ
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.tag || github.ref_name }}
- name: Wait for Gitea's Release, download it and check it
run: |
set -euo pipefail
case "$TAG" in v[0-9]*) ;; *) echo "$TAG is not a release tag" >&2; exit 1;; esac
sudo apt-get -qq update >/dev/null && sudo apt-get -qq install -y --no-install-recommends minisign >/dev/null
# Gitea's release job runs make check and builds everything first;
# a draft isn't visible from here, so wait for the Release itself.
api="$GITEA_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/tags/$TAG"
code=0
for _ in $(seq 1 90); do
code="$(curl -sS -o rel.json -w '%{http_code}' "$api" || true)"
[ "$code" = 200 ] && [ "$(jq -r .draft rel.json)" = false ] && break
sleep 20
done
[ "$code" = 200 ] || { echo "no Release for $TAG on Gitea after 30 minutes" >&2; exit 1; }
mkdir dist
while IFS=$'\t' read -r name url; do
curl -fsSL --retry 3 -o "dist/$name" "$url"
done < <(jq -r '.assets[] | [.name, .browser_download_url] | @tsv' rel.json)
[ -s dist/SHA256SUMS.minisig ] || { echo "$TAG's SHA256SUMS isn't signed" >&2; exit 1; }
minisign -Vm dist/SHA256SUMS -P "$MINISIGN_PUBLIC_KEY"
(cd dist && sha256sum --strict -c SHA256SUMS)
[ "$(ls dist | wc -l)" = "$(( $(wc -l < dist/SHA256SUMS) + 2 ))" ] \
|| { echo "dist has files SHA256SUMS doesn't list" >&2; ls dist >&2; exit 1; }
- name: GitHub Release
run: |
set -euo pipefail
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "GitHub already has a Release for $TAG"; exit 0
fi
export BASE="$(jq -r '.html_url | sub("/releases/tag/.*$"; "")' rel.json)"
jq -r '.body // ""' rel.json | perl -pe 's{(?<![\w/&\[])#(\d+)\b}{[#$1]($ENV{BASE}/pulls/$1)}g' > notes.md
printf '\n\n_A copy of [the release on Gitea](%s), where the code lives; report issues [there](%s/issues)._\n' \
"$(jq -r .html_url rel.json)" "$BASE" >> notes.md
if [ "$(jq -r .prerelease rel.json)" = true ]; then kind=--prerelease; else kind=--latest; fi
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --verify-tag --title "$(jq -r '.name // env.TAG' rel.json)" \
--notes-file notes.md "$kind" dist/*
- uses: docker/setup-buildx-action@594f3bf4285d9ea8dc53c9a0c9c4092420091003 # v4.4.0
- name: The image on GHCR
run: |
set -euo pipefail
image="ghcr.io/${GITHUB_REPOSITORY,,}"
version="${TAG#v}"
echo "$GH_TOKEN" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
scripts/build-image.sh "$TAG" dist "$image"
if [[ "$TAG" != *-* ]]; then
docker buildx imagetools create --tag "$image:latest" "$image:$version"
fi
docker buildx imagetools inspect "$image:$version"
docker logout ghcr.io
+1 -1
View File
@@ -5,7 +5,7 @@ services, with maps, metrics, alerts and reports. `obs-beacon-agent` runs
on each host and reports to `obs-beacond`, which judges the reports,
runs the alerts and serves the web interface. Licensed AGPLv3; the
third-party code inside the binaries and its licenses are in
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). **Private until launch.**
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
The documentation for people installing it is at
<https://docs.cairnobs.org/>. To report a security problem, see
+2
View File
@@ -26,6 +26,8 @@ LABEL org.opencontainers.image.title="Cairn OBS server (obs-beacond)" \
org.opencontainers.image.vendor="Coffey Labs LLC" \
org.opencontainers.image.licenses="AGPL-3.0-or-later" \
org.opencontainers.image.version="$VERSION" \
org.opencontainers.image.source="https://git.coffeylabs.org/coffey-labs/cairnobs" \
org.opencontainers.image.documentation="https://docs.cairnobs.org/" \
io.k8s.display-name="Cairn OBS server" \
io.k8s.description="Watches hosts, containers, services, VMs and clusters; serves the web interface. Also the cluster agent (obs-beacon-agent cluster)." \
io.openshift.tags="monitoring,cairnobs"
+1 -1
View File
@@ -19,5 +19,5 @@ configMapGenerator:
- obs-beacond.yaml
images:
- name: obs-beacond
newName: registry.example.org/ops/obs-beacond # where scripts/build-image.sh pushed it
newName: ghcr.io/coffey-labs/cairnobs # or your own registry's copy (docs/kubernetes.md, The image)
newTag: 0.1.0
+1 -1
View File
@@ -15,4 +15,4 @@ join:
# packages_url: https://downloads.example.org/cairnobs/v0.1.0
# Where clusters pull this image from, for Configure, Clusters (it
# carries the cluster agent too). Without a tag, this version's.
# image: registry.example.org/ops/obs-beacond
# image: ghcr.io/coffey-labs/cairnobs
+3 -3
View File
@@ -1,6 +1,6 @@
# The server in one container (Docker or Podman)
The `obs-beacond` image (kubernetes.md, Build the image) also runs on its
The `obs-beacond` image (kubernetes.md, The image) also runs on its
own, with Docker or Podman, on any Linux host. That's one copy on SQLite in
a volume: the simplest install after the packages. For several copies and
no gap during upgrades, run it on PostgreSQL instead (kubernetes.md, More
@@ -45,7 +45,7 @@ docker run -d --name obs-beacond --restart unless-stopped \
-v /etc/obs-beacon/obs-beacond.yaml:/etc/obs-beacon/obs-beacond.yaml:ro \
-v /etc/obs-beacon/state.key:/etc/obs-beacon/key/state.key:ro \
--read-only --tmpfs /tmp --cap-drop ALL --security-opt no-new-privileges \
registry.example.org/ops/obs-beacond:0.1.0
ghcr.io/coffey-labs/cairnobs:0.1.0
docker logs obs-beacond 2>&1 | grep -A2 'first admin'
```
@@ -63,7 +63,7 @@ doesn't carry agent packages, so set `join.packages_url`.
## Upgrade
```sh
docker pull registry.example.org/ops/obs-beacond:0.2.0 # or load it
docker pull ghcr.io/coffey-labs/cairnobs:0.2.0
docker stop -t 30 obs-beacond && docker rm obs-beacond
docker run -d --name obs-beacond ...the same line, the new tag...
```
+11 -2
View File
@@ -15,9 +15,18 @@ its volume (formats.md, State). On PostgreSQL several copies can share
the one database, and only one of them sends alerts: the `-ha` overlays
(More than one copy, below).
## Build the image
## The image
From a release's binaries:
Each release's image is on GitHub's registry, for linux/amd64 and arm64:
`ghcr.io/coffey-labs/cairnobs:0.1.0` (and `:latest`, the newest final
release). To copy it into your own registry, OpenShift's internal one
included:
```sh
skopeo copy --all docker://ghcr.io/coffey-labs/cairnobs:0.1.0 docker://registry.example.org/ops/obs-beacond:0.1.0
```
Or build it yourself from a release's binaries:
```sh
scripts/build-release.sh v0.1.0 dist # or download a release into dist/
+2 -1
View File
@@ -9,7 +9,8 @@
# With IMAGE (e.g. registry.example.org/ops/obs-beacond) it pushes
# IMAGE:VERSION. Needs docker buildx.
#
# Private until launch: push only to private registries.
# Each release's image is published as ghcr.io/coffey-labs/cairnobs by
# .github/workflows/release.yml; this script is how it's built.
set -euo pipefail
TAG="${1:?usage: build-image.sh TAG DIST [IMAGE]}"
DIST="${2:?usage: build-image.sh TAG DIST [IMAGE]}"