aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantinos Smanis <konstantinos.smanis@gmail.com>2021-08-04 23:35:41 +0300
committerAlexys Jacob <ultrabug@gentoo.org>2021-08-20 20:05:13 +0200
commit7d477af788c1b206bd22d1268ed75e842d3fe00e (patch)
tree9f4a9a089f76c79d1d9e2d92148701b25a7deff5 /deploy.sh
parentAdd support for systemd and musl-hardened profiles to ppc64le. (diff)
downloaddocker-images-7d477af788c1b206bd22d1268ed75e842d3fe00e.tar.gz
docker-images-7d477af788c1b206bd22d1268ed75e842d3fe00e.tar.bz2
docker-images-7d477af788c1b206bd22d1268ed75e842d3fe00e.zip
Update stage3 targets
Closes: #109 Signed-off-by: Konstantinos Smanis <konstantinos.smanis@gmail.com> Closes: https://github.com/gentoo/gentoo-docker-images/pull/108 Signed-off-by: Alexys Jacob <ultrabug@gentoo.org>
Diffstat (limited to 'deploy.sh')
-rwxr-xr-xdeploy.sh71
1 files changed, 39 insertions, 32 deletions
diff --git a/deploy.sh b/deploy.sh
index 0a49525..877c6eb 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,60 +1,67 @@
#!/bin/bash
if [[ -z "$TARGET" ]]; then
- echo "TARGET environment variable must be set e.g. TARGET=stage3-amd64."
+ echo "TARGET environment variable must be set e.g. TARGET=stage3-amd64-openrc."
exit 1
fi
# Split the TARGET variable into three elements separated by hyphens
IFS=- read -r NAME ARCH SUFFIX <<< "${TARGET}"
+VERSION=${VERSION:-$(date -u +%Y%m%d)}
+
+ORG=${ORG:-gentoo}
+
# Push built images
docker push --all-tags "${ORG}/${NAME}"
-if [[ "${TARGET}" != stage* ]]; then
+declare -A MANIFEST_TAGS=(
+ [stage3:latest]="amd64-openrc;armv5tel;armv6j_hardfp;armv7a_hardfp;arm64;i686-openrc;ppc64le-openrc;s390x"
+ [stage3:hardened]="amd64-hardened-openrc;i686-hardened-openrc"
+ [stage3:hardened-nomultilib]="amd64-hardened-nomultilib-openrc"
+ [stage3:musl]="amd64-musl;i686-musl"
+ [stage3:musl-hardened]="amd64-musl-hardened;ppc64le-musl-hardened-openrc"
+ [stage3:nomultilib]="amd64-nomultilib-openrc"
+ [stage3:nomultilib-systemd]="amd64-nomultilib-systemd"
+ [stage3:systemd]="amd64-systemd;armv5tel-systemd;armv6j_hardfp-systemd;armv7a_hardfp-systemd;arm64-systemd;i686-systemd;ppc64le-systemd"
+)
+
+# Find latest manifest
+TAG="${ARCH}${SUFFIX:+-${SUFFIX}}"
+for MANIFEST in "${!MANIFEST_TAGS[@]}"; do
+ if [[ "${MANIFEST_TAGS[${MANIFEST}]}" =~ (^|;)"${TAG}"(;|$) ]]; then
+ IFS=';' read -ra TAGS <<< "${MANIFEST_TAGS[${MANIFEST}]}"
+ break
+ fi
+done
+if [[ -z "${TAGS+x}" ]]; then
echo "Done! No manifests to push for TARGET=${TARGET}."
exit 0
fi
-VERSION=${VERSION:-$(date -u +%Y%m%d)}
-
-declare -A MANIFEST_ARCHES=(
- [stage3:latest]="amd64;arm64;armv5tel;armv6j_hardfp;armv7a_hardfp;ppc64le;s390x;x86"
- [stage3:hardened]="amd64;x86"
- [stage3:hardened-nomultilib]="amd64"
- [stage3:musl-hardened]="amd64;ppc64le"
- [stage3:musl-vanilla]="amd64;x86"
- [stage3:nomultilib]="amd64"
- [stage3:systemd]="amd64;arm64;x86;ppc64le"
- [stage3:uclibc-hardened]="amd64;x86"
- [stage3:uclibc-vanilla]="amd64;x86"
-)
-
# Latest manifests
-MANIFEST="${NAME}:${SUFFIX:-latest}"
-IFS=';' read -ra ARCHES <<< "${MANIFEST_ARCHES[${MANIFEST}]}"
-
-TAGS=()
-for ARCH in "${ARCHES[@]}"; do
- TAG="${ORG}/${NAME}:${ARCH}${SUFFIX:+-${SUFFIX}}"
- if docker manifest inspect "${TAG}" 1>/dev/null 2>&1; then
- TAGS+=("${TAG}")
+IMAGES=()
+for TAG in "${TAGS[@]}"; do
+ IMAGE="${ORG}/${NAME}:${TAG}"
+ if docker manifest inspect "${IMAGE}" &>/dev/null; then
+ IMAGES+=("${IMAGE}")
fi
done
-docker manifest create "${ORG}/${MANIFEST}" "${TAGS[@]}"
+docker manifest create "${ORG}/${MANIFEST}" "${IMAGES[@]}"
docker manifest push "${ORG}/${MANIFEST}"
# Dated manifests
-MANIFEST="${NAME}:${SUFFIX:+${SUFFIX}-}${VERSION}"
+MANIFEST="${MANIFEST}-${VERSION}"
+MANIFEST="${MANIFEST/:latest-/:}" # Remove "latest" tag prefix
-TAGS=()
-for ARCH in "${ARCHES[@]}"; do
- TAG="${ORG}/${NAME}:${ARCH}${SUFFIX:+-${SUFFIX}}-${VERSION}"
- if docker manifest inspect "${TAG}" 1>/dev/null 2>&1; then
- TAGS+=("${TAG}")
+IMAGES=()
+for TAG in "${TAGS[@]}"; do
+ IMAGE="${ORG}/${NAME}:${TAG}-${VERSION}"
+ if docker manifest inspect "${IMAGE}" &>/dev/null; then
+ IMAGES+=("${IMAGE}")
fi
done
-docker manifest create "${ORG}/${MANIFEST}" "${TAGS[@]}"
+docker manifest create "${ORG}/${MANIFEST}" "${IMAGES[@]}"
docker manifest push "${ORG}/${MANIFEST}"