From 45cdd16500965528548c2b2e0ecd2044cc20aa31 Mon Sep 17 00:00:00 2001 From: Konstantinos Smanis Date: Thu, 27 Aug 2020 22:30:57 +0300 Subject: Push all stage3 images to the same Docker repo Closes: #86 Signed-off-by: Konstantinos Smanis Closes: https://github.com/gentoo/gentoo-docker-images/pull/94 Signed-off-by: Alexys Jacob --- .travis.yml | 9 +++++---- README.md | 16 ++++++++-------- build.sh | 10 ++++++++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 50ba3f4..7661939 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ env: - ORG=gentoo jobs: - TARGET=portage - - TARGET=stage3-amd64 + - TARGET=stage3-amd64 LATEST=true - TARGET=stage3-amd64-hardened - TARGET=stage3-amd64-hardened-nomultilib - TARGET=stage3-amd64-musl-hardened @@ -44,7 +44,7 @@ script: - ./build.sh after_success: # Inspect built image - - docker image inspect "${ORG}/${TARGET}:latest" + - docker image inspect "${ORG}/${TARGET/-/:}" # Run `emerge --info` for stage builds - | if [[ "${TARGET}" == stage* ]]; then @@ -53,11 +53,12 @@ after_success: # Enable execution of foreign binary formats (i.e., non-amd64/x86) docker run --rm --privileged multiarch/qemu-user-static --reset -p yes fi - docker run --rm "${ORG}/${TARGET}:latest" emerge --info + docker run --rm "${ORG}/${TARGET/-/:}" emerge --info fi # Push all built images to Docker Hub (cron daily task) - | if [[ "${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}}" == "master" && "${TRAVIS_EVENT_TYPE}" == "cron" ]]; then echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin - docker push "${ORG}/${TARGET}" + REPO="$(cut -d '-' -f 1 <<< ${TARGET})" + docker push "${ORG}/${REPO}" fi diff --git a/README.md b/README.md index 10eba12..bb3613d 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,16 @@ https://hub.docker.com/u/gentoo/ ## Inventory -The following targets are built by Travis (bold targets are also pushed to Docker Hub): - * **`portage`** +The following targets are built by Travis and pushed to Docker Hub: + * `portage` * `stage3` * `amd64` - * **`stage3-amd64`** - * **`stage3-amd64-hardened`** - * **`stage3-amd64-hardened-nomultilib`** + * `stage3-amd64` + * `stage3-amd64-hardened` + * `stage3-amd64-hardened-nomultilib` * `stage3-amd64-musl-hardened` * `stage3-amd64-musl-vanilla` - * **`stage3-amd64-nomultilib`** + * `stage3-amd64-nomultilib` * `stage3-amd64-systemd` * `stage3-amd64-uclibc-hardened` * `stage3-amd64-uclibc-vanilla` @@ -39,8 +39,8 @@ The following targets are built by Travis (bold targets are also pushed to Docke * `s390` * `stage3-s390x` * `x86` - * **`stage3-x86`** - * **`stage3-x86-hardened`** + * `stage3-x86` + * `stage3-x86-hardened` * `stage3-x86-musl-vanilla` * `stage3-x86-systemd` * `stage3-x86-uclibc-hardened` diff --git a/build.sh b/build.sh index c0100d7..5fe7411 100755 --- a/build.sh +++ b/build.sh @@ -13,6 +13,11 @@ fi IFS=- read -r NAME ARCH SUFFIX <<< "${TARGET}" VERSION=${VERSION:-$(date -u +%Y%m%d)} +if [[ "${NAME}" == "portage" ]]; then + VERSION_SUFFIX=":${VERSION}" +else + VERSION_SUFFIX="-${VERSION}" +fi ORG=${ORG:-gentoo} @@ -62,8 +67,9 @@ docker buildx build \ --build-arg ARCH="${ARCH}" \ --build-arg MICROARCH="${MICROARCH}" \ --build-arg SUFFIX="${SUFFIX}" \ - --tag "${ORG}/${TARGET}:latest" \ - --tag "${ORG}/${TARGET}:${VERSION}" \ + --tag "${ORG}/${TARGET/-/:}" \ + --tag "${ORG}/${TARGET/-/:}${VERSION_SUFFIX}" \ + ${LATEST:+--tag "${ORG}/${NAME}:latest"} \ --platform "linux/${DOCKER_ARCH}" \ --progress plain \ --load \ -- cgit v1.2.3-65-gdbad