Skip to content

Commit 3a43bbe

Browse files
Move deployment docs into CONTRIBUTOR.md
Fold the manual-deployment runbook into CONTRIBUTOR.md ("Deploying a release") and drop scripts/README.md so the contributor guide is the single home for it. Repoint the references in deploy.sh and release.yml.
1 parent 3ef76aa commit 3a43bbe

4 files changed

Lines changed: 88 additions & 87 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
fetch-depth: 0
4242

4343
# The build-and-publish logic lives in scripts/deploy.sh so CI and manual
44-
# deployments stay in sync (single source of truth). See scripts/README.md.
44+
# deployments stay in sync (single source of truth). See CONTRIBUTOR.md.
4545
- name: 'Build and publish komet-node to both Nix caches'
4646
shell: bash
4747
env:
@@ -75,7 +75,7 @@ jobs:
7575
fetch-depth: 0
7676

7777
# Build, smoke-test, and push logic lives in scripts/deploy.sh so CI and
78-
# manual deployments stay in sync (single source of truth). See scripts/README.md.
78+
# manual deployments stay in sync (single source of truth). See CONTRIBUTOR.md.
7979
- name: 'Build, test, and push Docker image to Docker Hub'
8080
env:
8181
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}

CONTRIBUTOR.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,88 @@ your GitHub account.
5656
> Never place an SSH key registered as an **Authentication key** in the container.
5757
> An authentication key grants full account-wide git access and would bypass the
5858
> minimal permissions of your fine-grained PAT. Use a **signing-only** key here.
59+
60+
## Deploying a release
61+
62+
`scripts/deploy.sh` builds and publishes the komet-node release artifacts. It is
63+
the single source of truth for the deployment steps: the `Release` workflow
64+
(`.github/workflows/release.yml`) invokes its subcommands, and you run the same
65+
subcommands by hand when CI is unavailable.
66+
67+
### What it does
68+
69+
The script has three subcommands:
70+
71+
| Subcommand | Action |
72+
| ----------- | ------ |
73+
| `nix-cache` | Builds `.#komet-node`, pushes the full build closure to the `k-framework` Cachix cache, publishes the kup-installable binary to the `k-framework-binary` cache, then verifies the push and pin. Both caches are public; `binary` is a historical name, not an access level. |
74+
| `docker` | Builds the runtime image from `Dockerfile`, runs `komet-node --help` in it as a smoke test, then pushes it to Docker Hub. |
75+
| `all` | Runs `nix-cache` then `docker`. |
76+
77+
The image tag is `runtimeverificationinc/komet-node:ubuntu-jammy-<version>`,
78+
where `<version>` comes from `package/version`.
79+
80+
### Prerequisites
81+
82+
Both subcommands run from a checkout of the revision you are releasing, with the
83+
following tools on `PATH`:
84+
85+
- `nix-cache` needs `nix` and `cachix`. It fetches `kup` from
86+
`github:runtimeverification/kup` itself, so you do not install kup separately.
87+
- `docker` needs `docker`.
88+
89+
Each subcommand checks its tools up front and exits with a clear message if one
90+
is missing, before starting the build.
91+
92+
The devcontainer provides all of these: `nix` and `cachix` are installed into the
93+
Nix profile, and the docker-in-docker feature supplies `docker`. If you added
94+
these to an existing container, rebuild it ("Dev Containers: Rebuild Container")
95+
so the new tools are present.
96+
97+
Provide the secrets as environment variables. Everything else has a default (see
98+
the `Shared configuration` block in `deploy.sh`), so a normal checkout needs no
99+
further setup.
100+
101+
| Subcommand | Required environment variables |
102+
| ----------- | ------------------------------ |
103+
| `nix-cache` | `CACHIX_PUBLIC_TOKEN`, `CACHIX_PRIVATE_KFB_TOKEN` |
104+
| `docker` | `DOCKERHUB_PASSWORD` |
105+
106+
`OWNER_REPO` and `REV` default to the current checkout's `origin` remote and
107+
`HEAD`. Override them if you are publishing a revision other than the one checked
108+
out. `DOCKERHUB_USERNAME`, `DOCKERHUB_NAMESPACE`, and `DOCKERHUB_REPO` default to
109+
the release account and repository; override them only to publish elsewhere.
110+
111+
Both subcommands refuse to run if the working tree is not clean. CI builds from a
112+
fresh checkout, so a manual build must too: uncommitted changes and untracked
113+
files would otherwise be baked into the published image or flake build without
114+
matching the `REV` they are published under. Commit, stash, or clean the tree
115+
first. `git status --porcelain` ignores `.gitignore`d paths, so runtime artifacts
116+
and dev caches do not count. Set `ALLOW_DIRTY=1` to override the check when you
117+
deliberately want to publish an uncommitted state.
118+
119+
### Manual release while CI is down
120+
121+
The workflow also drafts, cleans up, and finalizes the GitHub release around the
122+
deployment jobs. When you deploy by hand, run those `gh` steps yourself in this
123+
order. `nix-cache` runs once per architecture (the workflow uses an `x86_64` and
124+
an `ARM64` runner), so run it on a machine of each architecture that should be
125+
cached.
126+
127+
```sh
128+
VERSION=v$(cat package/version)
129+
130+
# 1. Draft the release.
131+
gh release create "$VERSION" --draft --title "$VERSION" --target "$(git rev-parse HEAD)"
132+
133+
# 2. Deploy. Export the secrets first (see the table above).
134+
# Run nix-cache once per architecture; docker once.
135+
./scripts/deploy.sh nix-cache
136+
./scripts/deploy.sh docker
137+
138+
# 3. Finalize the release once every deployment has succeeded.
139+
gh release edit "$VERSION" --draft=false
140+
141+
# If a deployment fails, remove the draft instead:
142+
# gh release delete "$VERSION" --yes --cleanup-tag
143+
```

scripts/README.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

scripts/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -euo pipefail
1010
# This is the single source of truth for the deployment steps that the Release
1111
# workflow (.github/workflows/release.yml) performs. The workflow calls the
1212
# subcommands below, and you can run the exact same steps by hand when CI is
13-
# unavailable. See scripts/README.md for the full manual-deployment runbook.
13+
# unavailable. See CONTRIBUTOR.md ("Deploying a release") for the runbook.
1414
#
1515
# Subcommands:
1616
# nix-cache Build komet-node and push it to both Nix caches (the

0 commit comments

Comments
 (0)