Skip to content

Robot container: publish the tested image to GHCR - #151

Open
fjp wants to merge 18 commits into
noetic-develfrom
feat/robot-image-ghcr
Open

fjp wants to merge 18 commits into
noetic-develfrom
feat/robot-image-ghcr

Conversation

@fjp

@fjp fjp commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

What and why

CI publishes the robot image that passed its smoke test to GitHub's container registry (GHCR), for arm64 and amd64, as ghcr.io/ros-mobile-robots/diffbot-robot. The robot downloads that image with docker compose up -d instead of building it. A build on the robot took 14 min 20 s on Remo's Raspberry Pi 4 B and had no fixed version (#140).

  • Tags: noetic-<commit> is published once per commit and never replaced. noetic moves only forward in git history, to a commit after the one it has. The package also lists the two images of a version, noetic-<commit>-amd64 and -arm64, and noetic-<commit>-index. An index is the list that names the image of each architecture under one tag. The script gives a new index this tag first, and the version's tag only after its check. The tag stays.
  • Compose: compose.yaml runs the published image and never builds one. ROBOT_IMAGE in .env names another version. A build of one's own has its own file, compose.build.yaml, whose service is only built, never started, under the fixed name diffbot-robot:local.
  • The two build jobs stay read-only. On noetic-devel, for a push or a manual run, each saves the image that it tested as an archive. Pull requests publish nothing.
  • The publish job is the only one with packages: write, and it runs nothing from the images. Its script, .docker/robot/publish_image.sh, in short:
    1. It checks that each archive holds the image of its architecture, built from this commit.
    2. It asks the registry about noetic-<commit> and noetic. Only the registry's manifest unknown means that a tag is free. A refusal (a denied read, an unknown repository) stops the run and names the tag and the reason, except in a first publication that a maintainer starts by hand. Any other error of these two reads stops the run after three tries.
    3. It copies both images with skopeo, a tool that copies images to a registry without running them. It combines them under noetic-<commit>-index, checks that index, and then gives its digest the version's tag. A version that exists already is checked and reused.
    4. It moves noetic to the version if noetic is missing or at an earlier commit.
  • Pinned inputs: the workflow's actions by release commits, both base images by index digest, the lidar driver by a commit and Remo's model by its version tag. The image's labels name this repository and its description, and CI adds the commit.

Limits: the handover of the archives between the jobs, the workflow's login and push to GHCR, and downloads of this package without a login run for the first time after the merge. A new package is private: until it is public, a robot without a GHCR login can't download the image with docker compose up -d, and docker compose -f compose.build.yaml build builds one on the robot instead. The README's link to "Without any PC" opens that section once the docs pull request is merged. The packages that apt and rosdep install aren't pinned, and the image isn't signed.

How it was tested

At the head, bd8e2c5. d243aca, 4d9cbc7, bb4d43d and bd8e2c5 change the publish script, its tests, the workflow and the texts of the image's folder after a2c6710, the merge of noetic-devel at ece6128 (#222 and #224).

  • The publish script without a registry (test_publish_image.sh, also a CI step): 46 tests pass, in a small git history of their own.
    • noetic moves to a later commit, stays at a later one, and stays when its commit is unrelated, missing, a name such as HEAD, the ID of a tag, or not in the history.
    • An archive of another commit, architecture or description, a first publication that goes on once the registry answers, an index that fails one of its checks, a tag that points elsewhere after its write, a missing or malformed digest, a failed copy and its rerun, both refusal texts and the three tries.
    • 22 deliberate bugs in the script each make at least one test fail, among them swapped arguments of the ancestry check, a newer commit that doesn't move noetic, an unchecked index, the version's tag before the check, a missing digest read as null, and a digest pattern without its length or with $ instead of \z.
  • The publish script against a local registry:2, at 4d9cbc7, with skopeo 1.13.3, the runners' version, and stand-in images: a first publication (a normal run, because that registry answers manifest unknown for a new repository), a rerun, a newer, an older and an unrelated commit, archives from two commits, archives with two descriptions, and no archives. The version, its staging tag and noetic have the same digest. Against a fake registry: a token service that answers 404, a 404 page, a 500, a denied read and an unknown repository write nothing, and the last two name the reason. With first publication ticked, the script tried the copy under first-publication, the fake registry refused it, and nothing else was written.
  • The default image: with the template's settings and without ROBOT_IMAGE, both services name ghcr.io/ros-mobile-robots/diffbot-robot:noetic (also a CI step). A typo in the default fails the check.
  • Compose: with both files named, up starts no container of the build service, and build still builds diffbot-robot:local (Compose 5.7.1, dry runs).
  • Lint: ShellCheck 0.10.0 finds nothing in the publish script and its tests.
  • CI at bd8e2c5: all checks pass. The Robot container workflow builds the image on arm64 and amd64, runs both smoke tests and the 46 publisher tests on each, and checks the default image and the build plan (run 45170586208). Saving, uploading and publishing are skipped, as on every pull request. industrial_ci, the dev container, the firmware and the description check pass too.
  • Earlier: at 5f06789, the local amd64 image passed both smoke tests. At 671d782, a local registry served the amd64 image built at 671d782 for the Compose commands: the start, the update, a version by its commit tag, and the build with compose.build.yaml. The update command has had git pull && in front since d243aca.
  • Not tested: the handover of the archives between the jobs, the workflow's login and push to GHCR, a first publication with first publication ticked against a registry that then answers, and a download on the Raspberry Pi.

Documentation

ros-mobile-robots/ros-mobile-robots.github.io#67, which merges after the first publication.

Part of #159, a step of #109. #159 stays open until the docs pull request merges.

Before the merge

This pull request waits for a run on Remo, so that the first image it publishes has run on the robot. The image built from this branch has to pass the first five checks of #160 on Remo's Raspberry Pi, with Remo's Teensy 4.0:

  1. The setup starts as documented.
  2. Remo drives by teleop.
  3. Remo stops when the commands stop.
  4. The lidar's scans arrive.
  5. The IMU's data arrives with the right axes, frame and time stamps.

The image is built on the Pi with docker compose -f compose.build.yaml build and started as the README describes, with ROBOT_IMAGE=diffbot-robot:local. The commit, the image ID and the firmware version go into #160 with the results.

After the merge, in this order

  1. The merge starts the first publication: the two build jobs, then publish.

    • If publish passes, go on with step 2.
    • If publish stops with The registry doesn't let this job read … and the log names a refusal for both tags, check that no package diffbot-robot exists yet. If one exists, check this repository's access to it instead. Only for a missing package, run the workflow by hand on noetic-devel (Actions tab, Robot container, Run workflow) with First publication ticked. That run builds both images again. If GHCR still refuses both reads, it creates the package under the tag first-publication, the amd64 image of this first version: leave that tag. If the tags are readable by then, it publishes as usual.
    • For any other failure, read the job's log: the script prints the registry's error.
  2. On the organization's Packages tab, open the package diffbot-robot:

    • Check that it is linked to this repository, and that this repository may write to it: inherited from the linked repository, or with the role Write under Manage Actions access.
    • A new package is private, and a robot without a GHCR login can't download it. Make it public: Package settings, Danger Zone, Change visibility. GitHub doesn't let a public package become private again.
  3. Check that both platforms download without a login. The commands use a new, empty Docker settings folder with an empty entry for ghcr.io, so that Docker can't fall back to a saved login. The check passes only if the last line ends without an error:

    settings=$(mktemp -d) &&
      echo '{"auths": {"ghcr.io": {}}}' > "$settings/config.json" &&
      DOCKER_CONFIG=$settings docker pull --platform linux/arm64 ghcr.io/ros-mobile-robots/diffbot-robot:noetic &&
      DOCKER_CONFIG=$settings docker pull --platform linux/amd64 ghcr.io/ros-mobile-robots/diffbot-robot:noetic
  4. Then the docs pull request follows, with its own steps: its excerpts are pinned to the merge commit, and its list of tags gets noetic-<commit>-index.

A failed publish job can be rerun while the archives exist, for one day. After that, rerun the whole workflow.

fjp added 3 commits October 29, 2026 01:47
On noetic-devel, the robot container workflow now publishes the images that passed the smoke test, for arm64 and amd64, as ghcr.io/ros-mobile-robots/diffbot-robot. The robot downloads the image instead of building it, and a published version can be installed again.

The build jobs stay read-only. On noetic-devel they save the tested image as an artifact. A separate publish job, the only one with packages: write, loads both archives, checks their platform and commit, pushes them and combines them: noetic-<commit> per commit, never replaced, and noetic, which moves only forward in git history. Pull requests publish nothing.

compose.yaml uses the published image unless .env sets ROBOT_IMAGE. docker compose up -d --no-build downloads it, docker compose pull --policy always updates it, and ROBOT_IMAGE=diffbot-robot:local with up -d --build --pull never builds local changes. CI's Compose smoke test uses the image it just built.
publish_image.sh now copies the archives with skopeo as OCI manifests, so the combined index keeps its description and commit annotations also when the runners' classic image store saved the images. It checks both archives' platform and commit without loading them.

A tag counts as missing only when the registry says so. A denied read, after three tries, stops the job, so that a failed read can't lead to replacing a published version. Only a manual run with first_publication set takes a package that both tags can't be read from as not existing yet.

check_version now requires an OCI index with the commit annotation, exactly one image per architecture without attestations, and the commit label in each image. noetic must carry a commit annotation, and with this commit also this version's digest.
With first_publication, publish_image.sh now creates the package under the separate tag first-publication, then reads the version and noetic again. It writes them only if both read as present or missing, so an existing version is reused, and noetic still moves only forward. If the reads stay denied, it stops.

check_version also compares each image's own platform with its index entry, and requires the description annotation.
The workflows table takes the Firmware and PR description rows of
noetic-devel and keeps this branch's Robot container row, which says
that the workflow publishes the tested images.
fjp added 14 commits November 18, 2026 11:34
publish_image.sh asked with docker buildx whether a tag exists and took
every error text with "not found" for a missing tag. A login helper that
isn't installed and a token service that answers 404 print that too.

The script now asks with skopeo, which prints the registry's own error
code. Only "manifest unknown" for the requested tag counts as missing. A
registry that doesn't know the repository counts as unreadable, like a
denial: only a first-publication run may answer that with a write.
Other errors stop the job after three tries.

test_publish_image.sh runs the script with stand-ins for skopeo and
docker and compares the writes the script attempts with the expected
ones, for each answer of the registry.
…ocal

compose.yaml had the published image's name and a build section on the
same service, so a build on the robot was stored under the published
name. compose.yaml now only runs an image. compose.build.yaml holds the
build, with the fixed name diffbot-robot:local for both services.

Without a build section, --no-build has nothing to prevent: the
commands in the comments drop it.
- The workflow names each action by the full commit of a release.
- Both base images are named by tag and index digest, and
  remo_robot.repos names the lidar driver by one commit, so both
  architectures' builds start from the same inputs.
- The image no longer carries org.opencontainers.image.licenses.
- The build job checks the settings template with compose.build.yaml
  too and runs test_publish_image.sh.
- The comment on the publish queue says when GitHub cancels a run.
- The Dockerfile's header says that RViz is in the image.
- The README names the bench check on Remo and what is still open, the
  two places for the ROS master with the lidar's condition, the own
  build with compose.build.yaml, and the two new files.
- smoke_test.sh says that it lists the lidar driver's node and doesn't
  start the driver.
- The workflows table says when the workflow runs.
- compose.build.yaml stands alone, with a service of its own. Combined
  with compose.yaml in either order, the build keeps the name
  diffbot-robot:local. A CI step checks that.
- publish_image.sh counts a read as unreadable only for the registry's
  own refusals: a denied or unauthorized manifest request, an unknown
  repository, or a 403 of the token service. A login file that can't be
  read says "permission denied" too and now stops the job, also in a
  first publication.
- test_publish_image.sh passes a login file and checks that every skopeo
  call gets it, gives each architecture its own digest, and compares
  all arguments of each index creation. New tests: an unreadable login
  file, and one denied read next to a missing tag.
- env.example and compose.yaml say that the lidar switch needs the ROS
  master on the PC.
- The CI step for the name of a local build turns every profile on, so
  that the lidar service counts, and also reads the tags of a build
  section.
- test_publish_image.sh checks an option and its value as two
  arguments and notes each argument of an index creation on its own.
  Two sources passed as one argument now fail the test.
The publisher combines the two images under a staging tag,
noetic-<commit>-index, checks that index, and only then gives its
digest the version's tag. It checks both archives before any write,
also before a first publication, and takes the index's description
from the images' label, which the Dockerfile sets. A refusal of the
registry names the tag and the reason. noetic's commit has to be a full
commit ID of the history before noetic moves. The summary lists the
checked index's images, and the temporary folder is removed. The
script has a function per step and main, as the code rules ask.

The tests run in a small git history of their own, so that noetic's
forward-only moves are tested with git's answers. They also cover the
archives by their exact paths, a first publication that goes on once the
registry answers, an index that fails its check, both refusal texts and
the three tries: 34 tests instead of 14.

The workflow checks the image that the robot downloads with the
template's settings, sets the commit label through GITHUB_SHA, gives the
publish job a time limit and keeps its token out of git's settings. The
build service of compose.build.yaml is never started by up. The update
command pulls the repository too, and the examples name the local
build diffbot-robot:local.
A tag or digest that the registry gives no sha256 digest for stops the
publication, so that two missing digests never compare as equal. noetic's
commit annotation has to name a commit object: the ID of an annotated tag
has 40 hexadecimal digits too, and git would follow it to its commit. A
published version is checked at the digest that noetic then gets.

New tests: an index without the arm64 image, of another media type, of
another commit and without the images' description; a version or noetic
tag that points elsewhere after its write; no digest; the ID of a tag as
noetic's commit; archives without a description; and the rerun after a
failed arm64 copy. 44 tests. The build job's checkout drops its token
too.
The digest pattern ends with \z instead of $, which also matched before a final line feed inside the JSON string. New tests: a digest that is too short and one that ends with a line feed, which the old pattern let through. The tests' header says that a copy is noted when it succeeds. 46 tests.
The tests of a too short digest and of one with a line feed also check the message "The registry gives no sha256 digest for …". Without it, the short digest stopped the run later, at noetic's other digest, and a pattern without its length passed all tests. The header's first lines are rewrapped.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant