diff --git a/datascience-notebook/hooks/apply_tags b/datascience-notebook/hooks/apply_tags new file mode 100644 index 0000000000..699120d3a6 --- /dev/null +++ b/datascience-notebook/hooks/apply_tags @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +# Tag the latest build with the short git sha as well as version of key runtimes +# and packages. +GIT_SHA_TAG=${SOURCE_COMMIT:0:12} +docker tag $IMAGE_NAME "$DOCKER_REPO:$GIT_SHA_TAG" +PY_VERSION_TAG="python-$(docker run --rm ${IMAGE_NAME} python --version 2>&1 | awk '{print $2}')" +docker tag $IMAGE_NAME "$DOCKER_REPO:$PY_VERSION_TAG" +R_VERSION_TAG=="r-$(docker run --rm -a STDOUT ${IMAGE_NAME} R --version | sed -n 1p | awk '{print $3}')" +docker tag $IMAGE_NAME "$DOCKER_REPO:${R_VERSION_TAG%%\r}" +JULIA_VERSION_TAG=="julia-$(docker run --rm -a STDOUT ${IMAGE_NAME} julia --version | awk '{print $3}')" +docker tag $IMAGE_NAME "$DOCKER_REPO:${JULIA_VERSION_TAG%%\r}" +NB_VERSION_TAG="notebook-$(docker run --rm -a STDOUT ${IMAGE_NAME} jupyter-notebook --version | tr -d '\r')" +docker tag $IMAGE_NAME "$DOCKER_REPO:${NB_VERSION_TAG%% }" +LAB_VERSION_TAG="lab-$(docker run --rm -a STDOUT ${IMAGE_NAME} jupyter-lab --version | tr -d '\r')" +docker tag $IMAGE_NAME "$DOCKER_REPO:${LAB_VERSION_TAG%%\r}" +HUB_VERSION_TAG="hub-$(docker run --rm -a STDOUT ${IMAGE_NAME} jupyterhub --version | tr -d '\r')" +docker tag $IMAGE_NAME "$DOCKER_REPO:${HUB_VERSION_TAG%%\r}" diff --git a/datascience-notebook/hooks/post_push b/datascience-notebook/hooks/post_push index 1f9f191457..220afebed6 100755 --- a/datascience-notebook/hooks/post_push +++ b/datascience-notebook/hooks/post_push @@ -1,6 +1,10 @@ #!/bin/bash set -e +# Apply and push all tags +source hooks/apply_tags +docker push $DOCKER_REPO + # Tag the latest build with the short git sha. Push the tag in addition # to the "latest" tag already pushed. GIT_SHA_TAG=${SOURCE_COMMIT:0:12} @@ -48,4 +52,4 @@ set +e for url in $(echo $NEXT_BUILD_TRIGGERS | sed "s/,/ /g") do curl -X POST $url -done \ No newline at end of file +done