From ecf77d43f4be0276f321bc924c7516afdb31f2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20R=C3=BCth?= Date: Fri, 6 Sep 2019 01:44:43 +0200 Subject: [PATCH 1/2] Tag docker images with their commit SHA so we can point to them from binder's Dockerfile. Note that mybinder does not support moving targets such as branches. --- .ci/build-docker.sh | 3 +++ .ci/update-env.sh | 2 ++ .gitlab-ci.yml | 1 + 3 files changed, 6 insertions(+) diff --git a/.ci/build-docker.sh b/.ci/build-docker.sh index 56c837b8322..05ce598cb6c 100755 --- a/.ci/build-docker.sh +++ b/.ci/build-docker.sh @@ -41,6 +41,9 @@ docker_build --target make-all --tag make-all:$DOCKER_TAG . # Build the release image without build artifacts. docker_build --target sagemath --tag "$DOCKER_IMAGE_CLI" . +# Tag the sagemath:$DOCKER_TAG image that CI has just built as +# sagemath:$COMMIT_HASH so we can refer to it uniquely later. +docker tag "$DOCKER_IMAGE_CLI" "$DOCKER_IMAGE_BINDER" # Display the layers of this image docker history "$DOCKER_IMAGE_CLI" # Build the developer image with the build artifacts intact. diff --git a/.ci/update-env.sh b/.ci/update-env.sh index 77e1cca4152..60544b4dbda 100755 --- a/.ci/update-env.sh +++ b/.ci/update-env.sh @@ -45,6 +45,8 @@ fi export DOCKER_IMAGE_CLI=${DOCKER_NAMESPACE:-sagemath}/sagemath:$DOCKER_TAG export DOCKER_IMAGE_DEV=${DOCKER_NAMESPACE:-sagemath}/sagemath-dev:$DOCKER_TAG +export DOCKER_IMAGE_BINDER="${DOCKER_NAMESPACE:-sagemath}/sagemath:${CI_COMMIT_SHA}}" + # Seed the build cache with this image (set to source-clean to build from # scratch.) export ARTIFACT_BASE=${ARTIFACT_BASE:-$DEFAULT_ARTIFACT_BASE} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e2f2427b02e..f43501e216c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,6 +99,7 @@ build-from-latest: - .ci/build-docker.sh | tee gitlab-build-docker.log | .ci/head-tail.sh 1048576 - .ci/push-gitlab.sh sagemath-dev - .ci/push-gitlab.sh sagemath + - DOCKER_TAG=$CI_COMMIT_SHA .ci/push-gitlab.sh sagemath except: - master - develop From e353fd549e71e3d97656942373ab1e8e3d770898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20R=C3=BCth?= Date: Fri, 6 Sep 2019 03:30:40 +0200 Subject: [PATCH 2/2] fix typo --- .ci/update-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/update-env.sh b/.ci/update-env.sh index 60544b4dbda..60ace995da1 100755 --- a/.ci/update-env.sh +++ b/.ci/update-env.sh @@ -45,7 +45,7 @@ fi export DOCKER_IMAGE_CLI=${DOCKER_NAMESPACE:-sagemath}/sagemath:$DOCKER_TAG export DOCKER_IMAGE_DEV=${DOCKER_NAMESPACE:-sagemath}/sagemath-dev:$DOCKER_TAG -export DOCKER_IMAGE_BINDER="${DOCKER_NAMESPACE:-sagemath}/sagemath:${CI_COMMIT_SHA}}" +export DOCKER_IMAGE_BINDER="${DOCKER_NAMESPACE:-sagemath}/sagemath:${CI_COMMIT_SHA}" # Seed the build cache with this image (set to source-clean to build from # scratch.)