ci(server): take the publication policy from master, not the tag

The publish job checks out the tag and ran that tree's release helper for
preflight and readback, so an older tag (v0.7.0 requires a private
package) could never publish under the current public policy. Copy
master's helper before checking out the tag and run preflight/readback
from it; the tag's tree is still what gets built, tested and smoked. The
helper is stdlib-only and its local identity stamp is unchanged since
v0.7.0, so the two copies agree on it.
This commit is contained in:
aj committed 2026-11-17 18:48:42 -05:00
1 parent 480efb2893
commit 244f946912
3 files changed
+26 -5

No files matched your search

+8 -4
View File
@@ -141,8 +141,8 @@ jobs:
steps:
- name: Isolate logs, safe metadata and ephemeral auth
run: |
printf 'METADATA_DIR=%s/server-image-metadata\nRESULTS=%s/server-image-results\nDOCKER_CONFIG=%s/server-image-auth\n' \
"$RUNNER_TEMP" "$RUNNER_TEMP" "$RUNNER_TEMP" >> "$GITHUB_ENV"
printf 'METADATA_DIR=%s/server-image-metadata\nRESULTS=%s/server-image-results\nDOCKER_CONFIG=%s/server-image-auth\nRELEASE_POLICY=%s/release-policy/server_image_release.py\n' \
"$RUNNER_TEMP" "$RUNNER_TEMP" "$RUNNER_TEMP" "$RUNNER_TEMP" >> "$GITHUB_ENV"
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
ref: master
@@ -153,6 +153,10 @@ jobs:
env:
TAG: ${{ github.event.release.tag_name || inputs.tag }}
run: python3 scripts/server_image_release.py source
- name: Keep master's publication policy (an older tag's helper must not decide visibility)
run: |
mkdir -p "$(dirname "$RELEASE_POLICY")"
cp scripts/server_image_release.py "$RELEASE_POLICY"
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
ref: ${{ steps.source.outputs.source_sha }}
@@ -203,7 +207,7 @@ jobs:
- name: Refuse unknown visibility, wrong association, and both existing tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python3 scripts/server_image_release.py preflight
run: python3 "$RELEASE_POLICY" preflight
- name: Login and publish only the two immutable tags (no rebuild)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -219,7 +223,7 @@ jobs:
id: readback
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python3 scripts/server_image_release.py readback
run: python3 "$RELEASE_POLICY" readback
- name: Remove ephemeral Docker credentials
if: always()
run: rm -rf -- "$DOCKER_CONFIG"
+4 -1
View File
@@ -97,7 +97,10 @@ anyone may pull the image without a GitHub login. Publishing it does not make a
server reachable; the server has no authentication and stays on a trusted LAN
(see [nest storage](nest-storage.md#deploying-with-compose)).
The job uses only its scoped `GITHUB_TOKEN`. An existing package must be public
The job builds, tests and smokes the tag's own tree, but the publication policy
(preflight before upload and readback after it) always comes from `master`'s copy
of `scripts/server_image_release.py`, so an older tag publishes under the current
policy. The job uses only its scoped `GITHUB_TOKEN`. An existing package must be public
and linked to `ajisaacs/OpenNest`; a private package or one linked to another
repository stops the job before upload. The first publication creates the
package: GitHub's own `Not Found` package response is accepted only when the
+14
View File
@@ -724,6 +724,20 @@ class WorkflowBehavior(unittest.TestCase):
self.assertNotIn("'release'", condition)
self.assertIn("github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'", condition)
def test_publication_policy_comes_from_master_not_the_tagged_tree(self):
# The tag's tree is built and tested, but an older tag's helper must not
# decide package visibility: preflight and readback run master's copy.
workflow = pathlib.Path(__file__).resolve().parents[1] / ".github/workflows/server-image.yml"
publish = workflow.read_text().split("\n publish:\n", 1)[1].split("\n verify-published:\n", 1)[0]
source = publish.index("server_image_release.py source")
copy = publish.index('cp scripts/server_image_release.py "$RELEASE_POLICY"')
tag_checkout = publish.index("ref: ${{ steps.source.outputs.source_sha }}")
self.assertLess(source, copy)
self.assertLess(copy, tag_checkout)
for operation in ("preflight", "readback"):
self.assertIn('python3 "$RELEASE_POLICY" ' + operation, publish)
self.assertNotIn("scripts/server_image_release.py " + operation, publish)
def test_build_log_pipeline_preserves_docker_failure(self):
workflow = pathlib.Path(__file__).resolve().parents[1] / ".github/workflows/server-image.yml"
lines = workflow.read_text().splitlines()