ci: fix harbor make REGISTRY var clash
This commit is contained in:
parent
2825b4f834
commit
7cdb7d8fc4
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@ -61,7 +61,9 @@ spec:
|
||||
environment {
|
||||
VERSION = 'v2.14.1'
|
||||
TAG_SUFFIX = '-arm64'
|
||||
REGISTRY = 'registry.bstein.dev/infra'
|
||||
# NOTE: avoid `REGISTRY` here because Harbor's Makefiles use `REGISTRY=registry`
|
||||
# and run sub-makes with `-e`, causing environment variables to override make vars.
|
||||
IMAGE_NAMESPACE = 'registry.bstein.dev/infra'
|
||||
HARBOR_TARBALL = "https://github.com/goharbor/harbor/archive/refs/tags/${VERSION}.tar.gz"
|
||||
}
|
||||
options {
|
||||
@ -127,8 +129,8 @@ spec:
|
||||
make \
|
||||
VERSIONTAG="${VERSIONTAG}" \
|
||||
BASEIMAGETAG="${VERSIONTAG}" \
|
||||
IMAGENAMESPACE="${REGISTRY}" \
|
||||
BASEIMAGENAMESPACE="${REGISTRY}" \
|
||||
IMAGENAMESPACE="${IMAGE_NAMESPACE}" \
|
||||
BASEIMAGENAMESPACE="${IMAGE_NAMESPACE}" \
|
||||
PULL_BASE_FROM_DOCKERHUB=false \
|
||||
BUILD_BASE=true \
|
||||
BUILDTRIVYADP=false \
|
||||
@ -137,14 +139,14 @@ spec:
|
||||
|
||||
# Retag a few upstream image names to our internal naming convention
|
||||
# (so Helm values can keep using `harbor-*` consistently).
|
||||
docker tag "${REGISTRY}/prepare:${VERSIONTAG}" "${REGISTRY}/harbor-prepare:${VERSIONTAG}" || true
|
||||
docker tag "${REGISTRY}/redis-photon:${VERSIONTAG}" "${REGISTRY}/harbor-redis:${VERSIONTAG}" || true
|
||||
docker tag "${REGISTRY}/nginx-photon:${VERSIONTAG}" "${REGISTRY}/harbor-nginx:${VERSIONTAG}" || true
|
||||
docker tag "${REGISTRY}/registry-photon:${VERSIONTAG}" "${REGISTRY}/harbor-registry:${VERSIONTAG}" || true
|
||||
docker tag "${IMAGE_NAMESPACE}/prepare:${VERSIONTAG}" "${IMAGE_NAMESPACE}/harbor-prepare:${VERSIONTAG}" || true
|
||||
docker tag "${IMAGE_NAMESPACE}/redis-photon:${VERSIONTAG}" "${IMAGE_NAMESPACE}/harbor-redis:${VERSIONTAG}" || true
|
||||
docker tag "${IMAGE_NAMESPACE}/nginx-photon:${VERSIONTAG}" "${IMAGE_NAMESPACE}/harbor-nginx:${VERSIONTAG}" || true
|
||||
docker tag "${IMAGE_NAMESPACE}/registry-photon:${VERSIONTAG}" "${IMAGE_NAMESPACE}/harbor-registry:${VERSIONTAG}" || true
|
||||
|
||||
# Push every image we just built for this tag under our namespace.
|
||||
docker images --format '{{.Repository}}:{{.Tag}}' \
|
||||
| awk -v ns="${REGISTRY}/" -v tag="${VERSIONTAG}" 'index($0, ns)==1 && $0 ~ ":"tag"$"' \
|
||||
| awk -v ns="${IMAGE_NAMESPACE}/" -v tag="${VERSIONTAG}" 'index($0, ns)==1 && $0 ~ ":"tag"$"' \
|
||||
| sort -u \
|
||||
| while read -r img; do
|
||||
echo "Pushing ${img}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user