Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/release-captain/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ git worktree remove --force "$wt"
| Transient infrastructure failure in a pre-release, including a registry push | After approval, `gh run rerun <run-id> --failed`. `Release` won't select the run until all of it passes. |
| Pre-release run ends in `startup_failure` | The workflow file is invalid at that commit. Fix it in a new `-pre.N` (Monday step 3). |
| Code defect or `Cargo Deny` advisory | Rerunning won't help. Fix it in a new `-pre.N` (Monday step 3). |
| `Release` fails after selection | After approval, rerun only the failed jobs that haven't published. If the run's artifacts expired or its jobs were skipped, dispatch `Release` again with `-f tag=vX.Y.Z`; it publishes only what is missing. |
| `Release` fails after selection | After approval, rerun only the failed jobs that haven't published. If the run's artifacts expired or its jobs were skipped, dispatch `Release` again with `-f tag=vX.Y.Z`; it publishes only what is missing. `sign-oci-artifacts` signs only what its own run built: if it fails on a kept image or chart, rerun the failed jobs of the run that published it, or release the next patch version. Never rerun all jobs (`gh run rerun <run-id>` without `--failed`) once anything is published: the rebuild cannot sign what is published. |

## Related

Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@

# Auditable SBOM check
/tasks/scripts/verify-image-sbom.sh @ai-openshell/maintainers

# OCI artifact signing
/tasks/scripts/sign-oci-artifacts.sh @ai-openshell/maintainers
25 changes: 22 additions & 3 deletions .github/actions/release-helm-oci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,20 @@ inputs:
required: false
default: ""

outputs:
pushed:
description: The <repository>@<digest> of each chart this run pushed, space-separated.
value: ${{ steps.pushed.outputs.pushed }}

runs:
using: composite
steps:
# Pinned: the pushed digests are read from the stdout of helm push, and
# Helm before 4.3 prints them on stderr.
- name: Install Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
with:
version: v4.3.2

# Needs id-token: write and the release environment on the calling job.
- name: Log in to Quay
Expand Down Expand Up @@ -90,7 +99,7 @@ runs:
echo "Charts ${CHART_VERSION} are already published; keeping them."
echo "published=true" >> "$GITHUB_OUTPUT"
elif [ "${found}" -ne 0 ]; then
echo "::error::Only one chart is published at ${CHART_VERSION}. Delete it or publish the other chart manually."
echo "::error::Only one chart is published at ${CHART_VERSION}. Delete it and re-run the failed jobs; a chart pushed by hand cannot be signed."
exit 1
fi

