fix(release): pi-unpin S5 review round: compose.yaml loses its build section and sets pull_policy: never, so a compose run (hello.sh, agent.sh, the task runner) never builds or pulls the agent image past the fit step and refuses a missing one; build_image runs docker build -f Containerfile, refuses without MOSAIC_IMAGE_TAG, and with the gate's prepareImage is the only builder; test-task.sh and test-auth.sh stop when the tag can't be read; the gate test's order check no longer passes on a missing call; README and pi-fit-image.mjs say the fit check runs on the host's node, which can differ from the image's (#1873, lane pi-unpin-s5)
This commit is contained in:
1 parent
8e9b05de8d
commit
5210522e13
10 files changed
+49
-25
No files matched your search
+7
-1
@@ -46,9 +46,15 @@ load_release() {
|
||||
# and refuses with one line when that pi is unfit or the check can't tell, so a
|
||||
# lock that resolves an unfit pi fails the build. scripts/pi-fit-image.mjs
|
||||
# says why the step runs on the host and not inside the image build.
|
||||
# compose.yaml has no build section, so this is the only way the scripts build
|
||||
# the image; compose run refuses a missing one. Call load_release first.
|
||||
build_image() {
|
||||
if [ -z "${MOSAIC_IMAGE_TAG:-}" ]; then
|
||||
echo "common: build_image needs MOSAIC_IMAGE_TAG from load_release" >&2
|
||||
exit 1
|
||||
fi
|
||||
node scripts/pi-fit-image.mjs || exit 1
|
||||
docker compose build
|
||||
docker build -f Containerfile -t "$MOSAIC_IMAGE_TAG" .
|
||||
}
|
||||
|
||||
# Ensure the configured runtime data directory exists and carries this
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
// the image's: npm ci installs both from the same lock entry, and this step refuses unless the
|
||||
// checkout's node_modules holds exactly that entry (version, resolved and integrity, as npm recorded
|
||||
// them in node_modules/.package-lock.json, and the installed package.json's version).
|
||||
// It runs pi on the host's node, which can be a different version from the image's (the
|
||||
// Containerfile's FROM). Running it on the image's node is left for later.
|
||||
//
|
||||
// node scripts/pi-fit-image.mjs exit 0: passed; exit 1: one line on stderr, unfit or can't tell
|
||||
import { readFileSync, realpathSync } from "node:fs";
|
||||
|
||||
@@ -36,7 +36,7 @@ CFG="MOSAIC_CONFIG=$SANDBOX/mock-config.json"
|
||||
|
||||
# release pointer so agent.sh's ensure stays on the no-op fast path
|
||||
REL="$(tr -d '[:space:]' < RELEASE)"
|
||||
TAG="$(node scripts/image-tag.mjs)" # #1873 S5: the tag the lock gives, never a pinned string
|
||||
TAG="$(node scripts/image-tag.mjs)" || exit 1 # #1873 S5: the tag the lock gives, never a pinned string
|
||||
printf '{"pointerVersion":1,"release":"%s","imageTag":"%s","activatedAt":"2026-01-01T00:00:00Z"}\n' "$REL" "$TAG" > "$SANDBOX/data/state/active.json"
|
||||
|
||||
# fixtures: a default-harness credential and two mosaic-managed accounts
|
||||
|
||||
@@ -266,7 +266,7 @@ EOF
|
||||
EOF
|
||||
REL="$(tr -d '[:space:]' < RELEASE)"
|
||||
mkdir -p "$SANDBOX/data/state"
|
||||
TAG="$(node scripts/image-tag.mjs)" # #1873 S5: the tag the lock gives, never a pinned string
|
||||
TAG="$(node scripts/image-tag.mjs)" || exit 1 # #1873 S5: the tag the lock gives, never a pinned string
|
||||
printf '{"pointerVersion":1,"release":"%s","imageTag":"%s","activatedAt":"2026-01-01T00:00:00Z"}\n' "$REL" "$TAG" > "$SANDBOX/data/state/active.json"
|
||||
scripts/skill.sh install ms-tools >/dev/null 2>&1
|
||||
scripts/skill.sh activate ms-tools >/dev/null 2>&1
|
||||
|
||||
@@ -40,7 +40,8 @@ export function verifyImage(receipt,checkout,inspect=inspectImage){
|
||||
// Called by the CLI only while both lanes and the image lock are exclusive.
|
||||
// #1873 S5: the image fit step. The checkout's own scripts/pi-fit-image.mjs runs the fit check on the
|
||||
// pi package-lock.json resolves, as npm ci installed it in the checkout, before the build. It exits
|
||||
// non-zero with one line when that pi is unfit or the check can't tell.
|
||||
// non-zero with one line when that pi is unfit or the check can't tell. compose.yaml has no build
|
||||
// section, so the build below is a plain docker build of the Containerfile under the lock's tag.
|
||||
export function imageFitStep(checkout){
|
||||
try{execFileSync(process.execPath,[join(checkout,'scripts/pi-fit-image.mjs')],{cwd:checkout,encoding:'utf8',stdio:['ignore','pipe','pipe'],env:{PATH:process.env.PATH,HOME:process.env.HOME,...(process.env.TMPDIR?{TMPDIR:process.env.TMPDIR}:{})}});}
|
||||
catch(e){const line=String(e.stderr??'').trim().split('\n').pop();refuse(`image fit step refused: ${line||'it could not run'}`);}
|
||||
@@ -54,7 +55,7 @@ export function prepareImage(checkout,{grant,tempRoot,out},invoke,fit=imageFitSt
|
||||
const tag=lockTag(checkout);
|
||||
fit(checkout);
|
||||
const run=invoke??((args)=>execFileSync('docker',args,{cwd:checkout,encoding:'utf8',stdio:['ignore','pipe','pipe'],env:{PATH:process.env.PATH,HOME:process.env.HOME,...(process.env.DOCKER_HOST?{DOCKER_HOST:process.env.DOCKER_HOST}:{}),COMPOSE_PROJECT_NAME:'mg197-image-prepare',MOSAIC_IMAGE_TAG:tag,MOSAIC_DATA_ROOT:join(tempRoot,'data'),MOSAIC_PROVIDER:'fixture',MOSAIC_MODEL:'fixture',PI_AUTH_FILE:'/dev/null'}}));
|
||||
const start=performance.now();let buildOutput;try{buildOutput=run(['compose','build']);}catch(e){if(out)writeFileSync(join(out,'image-build.log'),String(e.stdout??'')+String(e.stderr??''),{mode:0o600,flag:'wx'});throw e;}if(out)writeFileSync(join(out,'image-build.log'),buildOutput,{mode:0o600,flag:'wx'});const buildWallMs=performance.now()-start;
|
||||
const start=performance.now();let buildOutput;try{buildOutput=run(['build','-f','Containerfile','-t',tag,'.']);}catch(e){if(out)writeFileSync(join(out,'image-build.log'),String(e.stdout??'')+String(e.stderr??''),{mode:0o600,flag:'wx'});throw e;}if(out)writeFileSync(join(out,'image-build.log'),buildOutput,{mode:0o600,flag:'wx'});const buildWallMs=performance.now()-start;
|
||||
if(inputDigest!==imageFingerprint(checkout))refuse('image inputs changed while building');
|
||||
const actual=JSON.parse(run(['image','inspect',tag,'--format','{{json .}}']));
|
||||
const receipt={inputDigest,imageId:actual.Id,tag,baseDigest,platform:`${actual.Os}/${actual.Architecture}`,grant,builds:1,buildWallMs,at:new Date().toISOString()};
|
||||
|
||||
Reference in new issue
Block a user