CI: build-once pipeline, deploy IFT after CI with conditional aux images.
CI / test (push) Failing after 8m2s
CI / test (push) Failing after 8m2s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
# Публикация вспомогательных образов IFT: rebuild при изменениях, иначе promote :ift -> sha-*.
|
||||
# Usage: publish-ift-aux-images.sh <registry> <sha-tag> <changed-files-list>
|
||||
set -euo pipefail
|
||||
|
||||
REGISTRY="${1:?registry}"
|
||||
TAG="${2:?sha-tag}"
|
||||
FILES="${3:-}"
|
||||
|
||||
publish_image() {
|
||||
local name="$1"
|
||||
local path_pattern="$2"
|
||||
local context="$3"
|
||||
local dockerfile="$4"
|
||||
|
||||
if docker buildx imagetools inspect "${REGISTRY}/${name}:${TAG}" >/dev/null 2>&1; then
|
||||
echo "== ${name}: ${TAG} already in registry, skip"
|
||||
return
|
||||
fi
|
||||
|
||||
if echo "${FILES}" | grep -qE "${path_pattern}"; then
|
||||
echo "== ${name}: rebuild (matched: ${path_pattern})"
|
||||
docker buildx build -f "${dockerfile}" --push \
|
||||
-t "${REGISTRY}/${name}:${TAG}" \
|
||||
-t "${REGISTRY}/${name}:ift" \
|
||||
--provenance=false --sbom=false \
|
||||
"${context}"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "== ${name}: unchanged, promote :ift -> ${TAG}"
|
||||
if ! docker buildx imagetools inspect "${REGISTRY}/${name}:ift" >/dev/null 2>&1; then
|
||||
echo "ERROR: ${name}:ift not found and no matching changes in this commit"
|
||||
exit 1
|
||||
fi
|
||||
docker buildx imagetools create \
|
||||
-t "${REGISTRY}/${name}:${TAG}" \
|
||||
"${REGISTRY}/${name}:ift"
|
||||
}
|
||||
|
||||
publish_image traefik-coraza '^docker/traefik/' docker/traefik docker/traefik/Dockerfile
|
||||
publish_image fallback '^docker/fallback/' docker/fallback docker/fallback/Dockerfile
|
||||
publish_image bot-emulator-users '^test/emulate_users/' . test/emulate_users/Dockerfile
|
||||
publish_image observer-web '^docker/ObserverWeb\.Dockerfile|^docker/observer_web/' . docker/ObserverWeb.Dockerfile
|
||||
publish_image logrotate '^docker/logrotate/' docker/logrotate docker/logrotate/Dockerfile
|
||||
Reference in New Issue
Block a user