Commit Graph
5 Commits
Author SHA1 Message Date
efitenandClaude Opus 5 b8c8d98e61 fix(release): keep every platform when re-tagging :edge as a release (#2031)
## Problem

`crane mutate` works on one image, not on an index. Pointed at the
multi-arch `:edge` tag it silently resolves the default platform, so the
fast path published v3.11.0 as a single amd64 OCI manifest, and `crane
tag` then pointed `v3.11`, `v3` and `latest` at that same manifest.
`docker pull` on arm64 against any of those four tags fails.

Verified in the registry:

| tag | shape | arch |
|---|---|---|
| `v3.9.2`, `v3.10`, `v3.10.1`, `edge` | index, 4 children | multi-arch
|
| `v3.11.0`, `v3.11`, `v3`, `latest` | `oci.image.manifest.v1`, 17
layers | amd64 only, revision `a2ea18f7` |

Earlier releases are indexes, so this only hit v3.11.0. The GitHub
release and both `corescope-decrypt` binaries are unaffected.

## Change

- The fast path now reads the `:edge` manifest, mutates each runnable
platform child by digest (`/app/.image-version` plus the version label,
as #1807 intended) and reassembles an index with `crane index append`. A
single-platform `:edge` still takes the old single mutate path.
- Attestation manifests (`platform.architecture == "unknown"`) are not
carried over: they reference the pre-mutation digests, so copying them
would attest the wrong images.
- A new verification step compares the platform set of `vX.Y.Z`, `vX.Y`,
`vX` and `latest` against `:edge` and fails the run if any of them
differs. A release tag that resolves to one platform is worse than a
slow release, so this should break the build rather than ship.
- Scratch tags (`tmp-vX.Y.Z-linux-amd64`, ...) are deleted best-effort
afterwards; the index references the manifests by digest, so leaving
them behind is only untidy.
- Added `workflow_dispatch` with a `tag` input to republish the images
for an existing release. A dispatched run resolves the tagged commit
itself, because `github.sha` is then the ref the workflow file came
from, and it skips the `deploy.yml` dispatch: that release already
exists and releases here are immutable (the trap from #1955/#1956).

## Tests

None: this repository has no harness that executes workflow files, and
the CI jobs cannot reach a step that pushes to GHCR. What the change is
verified against instead:

- `crane index append` accepts `-m/--manifest` repeated plus `-t/--tag`,
with the base index optional, so building an index from scratch is
supported (crane docs for `index append`).
- The YAML parses and every `run:` block passes `bash -n`.
- The platform comparison was run by hand against the live registry:
`:edge` reports `linux/amd64,linux/arm64` and `v3.11.0` reports
`single`, which is exactly the case the new step must fail on.
- The real test is the dispatch on `v3.11.0` right after merge, which is
also the repair. If the verification step fails there, nothing is
published and the tags stay as they are.

## Not verified

- The scratch-tag delete needs `delete:packages`; `GITHUB_TOKEN` may not
have it. It cannot fail the run.
- Whether GHCR keeps the attestation manifests attached to `:edge`
reachable after the index is rebuilt for a release tag (they stay on
`:edge` itself, which is untouched).

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-16 11:07:18 +02:00
n30nex 2288e28d4e fix: publish release artifacts after successful image retagging (#1964)
Successful release fast paths publish image tags but never dispatch the
job that creates the GitHub release and decrypt binaries. Dispatch
`deploy.yml` from both image routes. A default-off `images_published`
input skips E2E and image rebuilding only for an already-published tag;
missing or mismatched images keep the complete fallback without
requiring new inputs on older workflow definitions.

Go validation still gates the release binaries, checkout and version
flags retain the tagged source, and the existing release action uploads
both architectures before publication. Missing binary files now fail
publication.

Fixes #1956.

Validation:

- `node test-issue-1956-release-routing.js` executes the actual workflow
shell steps with registry and dispatch commands stubbed. Covers
matching, missing and mismatched images; failed retag and Go validation;
branch/PR boundaries; and both tagged binary commands.
- The original test commit fails because a matching image dispatches
zero artifact workflows; the fix passes the same assertion.
- Existing release workflow Go checks, decrypt/channel tests, YAML
parsing and actionlint pass.
- Both static Linux amd64 and arm64 binaries cross-build with verified
architecture and version metadata.

Actual registry publication and GitHub release creation were not
exercised. Existing immutable releases and old tags that contain older
workflow definitions are outside this fix.

Following #1922, this is a focused release-routing PR. A separate repair
for #1858 rewrites the shared frontend test runner; merging this first
lets that repair retain this regression in its authoritative list.
Please assess current Go and E2E job results separately from
workflow-approval or staging-runner state.
2026-09-06 21:20:16 +02:00
9ef4179ef1 fix(release): report correct version on fast-path retagged images (#1807) (#1814)
Fixes #1807.

Implements the fix path from the triage (env → image-version file →
baked version, zero rebuild cost):

## Changes

**`cmd/server/main.go` — `resolveVersion()` fallback chain**
1. `CORESCOPE_VERSION` env (operator override)
2. `.image-version` file in the working dir (`/app` in the container) —
mirrors the existing `.git-commit` pattern in `resolveCommit()`
3. ldflags-baked `Version`
4. `"unknown"`

Edge builds are unaffected: no env, no file → baked `"edge"` as before.

**`.github/workflows/release-fast-path.yml` — retag step**
Instead of a plain `crane tag :edge → :vX.Y.Z`, the fast path now runs
`crane mutate` on `:edge` with:
- `--append` of a deterministic one-file layer containing
`/app/.image-version` = `vX.Y.Z`
- `--label org.opencontainers.image.version=vX.Y.Z`
- `--tag :vX.Y.Z`

`vX.Y`, `vX` and `latest` are then pointed at the mutated image. Still
no rebuild — the mutation is a manifest + single ~100-byte layer
operation.

## Notes
- The release tags no longer share the exact digest with `:edge` (they
carry one extra layer); the fallback SHA check is unaffected since it
compares the `org.opencontainers.image.revision` label against
`github.sha`.
- The layer tar uses `--owner=0 --group=0 --mtime='UTC 2020-01-01'` for
reproducibility.
- Operators can also fix existing deployments immediately with `-e
CORESCOPE_VERSION=v3.9.2`, no image change needed.

## Testing
- `go build ./cmd/server` + `go vet` clean (golang:1.24)
- Workflow YAML validated
- Reporter context: running the affected v3.9.2 fast-path image in
production (live.saarmesh.de), happy to verify the next tagged release
end-to-end.

---------

Co-authored-by: Mathias Kasper <fallisaar@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: SaarMesh-Bot <bot@saarmesh.de>
2026-09-02 09:50:14 +02:00
Kpa-clawbotandKpa-clawbot 76e130b313 fix(#1702): grant actions: write to release-fast-path workflow (#1703)
## Summary

Fixes the missing `actions: write` permission on
`.github/workflows/release-fast-path.yml` so the fallback `gh workflow
run deploy.yml` dispatch no longer returns HTTP 403.

## Triage verdict

From issue #1702 root-cause section:

> Fast-path workflow YAML likely lacks:
> ```yaml
> permissions:
>   contents: read
>   packages: write
>   actions: write   # MISSING — required to dispatch other workflows
> ```
> ## Fix
> One-line addition to `.github/workflows/release-fast-path.yml`
permissions block.

## Root cause

`.github/workflows/release-fast-path.yml` lines 16-18 (before this
change) only granted `contents: read` and `packages: write`. The
fallback step (`gh workflow run deploy.yml` when `:edge`'s
`org.opencontainers.image.revision` label doesn't match the tag SHA)
calls the GitHub Actions REST API, which requires `actions: write` on
`GITHUB_TOKEN`. Without it, the dispatch fails with `Resource not
accessible by integration` and the release stalls until an operator
manually re-runs the fast-path job after `:edge` rebuilds.

## Change

- `.github/workflows/release-fast-path.yml`: add `actions: write` to the
workflow-level `permissions:` block.
- `cmd/server/release_fast_path_workflow_test.go`: extend the existing
config-gate test (issue #1677) to require `actions: write` alongside the
previously asserted `contents: read` and `packages: write`.

Two commits, red→green:

1. `test(#1702): assert release-fast-path.yml requires actions: write` —
extends the assertion. Verified to fail on this commit
(`release-fast-path.yml: missing required permission "actions: write"`).
2. `fix(#1702): grant actions: write to release-fast-path workflow` —
adds the permission. Test green.

## TDD posture

The repo already had a YAML-config gate at
`cmd/server/release_fast_path_workflow_test.go` (parses the workflow as
text and asserts required permission strings). Strict TDD applied: red
commit extends the test, green commit fixes the workflow. No exemption
needed.

## Acceptance criteria (from #1702)

- [x] `permissions.actions: write` added to the fast-path workflow
- [ ] Manual test: tag a scratch SHA where `:edge` is stale; confirm
fallback dispatches deploy.yml without 403 — by-design out of CI scope
(would require a throwaway tag + race condition); covered by next real
release.
- [ ] Operator-felt: next release where notes-commit lands AFTER `:edge`
build completes works in one pass without manual rerun — verifiable only
on next release; in-scope of `Closes #1702` because bullet 1 (the
structural defect) is the cause of bullets 2 and 3.

## Preflight

`bash ~/.openclaw/skills/pr-preflight/scripts/run-all.sh origin/master`
→ **clean** (all hard gates pass, no warnings).

Closes #1702

---------

Co-authored-by: Kpa-clawbot <kpa-clawbot@users.noreply.github.com>
2026-06-13 00:10:59 -07:00
Kpa-clawbotandKpa-clawbot 2ef7d2437d fix(ci): release fast-path re-tag :edge → :vX.Y.Z when SHA matches (Fixes #1677) (#1680)
## Summary

Adds `.github/workflows/release-fast-path.yml`: a metadata-only re-tag
workflow that fires on `push.tags: v[0-9]+.[0-9]+.[0-9]+` and, when
`:edge`'s `org.opencontainers.image.revision` label matches the tag SHA,
applies `:vX.Y.Z`, `:vX.Y`, `:vX`, `:latest` to the existing edge
manifest via `crane tag`. No rebuild, no test re-run — ~seconds vs ~30
min today. If the SHA doesn't match (tag points to an older commit, or
`:edge` wasn't built yet), it dispatches the existing `deploy.yml`
pipeline as a fallback so validated bytes always ship.

To prevent double-fire, `deploy.yml`'s top-level `on:` block drops
`tags: ['v*']` — `release-fast-path.yml` is now the sole consumer of
`push.tags`. Edge publishing on master push is untouched.

## TDD

Red commit adds `cmd/server/release_fast_path_workflow_test.go` (two
tests: one asserts the new workflow exists with the required
trigger/permissions/markers; the other asserts `deploy.yml`'s `on:`
block no longer mentions `tags:`). Both fail on assertions in the red
commit. Green commit adds the workflow file + edits `deploy.yml`; both
pass.

## Acceptance criteria (from #1677)

- Tag-CI completes in <2 min when tag SHA == `:edge` revision →
fast-path is metadata-only, single short job
- Falls back to full pipeline on SHA mismatch → `gh workflow run
deploy.yml --ref ${{ github.ref }}`
- `:vX.Y.Z` has same digest as `:edge` → `crane tag` copies the
manifest, bytes are byte-identical
- No regression on older-SHA tags → fallback path runs the unchanged
full validation

Fixes #1677

---------

Co-authored-by: Kpa-clawbot <bot@corescope.local>
2026-06-12 05:52:06 -07:00