From 07641eb5942e4561869373678b8f3f059e625b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Thu, 26 Jan 2017 09:58:21 +0100 Subject: [PATCH] CI: Push `master` images to the Docker hub. --- .dockerignore | 3 +++ .gitlab-ci.yml | 21 ++++++++++++++++----- scripts/create_build_deps_docker_image.sh | 1 - scripts/create_docker_image.sh | 1 - 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index cd60a33be..53a55a7b5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,7 @@ .git +.gitignore +.gitlab-ci.yml + tezos-node tezos-protocol-compiler diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af307db8a..4174838a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,9 @@ variables: image_id: ${CI_BUILD_REF_NAME} build_image_name: ${image_name}_build_deps build_image_id: ${CI_BUILD_REF} + private_registry: registry.ocamlpro.com:8443 + private_image_id: $private_registry/${CI_PROJECT_PATH} + public_image_id: docker.io/tezosledger/tezos:latest image: ${build_image_name}:${build_image_id} @@ -141,14 +144,21 @@ publish:docker: stage: publish image: ocp:docker tags: - - docker_builder + - public_docker_builder script: - ./scripts/create_docker_image.sh ${image_name} ${build_image_id} - docker tag ${image_name}:${build_image_id} - "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" - - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - - docker push "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" - - docker rmi "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" + "$private_image_id:$CI_BUILD_REF_NAME" + - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $private_registry + - docker push "$private_image_id:$CI_BUILD_REF_NAME" + - docker rmi "$private_image_id:$CI_BUILD_REF_NAME" + - if [ "$CI_PROJECT_PATH" = "tezos/tezos" -a "$CI_BUILD_REF_NAME" = "master" ]; then + mkdir ~/.docker ; + echo "$CI_DOCKER_AUTH" > ~/.docker/config.json ; + docker tag ${image_name}:${build_image_id} ${public_image_id} ; + docker push ${public_image_id} ; + docker rmi ${public_image_id} ; + fi publish:github: image: ocaml/opam @@ -188,3 +198,4 @@ cleanup: ${build_image_name}:${CI_PROJECT_NAMESPACE}_${CI_BUILD_REF_NAME} - docker rmi ${build_image_name}:${build_image_id} when: always + allow_failure: true diff --git a/scripts/create_build_deps_docker_image.sh b/scripts/create_build_deps_docker_image.sh index 144db6b2f..34f271279 100755 --- a/scripts/create_build_deps_docker_image.sh +++ b/scripts/create_build_deps_docker_image.sh @@ -1,7 +1,6 @@ #! /bin/sh set -e -set -x script_dir="$(dirname "$(readlink -f "$0")")" src_dir="$(dirname "$script_dir")" diff --git a/scripts/create_docker_image.sh b/scripts/create_docker_image.sh index eab3e1ee1..8c683ebc4 100755 --- a/scripts/create_docker_image.sh +++ b/scripts/create_docker_image.sh @@ -1,7 +1,6 @@ #! /bin/sh set -e -set -x script_dir="$(dirname "$(readlink -f "$0")")" src_dir="$(dirname "$script_dir")"