Skip to content

build: publish a FROM scratch artifact image of the built CLI, add fork CI - #5

Merged
n1hility merged 2 commits into
mainfrom
artifact-image
Sep 4, 2026
Merged

n1hility merged 2 commits into
mainfrom
artifact-image

Conversation

@n1hility

@n1hility n1hility commented Sep 4, 2026

Copy link
Copy Markdown

Publishes this fork's build output as a minimal artifact image, ghcr.io/rh-forge/m365-cli, so rh-forge/openclaw-saw-image can inline the CLI with a digest-pinned COPY --from instead of npm-installing the fork from git inside its own build. Consumer side: rh-forge/openclaw-saw-image#25.

What's in it

  • Containerfile.artifact: digest-pinned hi/nodejs:22-builder stage runs npm ci from the shrinkwrap, npm run build, npm pack, then npm install --global --prefix /opt/m365 <tarball>. The final stage is FROM scratch containing only /opt/m365, with npm's own bin link at /opt/m365/bin/m365. No tar dependency (the arm64 builder has none), no manual chmod. Every install step uses --ignore-scripts, which also neutralises the prepare hook that only existed for the git-install path.
  • Publish workflows: the org's standard four (publish-image, publish-pr-image via workflow_run, cleanup-pr-image, prune-images), with two deliberate differences for an artifact that consumers pin by digest: sha-<commit> tags are immutable (a guard refuses to republish an existing one), and there is no semver/tag trigger. Each push run writes the ready-to-paste tag@digest pin to the job summary.
  • ci.yml: new. Every workflow inherited from upstream is gated on repository_owner == 'pnp' and never runs here, so until now this fork had no CI. Runs build, lint, and unit tests on Node 22.

Verified locally

Built natively on arm64 and exercised through a ubi9/nodejs-22-minimal consumer stage: m365 version → v11.11.0, --help renders (docs/docs/cmd ships), the bin link resolves to dist/index.js under the prefix, no src/ in the tree. CI builds linux/amd64.

Follow-ups (separate PRs)

  • Remove the prepare hook (revert c652ffb) once openclaw-saw-image has switched.
  • After first publish: link the m365-cli package to package-perms and grant openclaw-saw-image read (manual GHCR UI step).

🤖 Generated with Claude Code

…rk CI

Containerfile.artifact builds the CLI in a digest-pinned hi/nodejs:22
builder (npm ci from the shrinkwrap, npm run build), packs it with npm
pack so .npmignore stays the single definition of the shipped file set,
then npm-installs that tarball into the global prefix /opt/m365. The
result is a FROM scratch image containing only that prefix, with npm's
own bin link at /opt/m365/bin/m365. Consumers such as
rh-forge/openclaw-saw-image inline it with a digest-pinned COPY --from
instead of npm-installing this fork from git inside their own builds,
which also gives them the shrinkwrap-pinned dependency set they never
had before.

Every install step runs with --ignore-scripts: nothing in the tree needs
an install hook, and it keeps the "prepare" build hook (added for the
git-install path, now redundant) from firing before sources are copied.

The publish workflows are the organisation's standard set (publish-image,
publish-pr-image via workflow_run, cleanup-pr-image, prune-images) with
two deliberate differences for an artifact that downstream pins by digest:
sha-<commit> tags are immutable (a guard refuses to republish a commit
whose sha- tag already exists), and there is no semver/tag trigger.

ci.yml is new: every workflow inherited from upstream is gated on
repository_owner == 'pnp' and never runs here, so until now this fork
shipped a production binary with no CI at all. It runs the build, lint,
and unit tests on the same Node major the artifact is built with.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The fork relaxed `outlook event list` so that omitting both userId and
userName falls back to /me, and flipped the corresponding validation test
from "fails" to "passes". The test's input, `{ id: calendarId }`, was
never a valid option: the schema is a strictObject and `id` is unknown,
which is the only reason upstream's negative version of the test passed.
With the assertion flipped, the unknown key made it fail. Use the real
option name, calendarId.

Surfaced by the fork CI added in this PR; the full suite now passes
(16068 tests).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@n1hility
n1hility merged commit 060b262 into main Sep 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant