Add registry login script and reinstate to CI

Signed-off-by: Richard Gee <richard@technologee.co.uk>
This commit is contained in:
Richard Gee 2019-06-23 21:21:06 +01:00 committed by Alex Ellis
parent ced4ee56dc
commit 74ef6edf08
3 changed files with 40 additions and 18 deletions

View File

@ -26,19 +26,27 @@ after_success:
- if [ ! -z "$TRAVIS_TAG" ] ; then - if [ ! -z "$TRAVIS_TAG" ] ; then
export DOCKER_CLI_EXPERIMENTAL=enabled export DOCKER_CLI_EXPERIMENTAL=enabled
echo $DOCKER_PASSWORD | docker login -u=$DOCKER_USERNAME --password-stdin; export REGISTRY=docker.io;
echo $QUAY_PASSWORD | docker login -u=$QUAY_USERNAME --password-stdin quay.io; ./ci/registryLogin.sh $REGISTRY;
./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/gateway";
./ci/tagAndPush.sh "$DOCKER_NS/gateway"; ./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/basic-auth-plugin";
./ci/tagAndPush.sh "$DOCKER_NS/basic-auth-plugin"; ./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/classic-watchdog" armhf;
./ci/tagAndPush.sh "$DOCKER_NS/classic-watchdog" armhf; ./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/classic-watchdog" arm64;
./ci/tagAndPush.sh "$DOCKER_NS/classic-watchdog" arm64; ./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/classic-watchdog" windows;
./ci/tagAndPush.sh "$DOCKER_NS/classic-watchdog" windows; ./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/classic-watchdog" x86_64;
./ci/tagAndPush.sh "$DOCKER_NS/classic-watchdog" x86_64;
./watchdog/make_manifest.sh ./watchdog/make_manifest.sh
docker push $DOCKER_NS/classic-watchdog:$TRAVIS_TAG docker push $DOCKER_NS/classic-watchdog:$TRAVIS_TAG
export REGISTRY=quay.io;
./ci/registryLogin.sh $REGISTRY;
./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/gateway";
./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/basic-auth-plugin";
./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/classic-watchdog" armhf;
./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/classic-watchdog" arm64;
./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/classic-watchdog" windows;
./ci/tagAndPush.sh "$REGISTRY" "$DOCKER_NS/classic-watchdog" x86_64;
fi fi
before_deploy: before_deploy:

15
ci/registryLogin.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
set -e
IMAGE_REGISTRY=$1
if [ "$IMAGE_REGISTRY" = "quay.io" ] ; then
USERNAME=$QUAY_USERNAME
PASSWORD=$QUAY_PASSWORD
elif [ "$IMAGE_REGISTRY" = "docker.io" ] ; then
USERNAME=$DOCKER_USERNAME
PASSWORD=$DOCKER_PASSWORD
fi
echo "Attempting to log in to $IMAGE_REGISTRY"
echo $PASSWORD | docker login -u=$USERNAME --password-stdin $IMAGE_REGISTRY;

View File

@ -1,17 +1,16 @@
#!/bin/sh #!/bin/sh
set -e set -e
IMAGE_NAME=$1 IMAGE_REGISTRY=$1
IMAGE_NAME=$2
PLATFORM="" PLATFORM=""
if [ ! -z "$2" ]; then if [ ! -z "$3" ]; then
PLATFORM="-$2" PLATFORM="-$3"
fi fi
echo "Tagging $IMAGE_NAME:$TRAVIS_TAG$PLATFORM" echo "Tagging $IMAGE_REGISTRY/$IMAGE_NAME:$TRAVIS_TAG$PLATFORM"
docker tag $IMAGE_NAME:latest-dev$PLATFORM $IMAGE_NAME:$TRAVIS_TAG$PLATFORM; docker tag $IMAGE_NAME:latest-dev$PLATFORM $IMAGE_REGISTRY/$IMAGE_NAME:$TRAVIS_TAG$PLATFORM;
docker tag $IMAGE_NAME:latest-dev$PLATFORM quay.io/$IMAGE_NAME:$TRAVIS_TAG$PLATFORM;
echo "Pushing $IMAGE_NAME:$TRAVIS_TAG$PLATFORM" echo "Pushing $IMAGE_REGISTRY/$IMAGE_NAME:$TRAVIS_TAG$PLATFORM"
docker push $IMAGE_NAME:$TRAVIS_TAG$PLATFORM; docker push $IMAGE_REGISTRY/$IMAGE_NAME:$TRAVIS_TAG$PLATFORM;
docker push quay.io/$IMAGE_NAME:$TRAVIS_TAG$PLATFORM;