Expand Down Expand Up @@ -118,7 +127,7 @@ runs:
push_chart() {
local attempt
for attempt in 1 2 3 4; do
if helm push "$1" oci://quay.io/ai-openshell/charts; then
if helm push "$1" oci://quay.io/ai-openshell/charts | tee -a "${RUNNER_TEMP}/helm-push.log"; then
return 0
fi
if [ "${attempt}" -lt 4 ]; then
Expand All @@ -145,7 +154,7 @@ runs:
push_chart() {
local attempt
for attempt in 1 2 3 4; do
if helm push "$1" oci://quay.io/ai-openshell/charts; then
if helm push "$1" oci://quay.io/ai-openshell/charts | tee -a "${RUNNER_TEMP}/helm-push.log"; then
return 0
fi
if [ "${attempt}" -lt 4 ]; then
Expand All @@ -167,3 +176,13 @@ runs:
for archive in /tmp/sha-pin/*.tgz; do
push_chart "${archive}"
done

# The signature must cover what Helm pushed, so take the digests it prints
# on stdout, never a registry lookup. stderr can carry text the registry chose.
- name: Report pushed chart digests
id: pushed
if: steps.published.outputs.published != 'true'
Comment thread
SDAChess marked this conversation as resolved.
Resolved
shell: bash
run: |
echo "pushed=$(awk '/^Pushed: /{ref=$2; sub(/:[^:]*$/, "", ref)} /^Digest: /{printf "%s@%s ", ref, $2}' \
"${RUNNER_TEMP}/helm-push.log")" >> "$GITHUB_OUTPUT"
54 changes: 52 additions & 2 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ jobs:
with:
persist-credentials: false

- name: Download image archives
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: image-*
path: artifacts/
merge-multiple: true

- name: Log in to the CI registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin

Expand All @@ -270,12 +277,14 @@ jobs:
set -euo pipefail
CI_REGISTRY="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/openshell"
for component in gateway sandbox supervisor; do
echo "Promoting ${CI_REGISTRY}/${component}:${SOURCE_SHA} to quay.io/ai-openshell/${component}..."
# The SHA tag in the CI registry can be another run's build.
digest="$(tar -xOf "artifacts/images/${component}.tar" index.json | jq -er '.manifests[0].digest')"
echo "Promoting ${CI_REGISTRY}/${component}@${digest} to quay.io/ai-openshell/${component}..."
docker buildx imagetools create \
--prefer-index=false \
-t "quay.io/ai-openshell/${component}:${SOURCE_SHA}" \
-t "quay.io/ai-openshell/${component}:dev" \
"${CI_REGISTRY}/${component}:${SOURCE_SHA}"
"${CI_REGISTRY}/${component}@${digest}"
tasks/scripts/verify-image-sbom.sh "quay.io/ai-openshell/${component}:dev" --require-cargo
done

Expand Down Expand Up @@ -650,18 +659,59 @@ jobs:
permissions:
contents: read
id-token: write
outputs:
pushed: ${{ steps.charts.outputs.pushed }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: ./.github/actions/release-helm-oci
id: charts
with:
chart-version: 0.0.0-dev
app-version: dev
release-kind: dev
pin-sha: ${{ github.sha }}

sign-oci-artifacts:
name: Sign OCI Artifacts
needs: [tag-ghcr-dev, release-helm]
runs-on: ubuntu-24.04
timeout-minutes: 15
# Only jobs in this environment can trade their OIDC token for the Quay robot.
environment: release
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Download image archives
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: image-*
path: artifacts/
merge-multiple: true

- uses: sigstore/cosign-installer@881c63bd87e38389154debd8331404ce7ca8a3ab # v4.1.4

- name: Log in to Quay
uses: ai-openshell/workflows/quay-login@96e33d5551ba4e706203648eb90710c48466e543 # main
with:
robot: ai-openshell+openshell_release
clients: docker

- name: Sign and verify published artifacts
env:
RELEASE_CHANNEL: dev
IMAGE_TAG: ${{ github.sha }}
CHART_VERSIONS: 0.0.0-dev 0.0.0-dev.${{ github.sha }}
PUSHED_CHARTS: ${{ needs.release-helm.outputs.pushed }}
run: tasks/scripts/sign-oci-artifacts.sh

publish-fern-docs:
name: Sync and Publish Fern Docs
needs: [compute-versions, release-dev, release-helm]
Expand Down
52 changes: 47 additions & 5 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ jobs:
- uses: ./.github/actions/setup-nix
if: ${{ !inputs.is-prerelease }}

- name: Download stable image archives
if: ${{ !inputs.is-prerelease }}
- name: Download image archives
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: image-*
Expand Down Expand Up @@ -306,11 +305,13 @@ jobs:
fi
for component in gateway sandbox supervisor; do
if [[ "${IS_PRERELEASE}" == "true" ]]; then
echo "Promoting ${SOURCE_REGISTRY}/${component}:${SOURCE_TAG} as ${REGISTRY}/${component}:${VERSION}..."
# The SHA tag in the CI registry can be another run's build.
digest="$(tar -xOf "artifacts/images/${component}.tar" index.json | jq -er '.manifests[0].digest')"
echo "Promoting ${SOURCE_REGISTRY}/${component}@${digest} as ${REGISTRY}/${component}:${VERSION}..."
docker buildx imagetools create \
--prefer-index=false \
-t "${REGISTRY}/${component}:${VERSION}" \
"${SOURCE_REGISTRY}/${component}:${SOURCE_TAG}"
"${SOURCE_REGISTRY}/${component}@${digest}"
tasks/scripts/verify-image-sbom.sh "${REGISTRY}/${component}:${VERSION}" --require-cargo
fi
if [[ "${MAKE_LATEST}" == "true" ]]; then
Expand All @@ -332,6 +333,8 @@ jobs:
permissions:
contents: read
id-token: write
outputs:
pushed: ${{ steps.charts.outputs.pushed }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -348,14 +351,53 @@ jobs:
sparse-checkout: .github/actions/release-helm-oci

- uses: ./release-workflow/.github/actions/release-helm-oci
id: charts
with:
chart-version: ${{ inputs.semver }}
app-version: ${{ inputs.semver }}
release-kind: public

sign-oci-artifacts:
name: Sign OCI Artifacts
needs: [tag-ghcr-release, release-helm]
runs-on: ubuntu-24.04
timeout-minutes: 15
# Only jobs in this environment can trade their OIDC token for the Quay robot.
environment: release
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Download image archives
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: image-*
path: artifacts/
merge-multiple: true

- uses: sigstore/cosign-installer@881c63bd87e38389154debd8331404ce7ca8a3ab # v4.1.4

- name: Log in to Quay
uses: ai-openshell/workflows/quay-login@96e33d5551ba4e706203648eb90710c48466e543 # main
with:
robot: ai-openshell+openshell_release
clients: docker

- name: Sign and verify published artifacts
env:
RELEASE_CHANNEL: ${{ inputs.is-prerelease && 'prerelease' || 'stable' }}
IMAGE_TAG: ${{ inputs.semver }}
CHART_VERSIONS: ${{ inputs.semver }}
PUSHED_CHARTS: ${{ needs.release-helm.outputs.pushed }}
run: tasks/scripts/sign-oci-artifacts.sh

release:
name: Publish Release Assets
needs: [assemble, release-helm]
needs: [assemble, release-helm, sign-oci-artifacts]
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
Expand Down
3 changes: 3 additions & 0 deletions CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ resolve to the same qualified candidate. A retry rebuilds, then publishes only w
is missing: it keeps published Quay version tags, Helm charts, GitHub Release assets,
and npm versions. Automatic snap publishing is disabled pending migration to
the upcoming packages repository under `ai-openshell`.
`sign-oci-artifacts` signs only the images and charts its own run built. If it fails, rerun the failed
jobs of the run that published them within five days, while its image archives last, or release the next version.
Do not rerun all jobs of a run that has published an image or chart: the rebuild can never sign what is published.

Stable image builds save multi-platform OCI archives as workflow artifacts without
pushing them. Publication copies those archives, including their attestations,
Expand Down
14 changes: 14 additions & 0 deletions docs/security/verify-image-contents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,17 @@ Every SBOM lists the base-image packages. Release Dev, Release, and Pre-release
<Note>
OpenShell also publishes minimal SLSA provenance. It records how BuildKit produced the image, including its source revision, build platform, and base-image materials, without the extra build parameters included by full provenance.
</Note>

## Verify Signatures

The release workflows sign the `gateway`, `sandbox`, and `supervisor` images and the `openshell` and `openshell-workspace` Helm charts with keyless [cosign](https://docs.sigstore.dev/cosign/system_config/installation/) signatures. A signature covers a digest, so verify the digest you deploy. Use cosign 3.0.1 or later. Artifacts published before signing started carry no signature.

```shell
cosign verify quay.io/ai-openshell/gateway@sha256:<digest> \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-github-workflow-repository ai-openshell/openshell \
--certificate-identity https://github.com/ai-openshell/openshell/.github/workflows/release-publish.yml@refs/heads/main \
--certificate-github-workflow-ref refs/heads/main
```

For a chart, pass `quay.io/ai-openshell/charts/openshell@sha256:<digest>`. These flags accept stable releases and prereleases dispatched from `main`. Keep the repository flag: the identity alone names a workflow file that any repository can call. For any prerelease, replace the last two flags with `--certificate-identity-regexp '^https://github\.com/ai-openshell/openshell/\.github/workflows/release-publish\.yml@refs/(heads/main|tags/v[0-9]+\.[0-9]+\.[0-9]+-pre\.[1-9][0-9]*)$'`. For a dev build, replace them with `--certificate-identity https://github.com/ai-openshell/openshell/.github/workflows/release-dev.yml@refs/heads/main`.
61 changes: 61 additions & 0 deletions tasks/scripts/sign-oci-artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail

# Keyless-sign the images and charts this run built, then require a valid
# signature on every tag it publishes. Image digests come from the build
# archives and chart digests from helm push (PUSHED_CHARTS). A tag is verified
# and never signed, so an artifact this run did not build cannot obtain a
# signature.

REGISTRY="quay.io/ai-openshell"
WORKFLOWS="https://github.com/ai-openshell/openshell/.github/workflows"

# The certificate identity names the workflow file, and any repository can call
# the reusable release-publish.yml. Also require the repository that ran it and,
# for a stable release, the main branch.
policy=(--certificate-oidc-issuer https://token.actions.githubusercontent.com --certificate-github-workflow-repository ai-openshell/openshell)
case "${RELEASE_CHANNEL}" in
dev) policy+=(--certificate-identity "${WORKFLOWS}/release-dev.yml@refs/heads/main") ;;
stable) policy+=(--certificate-identity "${WORKFLOWS}/release-publish.yml@refs/heads/main" --certificate-github-workflow-ref refs/heads/main) ;;
# cosign matches the regexp unanchored, hence ^...$ and the escaped dots.
prerelease) policy+=(--certificate-identity-regexp '^https://github\.com/ai-openshell/openshell/\.github/workflows/release-publish\.yml@refs/(heads/main|tags/v[0-9]+\.[0-9]+\.[0-9]+-pre\.[1-9][0-9]*)$') ;;
*) echo "::error::Unknown RELEASE_CHANNEL '${RELEASE_CHANNEL}'."; exit 1 ;;
esac

# Quay can briefly return 404 for a manifest or signature it just accepted.
retry() { "$@" || { sleep 15; "$@"; } || { sleep 45; "$@"; }; }

read -ra digests <<<"${PUSHED_CHARTS}"
tags=()
for image in gateway sandbox supervisor; do
digest="$(tar -xOf "artifacts/images/${image}.tar" index.json | jq -er '.manifests[0].digest')"
digests+=("${REGISTRY}/${image}@${digest}")
tags+=("${REGISTRY}/${image}:${IMAGE_TAG}")
done
for version in ${CHART_VERSIONS}; do
tags+=("${REGISTRY}/charts/openshell:${version}" "${REGISTRY}/charts/openshell-workspace:${version}")
done

for ref in "${digests[@]}"; do
if [[ ! "${ref}" =~ ^quay\.io/ai-openshell/(gateway|sandbox|supervisor|charts/openshell(-workspace)?)@sha256:[0-9a-f]{64}$ ]]; then
echo "::error::Refusing to sign '${ref}': not a digest in a published repository."
exit 1
fi
# A kept image is another run's build, and a later dev run moves the
# 0.0.0-dev charts. This run's digest is then not in the registry and stays
# unsigned; the tag check requires the signature of the run that owns the tag.
if docker buildx imagetools inspect "${ref}" >/dev/null 2>&1; then
Comment thread
SDAChess marked this conversation as resolved.
Resolved
retry cosign sign --yes "${ref}"
fi
done

for tag in "${tags[@]}"; do
if ! retry cosign verify "${policy[@]}" "${tag}" >/dev/null; then
echo "::error::${tag} has no valid ${RELEASE_CHANNEL} signature. Re-run the failed jobs of the run that published it; another run cannot sign it."
exit 1
fi
done
Loading