Skip to content
Draft
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
134 changes: 134 additions & 0 deletions .github/workflows/hermes-01x-image-verify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Build the Hermes image for OpenShell 0.1.x from agents/hermes-01x on native
# amd64 and arm64 runners without publishing it (derekhsu/NemoClaw#98).
# hermes-01x-image.yaml builds and publishes the same Dockerfiles.
#
# The job has a read-only token, no registry login, and no secrets, so it
# cannot push an image. The base image is exported to an OCI layout, checked,
# and passed to the final build as a named build context. This is the same
# method as the Hermes PR build in managed-images.yaml.

name: Images / Hermes OpenShell 0.1.x Verify

on:
pull_request:
branches:
- feat/image-only-cli
paths:
- agents/hermes-01x/**
- "!agents/hermes-01x/Dockerfile.tools"
- src/lib/sandbox-base-image/**
- scripts/security/**
- scripts/checks/resolve-hermes-pr-source-base.sh
- scripts/check-production-build-args.sh
- scripts/check-image-layer-count.sh
- .github/workflows/hermes-01x-image-verify.yaml
workflow_dispatch:

permissions:
contents: read

concurrency:
group: hermes-01x-image-verify-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
verify:
name: Verify ${{ matrix.arch }}
if: github.repository == 'derekhsu/NemoClaw'
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# The two OCI layouts and the BuildKit cache need more space than the
# runner has free by default.
- name: Free runner disk
run: |
set -euo pipefail
df -h /
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL /usr/local/share/boost
docker system prune -af >/dev/null
df -h /

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0

- name: Guard production build args
run: |
set -euo pipefail
scripts/check-production-build-args.sh -f agents/hermes-01x/Dockerfile.base
scripts/check-production-build-args.sh -f agents/hermes-01x/Dockerfile --build-arg "BASE_IMAGE=nemoclaw-hermes-pr-base"

- name: Build base image without publishing
id: base_build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: agents/hermes-01x/Dockerfile.base
platforms: linux/${{ matrix.arch }}
outputs: type=oci,dest=${{ runner.temp }}/hermes-01x-base,tar=false
push: false
provenance: false
sbom: false
cache-from: type=gha,scope=hermes-01x-verify-base-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=hermes-01x-verify-base-${{ matrix.arch }}

# Writes ref=nemoclaw-hermes-pr-base and the oci-layout build context.
- name: Resolve base image
id: base
env:
DIGEST: ${{ steps.base_build.outputs.digest }}
PLATFORM: linux/${{ matrix.arch }}
run: bash scripts/checks/resolve-hermes-pr-source-base.sh "$RUNNER_TEMP/hermes-01x-base" "$DIGEST" "$PLATFORM"

# BASE_IMAGE replaces the Dockerfile's default, a published base image.
- name: Build final image without publishing
id: final_build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: agents/hermes-01x/Dockerfile
platforms: linux/${{ matrix.arch }}
build-contexts: ${{ steps.base.outputs.context }}
build-args: |
BASE_IMAGE=${{ steps.base.outputs.ref }}
outputs: type=oci,dest=${{ runner.temp }}/hermes-01x-final,tar=false
push: false
provenance: false
sbom: false
cache-from: type=gha,scope=hermes-01x-verify-final-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=hermes-01x-verify-final-${{ matrix.arch }}

# Same limit as scripts/check-image-layer-count.sh, which reads a
# registry; Docker's overlay2 storage driver refuses more than 125 (#70).
- name: Check final image layer count
env:
DIGEST: ${{ steps.final_build.outputs.digest }}
ARCH: ${{ matrix.arch }}
run: |
set -euo pipefail
layout="$RUNNER_TEMP/hermes-01x-final"
limit="$(sed -n 's/^MAX_LAYERS=//p' scripts/check-image-layer-count.sh)"
[[ "$limit" =~ ^[0-9]+$ ]] || { echo "ERROR: cannot read MAX_LAYERS" >&2; exit 1; }
[[ "$DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]] || { echo "ERROR: invalid final image digest: $DIGEST" >&2; exit 1; }
listed="$(jq -er '.manifests | if length == 1 then .[0].digest else error("not one manifest") end' "$layout/index.json")"
[[ "$listed" == "$DIGEST" ]] || { echo "ERROR: final image layout does not hold $DIGEST" >&2; exit 1; }
count="$(jq -er '.layers | length' "$layout/blobs/sha256/${DIGEST#sha256:}")"
echo "linux/${ARCH}: $count layers (limit $limit)"
if [ "$count" -gt "$limit" ]; then
echo "ERROR: final image has $count layers; the limit is $limit (Docker refuses more than 125)" >&2
exit 1
fi
9 changes: 9 additions & 0 deletions agents/hermes-01x/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ model.
image has more than 115 layers. Docker's overlay2 storage driver refuses an
image with more than 125 layers; Podman has no such limit (#70). To add a
build step, extend an existing `RUN` instruction.
- Build without publishing: `.github/workflows/hermes-01x-image-verify.yaml`
(#98) builds `Dockerfile.base` and `Dockerfile` on amd64 and arm64 for pull
requests to `feat/image-only-cli` that change this directory (except
`Dockerfile.tools`), the security package inventory, or the scripts the
workflow runs, and on manual runs. It exports the base image to an OCI
layout and passes it to the final build as a build context, so the final
build does not pull the base image from a registry. It has a read-only token, no registry login, and no
secrets, so it cannot push an image. It applies the same 115-layer limit to
the final image.
- Tools image (#74): `Dockerfile.tools` adds the document, PDF/OCR, media,
browser, and workspace tools of the OpenClaw tools image to a published
image pinned by `BASE_IMAGE`. It is verified by
Expand Down
4 changes: 4 additions & 0 deletions test/helpers/vitest-watch-triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ export const vitestWatchTriggerPatterns: VitestWatchTriggerPattern[] = [
pattern: /(?:^|\/)\.github\/workflows\/code-scanning\.yaml$/,
testsToRun: runTests("test/code-scanning-workflow.test.ts"),
},
{
pattern: /(?:^|\/)\.github\/workflows\/hermes-01x-image-verify\.yaml$/,
testsToRun: runTests("test/hermes-01x-image-verify-workflow.test.ts"),
},
{
pattern: /(?:^|\/)\.github\/workflows\/pr-merge-conflict-fixer\.yaml$/,
testsToRun: runTests("test/pr-merge-conflict-fixer-workflow-boundary.test.ts"),
Expand Down
Loading
Loading