Model fixture image identity in release drill
This commit is contained in:
parent
c3f6905624
commit
8584308aba
|
|
@ -60,9 +60,17 @@ printf '%s %s\n' "$bundle_hash" "$(basename -- "$bundle")" >"$bundle.sha256"
|
|||
image_archive="$fixture/output/releases/incoming/who_need_help-$target_commit-images-linux-amd64.tar.gz"
|
||||
printf 'isolated release drill image archive\n' | gzip -n >"$image_archive"
|
||||
image_hash=$(sha256sum "$image_archive" | awk '{print $1}')
|
||||
fixture_candidate_id="sha256:$image_hash"
|
||||
printf '%s %s\n' "$image_hash" "$(basename -- "$image_archive")" \
|
||||
>"$image_archive.sha256"
|
||||
fixture_image_config="$run_dir/fixture-image-config.json"
|
||||
printf '%s\n' \
|
||||
'{"architecture":"amd64","os":"linux","rootfs":{"type":"layers","diff_ids":[]}}' \
|
||||
>"$fixture_image_config"
|
||||
fixture_image_id="sha256:$(sha256sum "$fixture_image_config" | awk '{print $1}')"
|
||||
[[ "$fixture_image_id" =~ ^sha256:[0-9a-f]{64}$ ]] || {
|
||||
echo "Release drill generated an invalid fixture image ID." >&2
|
||||
exit 1
|
||||
}
|
||||
image_manifest="$fixture/output/releases/incoming/who_need_help-$target_commit-images.manifest"
|
||||
printf '%s\n' \
|
||||
'format=1' \
|
||||
|
|
@ -70,7 +78,7 @@ printf '%s\n' \
|
|||
'platform=linux/amd64' \
|
||||
'topology=compact' \
|
||||
'image_count=1' \
|
||||
"image=who-need-help:production-${target_commit:0:12}|$fixture_candidate_id" \
|
||||
"image=who-need-help:production-${target_commit:0:12}|$fixture_image_id" \
|
||||
>"$image_manifest"
|
||||
backup="$fixture/output/backups/production/pre-release.dump"
|
||||
printf 'isolated release drill backup\n' >"$backup"
|
||||
|
|
@ -194,7 +202,7 @@ if [ "$1" = inspect ]; then
|
|||
"$MOCK_ENV_FILE"
|
||||
fi
|
||||
;;
|
||||
'{{.Image}}') printf '%s\n' "$FIXTURE_CANDIDATE_ID" ;;
|
||||
'{{.Image}}') printf '%s\n' "$FIXTURE_IMAGE_ID" ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
exit 0
|
||||
|
|
@ -202,7 +210,7 @@ fi
|
|||
if [ "$1" = image ] && [ "$2" = inspect ] &&
|
||||
[ "$3" = --format ]; then
|
||||
case "$4" in
|
||||
'{{.Id}}') printf '%s\n' "$FIXTURE_CANDIDATE_ID" ;;
|
||||
'{{.Id}}') printf '%s\n' "$FIXTURE_IMAGE_ID" ;;
|
||||
'{{.Os}}/{{.Architecture}}') printf 'linux/amd64\n' ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
|
|
@ -230,7 +238,7 @@ container_env=(
|
|||
--env "MOCK_GIT_STATE=$remote_root/git-state"
|
||||
--env "MOCK_COMMAND_LOG=$remote_root/mock-commands.log"
|
||||
--env "MOCK_ENV_FILE=$remote_root/.env"
|
||||
--env "FIXTURE_CANDIDATE_ID=$fixture_candidate_id"
|
||||
--env "FIXTURE_IMAGE_ID=$fixture_image_id"
|
||||
--env "PATH=/mock-bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
)
|
||||
container_mounts=(
|
||||
|
|
@ -267,6 +275,9 @@ run_release() {
|
|||
}
|
||||
|
||||
run_release forward_only >"$run_dir/forward-success.out"
|
||||
grep -Fx \
|
||||
"image=who-need-help:production-${target_commit:0:12}|$fixture_image_id" \
|
||||
"$image_manifest" >/dev/null
|
||||
grep -Fx "APP_IMAGE=who-need-help:production-${target_commit:0:12}" \
|
||||
"$fixture/.env" >/dev/null
|
||||
grep -Fx "CADDY_IMAGE=who-need-help:caddy-production-${current_commit:0:12}" \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user