mirror of
https://github.com/gluster/glusterd2.git
synced 2026-02-05 12:45:38 +01:00
extras/test-env: More changes for autobuild
- Fix build.sh to correctly check for DOCKER_TAG - New tag matching regex for Docker hub - Also tag built image latest - Add post_push tag to push latest.
This commit is contained in:
@@ -10,12 +10,12 @@ set -e
|
||||
# for which the image is being built.
|
||||
# Hub needs to have build with trigger settings as follows,
|
||||
# Type: Tag
|
||||
# Name: /^v4\.0dev\-[0-9.]+$/
|
||||
# Docker tag name: {sourceref}
|
||||
# Name: /^(v4\.0dev-[0-9]+)/
|
||||
# Docker tag name: {\1}
|
||||
# This should trigger builds for new tags.
|
||||
|
||||
# If not running in the hub environment set up the hub variables to use
|
||||
if [ "x${IMAGE_NAME}" = "x" -o "x${DOCKER_TAG}" ]; then
|
||||
if [ "x${IMAGE_NAME}" = "x" -o "x${DOCKER_TAG}" = "x" ]; then
|
||||
pkg_version="$(dirname $0)/../../scripts/pkg-version"
|
||||
# Doing it this way because pkg-version returns a dirty version when there
|
||||
# are commits beyond the latest tag
|
||||
@@ -26,6 +26,11 @@ else
|
||||
GD2_VERSION=${DOCKER_TAG}
|
||||
fi
|
||||
|
||||
# Build image
|
||||
docker build --build-arg=GD2_VERSION=$GD2_VERSION -t $IMAGE_NAME .
|
||||
|
||||
# Tag as latest
|
||||
IMAGE_LATEST="$(echo $IMAGE_NAME | cut -f1 -d:):latest"
|
||||
docker tag $IMAGE_NAME $IMAGE_LATEST
|
||||
|
||||
|
||||
|
||||
5
extras/test-env/hooks/post_push
Executable file
5
extras/test-env/hooks/post_push
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Also push the latest tag
|
||||
LATEST="$(echo $IMAGE_NAME | cut -d: -f1):latest"
|
||||
docker push $LATEST
|
||||
Reference in New Issue
Block a user