Skip to content

Commit a80f6b0

Browse files
authored
Implement tag versioning. (multiarch#84)
Special thanks @meeDamian.
1 parent b89ece1 commit a80f6b0

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

.travis.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ addons:
1212
- cpio
1313
env:
1414
global:
15-
- VERSION=4.0.0-5
15+
- MAJOR_VERSION=4
16+
- MINOR_VERSION=0
17+
- PATCH_VERSION=0
18+
- RELEASE_VERSION=5
19+
- VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION-$RELEASE_VERSION
20+
# Container tag version string.
21+
# Set it here to give a flexibility of the value such as "vX.Y".
22+
- TAG_VER=v$VERSION
1623
# See qemu-user-static's RPM spec file on Fedora to check the new version.
1724
# https://src.fedoraproject.org/rpms/qemu/blob/master/f/qemu.spec
1825
- DOCKER_SERVER=docker.io
@@ -33,7 +40,7 @@ script:
3340
if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then
3441
./publish.sh -v "$VERSION" -t "$GITHUB_TOKEN" -r "$REPO"
3542
fi
36-
- ./update.sh -v "$VERSION" -r "$REPO" -d "$DOCKER_REPO"
43+
- ./update.sh -v "$VERSION" -t "$TAG_VER" -r "$REPO" -d "$DOCKER_REPO"
3744
- docker images
3845
- ./test.sh -d "$DOCKER_REPO"
3946
after_success:

update.sh

+11-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ set -xe
44
# A POSIX variable
55
OPTIND=1 # Reset in case getopts has been used previously in the shell.
66

7-
while getopts "r:v:d:" opt; do
7+
while getopts "r:v:t:d:" opt; do
88
case "$opt" in
99
r) REPO=$OPTARG
1010
;;
1111
v) VERSION=$OPTARG
1212
;;
13+
t) TAG_VER=$OPTARG
14+
;;
1315
d) DOCKER_REPO=$OPTARG
1416
;;
1517
esac
@@ -58,11 +60,16 @@ for to_arch in $to_archs; do
5860
FROM scratch
5961
COPY qemu-${to_arch}-static /usr/bin/
6062
EOF
61-
docker build -t ${DOCKER_REPO}:$from_arch-$to_arch ${work_dir}
62-
docker tag ${DOCKER_REPO}:$from_arch-$to_arch ${DOCKER_REPO}:$to_arch
63+
docker build -t ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${work_dir}
64+
for target in "${DOCKER_REPO}:$from_arch-$to_arch" \
65+
"${DOCKER_REPO}:$to_arch-${TAG_VER}" \
66+
"${DOCKER_REPO}:$to_arch" ; do
67+
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} "${target}"
68+
done
6369
rm -rf "${work_dir}"
6470
fi
6571
done
6672

67-
docker build -t ${DOCKER_REPO}:latest "${out_dir}/latest"
73+
docker build -t ${DOCKER_REPO}:${TAG_VER} "${out_dir}/latest"
74+
docker tag ${DOCKER_REPO}:${TAG_VER} ${DOCKER_REPO}:latest
6875
docker build -t ${DOCKER_REPO}:register "${out_dir}/register"

0 commit comments

Comments
 (0)