Gentoo Archives: gentoo-commits

From: Alexys Jacob <ultrabug@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/docker-images:master commit in: /
Date: Fri, 04 Sep 2020 14:49:05
Message-Id: 1599230907.45cdd16500965528548c2b2e0ecd2044cc20aa31.ultrabug@gentoo
1 commit: 45cdd16500965528548c2b2e0ecd2044cc20aa31
2 Author: Konstantinos Smanis <konstantinos.smanis <AT> gmail <DOT> com>
3 AuthorDate: Thu Aug 27 19:30:57 2020 +0000
4 Commit: Alexys Jacob <ultrabug <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 4 14:48:27 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/docker-images.git/commit/?id=45cdd165
7
8 Push all stage3 images to the same Docker repo
9
10 Closes: #86
11
12 Signed-off-by: Konstantinos Smanis <konstantinos.smanis <AT> gmail.com>
13 Closes: https://github.com/gentoo/gentoo-docker-images/pull/94
14 Signed-off-by: Alexys Jacob <ultrabug <AT> gentoo.org>
15
16 .travis.yml | 9 +++++----
17 README.md | 16 ++++++++--------
18 build.sh | 10 ++++++++--
19 3 files changed, 21 insertions(+), 14 deletions(-)
20
21 diff --git a/.travis.yml b/.travis.yml
22 index 50ba3f4..7661939 100644
23 --- a/.travis.yml
24 +++ b/.travis.yml
25 @@ -5,7 +5,7 @@ env:
26 - ORG=gentoo
27 jobs:
28 - TARGET=portage
29 - - TARGET=stage3-amd64
30 + - TARGET=stage3-amd64 LATEST=true
31 - TARGET=stage3-amd64-hardened
32 - TARGET=stage3-amd64-hardened-nomultilib
33 - TARGET=stage3-amd64-musl-hardened
34 @@ -44,7 +44,7 @@ script:
35 - ./build.sh
36 after_success:
37 # Inspect built image
38 - - docker image inspect "${ORG}/${TARGET}:latest"
39 + - docker image inspect "${ORG}/${TARGET/-/:}"
40 # Run `emerge --info` for stage builds
41 - |
42 if [[ "${TARGET}" == stage* ]]; then
43 @@ -53,11 +53,12 @@ after_success:
44 # Enable execution of foreign binary formats (i.e., non-amd64/x86)
45 docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
46 fi
47 - docker run --rm "${ORG}/${TARGET}:latest" emerge --info
48 + docker run --rm "${ORG}/${TARGET/-/:}" emerge --info
49 fi
50 # Push all built images to Docker Hub (cron daily task)
51 - |
52 if [[ "${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}}" == "master" && "${TRAVIS_EVENT_TYPE}" == "cron" ]]; then
53 echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
54 - docker push "${ORG}/${TARGET}"
55 + REPO="$(cut -d '-' -f 1 <<< ${TARGET})"
56 + docker push "${ORG}/${REPO}"
57 fi
58
59 diff --git a/README.md b/README.md
60 index 10eba12..bb3613d 100644
61 --- a/README.md
62 +++ b/README.md
63 @@ -14,16 +14,16 @@ https://hub.docker.com/u/gentoo/
64
65 ## Inventory
66
67 -The following targets are built by Travis (bold targets are also pushed to Docker Hub):
68 - * **`portage`**
69 +The following targets are built by Travis and pushed to Docker Hub:
70 + * `portage`
71 * `stage3`
72 * `amd64`
73 - * **`stage3-amd64`**
74 - * **`stage3-amd64-hardened`**
75 - * **`stage3-amd64-hardened-nomultilib`**
76 + * `stage3-amd64`
77 + * `stage3-amd64-hardened`
78 + * `stage3-amd64-hardened-nomultilib`
79 * `stage3-amd64-musl-hardened`
80 * `stage3-amd64-musl-vanilla`
81 - * **`stage3-amd64-nomultilib`**
82 + * `stage3-amd64-nomultilib`
83 * `stage3-amd64-systemd`
84 * `stage3-amd64-uclibc-hardened`
85 * `stage3-amd64-uclibc-vanilla`
86 @@ -39,8 +39,8 @@ The following targets are built by Travis (bold targets are also pushed to Docke
87 * `s390`
88 * `stage3-s390x`
89 * `x86`
90 - * **`stage3-x86`**
91 - * **`stage3-x86-hardened`**
92 + * `stage3-x86`
93 + * `stage3-x86-hardened`
94 * `stage3-x86-musl-vanilla`
95 * `stage3-x86-systemd`
96 * `stage3-x86-uclibc-hardened`
97
98 diff --git a/build.sh b/build.sh
99 index c0100d7..5fe7411 100755
100 --- a/build.sh
101 +++ b/build.sh
102 @@ -13,6 +13,11 @@ fi
103 IFS=- read -r NAME ARCH SUFFIX <<< "${TARGET}"
104
105 VERSION=${VERSION:-$(date -u +%Y%m%d)}
106 +if [[ "${NAME}" == "portage" ]]; then
107 + VERSION_SUFFIX=":${VERSION}"
108 +else
109 + VERSION_SUFFIX="-${VERSION}"
110 +fi
111
112 ORG=${ORG:-gentoo}
113
114 @@ -62,8 +67,9 @@ docker buildx build \
115 --build-arg ARCH="${ARCH}" \
116 --build-arg MICROARCH="${MICROARCH}" \
117 --build-arg SUFFIX="${SUFFIX}" \
118 - --tag "${ORG}/${TARGET}:latest" \
119 - --tag "${ORG}/${TARGET}:${VERSION}" \
120 + --tag "${ORG}/${TARGET/-/:}" \
121 + --tag "${ORG}/${TARGET/-/:}${VERSION_SUFFIX}" \
122 + ${LATEST:+--tag "${ORG}/${NAME}:latest"} \
123 --platform "linux/${DOCKER_ARCH}" \
124 --progress plain \
125 --load \