Skip to content

Commit

Permalink
Trac #28457: Build binder compatible docker images from Trac
Browse files Browse the repository at this point in the history
By tagging all our images with the commit SHA in GitLab registry.

You cannot sanely create a binder that points to a moving target such as
a branch. Therefore, all images need to have unique tags.

With the changes merged, links like this should work for all branches on
trac:

https://gitlab-hooks-flau3jeaza-
ew.a.run.app/status/trac/branch/u%2Fsaraedum%2F28457

URL: https://trac.sagemath.org/28457
Reported by: saraedum
Ticket author(s): Julian Rüth
Reviewer(s): David Roe
  • Loading branch information
Release Manager committed May 28, 2020
2 parents 27aae32 + e353fd5 commit 24590ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .ci/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ rsync html_/ html/ -a --copy-links

# 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.
Expand Down
2 changes: 2 additions & 0 deletions .ci/update-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,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
Expand Down

0 comments on commit 24590ba

Please sign in to comment.