public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Alexys Jacob" <ultrabug@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/docker-images:master commit in: /
Date: Fri,  4 Sep 2020 14:49:02 +0000 (UTC)	[thread overview]
Message-ID: <1599230935.8c87ce7de4d696ce595bf497aee42c8b80d8bd9f.ultrabug@gentoo> (raw)

commit:     8c87ce7de4d696ce595bf497aee42c8b80d8bd9f
Author:     Konstantinos Smanis <konstantinos.smanis <AT> gmail <DOT> com>
AuthorDate: Mon Aug 31 17:25:13 2020 +0000
Commit:     Alexys Jacob <ultrabug <AT> gentoo <DOT> org>
CommitDate: Fri Sep  4 14:48:55 2020 +0000
URL:        https://gitweb.gentoo.org/proj/docker-images.git/commit/?id=8c87ce7d

Deploy manifest lists along with per-arch images

Signed-off-by: Konstantinos Smanis <konstantinos.smanis <AT> gmail.com>
Signed-off-by: Alexys Jacob <ultrabug <AT> gentoo.org>

 .travis.yml | 16 ++++++++--------
 build.sh    |  1 -
 deploy.sh   | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 9 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 7661939..754b3d7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,7 @@ env:
     - ORG=gentoo
   jobs:
     - TARGET=portage
-    - TARGET=stage3-amd64 LATEST=true
+    - TARGET=stage3-amd64
     - TARGET=stage3-amd64-hardened
     - TARGET=stage3-amd64-hardened-nomultilib
     - TARGET=stage3-amd64-musl-hardened
@@ -55,10 +55,10 @@ after_success:
       fi
       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
-      REPO="$(cut -d '-' -f 1 <<< ${TARGET})"
-      docker push "${ORG}/${REPO}"
-    fi
+deploy:
+  # Push to Docker Hub (daily cron job)
+  - provider: script
+    script: ./deploy.sh
+    on:
+      branch: master
+      condition: $TRAVIS_EVENT_TYPE = cron

diff --git a/build.sh b/build.sh
index 5fe7411..c3979a3 100755
--- a/build.sh
+++ b/build.sh
@@ -69,7 +69,6 @@ docker buildx build \
 	--build-arg SUFFIX="${SUFFIX}" \
 	--tag "${ORG}/${TARGET/-/:}" \
 	--tag "${ORG}/${TARGET/-/:}${VERSION_SUFFIX}" \
-	${LATEST:+--tag "${ORG}/${NAME}:latest"} \
 	--platform "linux/${DOCKER_ARCH}" \
 	--progress plain \
 	--load \

diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..b27d5ab
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+if [[ -z "$TARGET" ]]; then
+	echo "TARGET environment variable must be set e.g. TARGET=stage3-amd64."
+	exit 1
+fi
+
+# Split the TARGET variable into three elements separated by hyphens
+IFS=- read -r NAME ARCH SUFFIX <<< "${TARGET}"
+
+# Push built images
+echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
+docker push "${ORG}/${NAME}"
+
+if [[ "${TARGET}" != stage* ]]; 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"
+	[stage3:musl-vanilla]="amd64;x86"
+	[stage3:nomultilib]="amd64"
+	[stage3:systemd]="amd64;arm64;x86"
+	[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
+	TAGS+=("${ORG}/${NAME}:${ARCH}${SUFFIX:+-${SUFFIX}}")
+done
+
+docker manifest create "${ORG}/${MANIFEST}" "${TAGS[@]}"
+docker manifest push "${ORG}/${MANIFEST}"
+
+# Dated manifests
+MANIFEST="${NAME}:${SUFFIX:+${SUFFIX}-}${VERSION}"
+
+TAGS=()
+for ARCH in "${ARCHES[@]}"; do
+	TAGS+=("${ORG}/${NAME}:${ARCH}${SUFFIX:+-${SUFFIX}}-${VERSION}")
+done
+
+docker manifest create "${ORG}/${MANIFEST}" "${TAGS[@]}"
+docker manifest push "${ORG}/${MANIFEST}"


             reply	other threads:[~2020-09-04 14:49 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 14:49 Alexys Jacob [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-27 12:39 [gentoo-commits] proj/docker-images:master commit in: / Michał Górny
2024-11-23  7:25 Michał Górny
2024-11-23  7:20 Michał Górny
2024-11-23  7:20 Michał Górny
2024-11-23  7:20 Michał Górny
2024-11-23  7:13 Michał Górny
2024-09-14 21:07 John Helmert III
2024-09-08 22:47 John Helmert III
2024-05-26 16:39 John Helmert III
2024-05-26 14:27 John Helmert III
2024-05-26 14:27 John Helmert III
2024-03-03  4:31 John Helmert III
2024-03-03  4:31 John Helmert III
2024-03-03  4:31 John Helmert III
2024-02-18 17:12 John Helmert III
2024-02-08  3:17 John Helmert III
2024-02-08  3:17 John Helmert III
2024-02-08  3:17 John Helmert III
2024-02-08  3:17 John Helmert III
2023-11-26 20:54 John Helmert III
2023-10-14 17:35 John Helmert III
2022-12-21 19:56 John Helmert III
2022-05-23  8:24 Alexys Jacob
2022-02-18 17:39 Alexys Jacob
2021-10-21 11:13 Alexys Jacob
2021-08-30  7:34 Alexys Jacob
2021-04-30  7:58 Alexys Jacob
2021-02-13 17:51 Alexys Jacob
2021-02-13 17:51 Alexys Jacob
2021-02-13 17:51 Alexys Jacob
2021-02-05 21:55 Max Magorsch
2020-09-04 14:49 Alexys Jacob
2020-09-03 20:34 Alexys Jacob
2020-08-26  9:03 Alexys Jacob
2020-08-24 13:05 Alexys Jacob
2020-08-24 12:58 Alexys Jacob
2020-08-20 12:17 Alexys Jacob
2020-08-20  9:28 Alexys Jacob
2020-05-26 11:54 Alexys Jacob
2020-04-09  7:26 Alexys Jacob
2020-04-09  7:26 Alexys Jacob
2020-02-23 19:48 Alexys Jacob
2020-02-23 19:46 Alexys Jacob
2020-02-23 19:46 Alexys Jacob
2019-11-15  8:28 Alexys Jacob
2019-11-15  8:28 Alexys Jacob
2019-11-15  8:28 Alexys Jacob
2019-11-15  8:25 Alexys Jacob
2019-11-14 23:02 Alexys Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1599230935.8c87ce7de4d696ce595bf497aee42c8b80d8bd9f.ultrabug@gentoo \
    --to=ultrabug@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox