Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(ci): a republish must repair one tag, and label the commit it built (#892)

Beenu Arorac7ae450c8f31
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 733bce225..bbb3efcf8 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -327,6 +327,16 @@ jobs:
with:
ref: ${{ inputs.tag || github.ref_name }}
+ # On a dispatched run the GitHub context describes the ref the workflow
+ # was launched from — `main` — while the source checked out above is the
+ # tag being republished. metadata-action reads the context, so it
+ # stamped `org.opencontainers.image.revision` with main's commit onto an
+ # image built from v11.0.0. That is the field
+ # scripts/check_published_images.py trusts to decide what an image
+ # contains, so a wrong value there is worse than none.
+ - id: source
+ run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
+
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
@@ -342,6 +352,9 @@ jobs:
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6
with:
images: ${{ matrix.image }}
+ labels: |
+ org.opencontainers.image.revision=${{ steps.source.outputs.sha }}
+ org.opencontainers.image.version=${{ inputs.tag || github.ref_name }}
# Only the demo build gets the NEXT_PUBLIC_DEMO_* flags, and only it is
# published under a demo tag. Mirrors publish-images.yml. Other images
@@ -487,16 +500,25 @@ jobs:
# `vX.Y.Z-demo` is pinnable the same way `vX.Y.Z` is, and `demo` tracks
# the newest one. Neither `vX.Y.Z` nor `latest` ever carries a demo
# bundle.
+ # A dispatched run repairs a tag that already shipped, so it publishes
+ # only that tag. Moving `latest` and `demo` there would hand a
+ # self-hoster older content than `main` on the tag they pull by default
+ # — which is the defect this whole workflow was being changed to fix,
+ # inflicted by the tool built to fix it. The first republish of v11.0.0
+ # did exactly that to eight images before this was caught.
- id: image-tags
+ env:
+ VERSION: ${{ inputs.tag || github.ref_name }}
+ REPUBLISH: ${{ github.event_name == 'workflow_dispatch' }}
run: |
{
echo 'tags<<EOF'
if [ "${{ matrix.demo }}" = "true" ]; then
- echo "${{ matrix.image }}:${{ inputs.tag || github.ref_name }}-demo"
- echo "${{ matrix.image }}:demo"
+ echo "${{ matrix.image }}:${VERSION}-demo"
+ [ "$REPUBLISH" = "true" ] || echo "${{ matrix.image }}:demo"
else
- echo "${{ matrix.image }}:${{ inputs.tag || github.ref_name }}"
- echo "${{ matrix.image }}:latest"
+ echo "${{ matrix.image }}:${VERSION}"
+ [ "$REPUBLISH" = "true" ] || echo "${{ matrix.image }}:latest"
fi
echo 'EOF'
} >> "$GITHUB_OUTPUT"
@@ -727,9 +749,12 @@ jobs:
if: always() && needs.docker-manifest.result == 'success'
timeout-minutes: 10
steps:
+ # The workflow's own ref, not the tag being published: the question is
+ # whether today's deployment files resolve, and the gate that asks it
+ # only exists on the default branch. Checking out v11.0.0 ran a script
+ # that was not in that tree.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
- ref: ${{ inputs.tag || github.ref_name }}
fetch-depth: 0
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4b453189b..4d3457706 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -117,6 +117,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
an existing tag, because the only way to finish a half-published release was
previously to invent a new tag for a commit that had already shipped.
+- **A republish moved `latest` to the older release it was repairing, and
+ stamped the wrong commit on every image it built.** Both come from the same
+ place: on a dispatched run the GitHub context describes the ref the workflow
+ was launched from while the source checked out is the tag being
+ republished. So `metadata-action` wrote `main`'s commit into
+ `org.opencontainers.image.revision` on images built from v11.0.0 — the field
+ `check_published_images.py` trusts to decide what an image contains — and
+ the tag list still carried `latest`, which handed eight images older content
+ than `main` on the tag a self-hoster pulls by default. A republish now
+ publishes only the tag it was asked to repair, and labels the commit it
+ actually built. Its verification step also checks out the workflow's own ref
+ rather than the tag, because the gate it runs exists on the default branch
+ and not in a tree from two releases ago.
+
- **A dispatched release reported success having published nothing.** The
recovery path's `release` job is push-only, and a skip propagates the whole
length of a `needs` chain rather than one link: `docker-build` declared