Skip to content

Commit ff9357a

Browse files
authored
Merge pull request #873 from parente/version-tags
Apply additional tags to base-notebook
2 parents abdb27a + 25e199d commit ff9357a

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
Thanks for for contributing! Please see the [Contributor Guide](https://jupyter-docker-stacks.readthedocs.io) in the
2-
documentation for information about how to contribute [package updates](http://jupyter-docker-stacks.readthedocs.io/en/latest/contributing/packages.html),
1+
Thanks for contributing! Please see the
2+
[Contributor Guide](https://jupyter-docker-stacks.readthedocs.io) in the documentation for
3+
information about how to contribute
4+
[package updates](http://jupyter-docker-stacks.readthedocs.io/en/latest/contributing/packages.html),
35
[recipes](http://jupyter-docker-stacks.readthedocs.io/en/latest/contributing/recipes.html),
46
[tests](http://jupyter-docker-stacks.readthedocs.io/en/latest/contributing/tests.html),
57
[features](http://jupyter-docker-stacks.readthedocs.io/en/latest/contributing/features.html),
6-
and [community-maintained stacks](http://jupyter-docker-stacks.readthedocs.io/en/latest/contributing/stacks.html).
8+
[translations](https://jupyter-docker-stacks.readthedocs.io/en/latest/contributing/translations.html),
9+
and
10+
[community-maintained stacks](http://jupyter-docker-stacks.readthedocs.io/en/latest/contributing/stacks.html).

base-notebook/hooks/apply_tags

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Tag the latest build with the short git sha as well as version of key runtimes
5+
# and packages.
6+
GIT_SHA_TAG=${SOURCE_COMMIT:0:12}
7+
docker tag $IMAGE_NAME "$DOCKER_REPO:$GIT_SHA_TAG"
8+
PY_VERSION_TAG="python-$(docker run --rm ${IMAGE_NAME} python --version 2>&1 | awk '{print $2}')"
9+
docker tag $IMAGE_NAME "$DOCKER_REPO:$PY_VERSION_TAG"
10+
NB_VERSION_TAG="notebook-$(docker run --rm -a STDOUT ${IMAGE_NAME} jupyter-notebook --version | tr -d '\r')"
11+
docker tag $IMAGE_NAME "$DOCKER_REPO:${NB_VERSION_TAG%% }"
12+
LAB_VERSION_TAG="lab-$(docker run --rm -a STDOUT ${IMAGE_NAME} jupyter-lab --version | tr -d '\r')"
13+
docker tag $IMAGE_NAME "$DOCKER_REPO:${LAB_VERSION_TAG%%\r}"
14+
HUB_VERSION_TAG="hub-$(docker run --rm -a STDOUT ${IMAGE_NAME} jupyterhub --version | tr -d '\r')"
15+
docker tag $IMAGE_NAME "$DOCKER_REPO:${HUB_VERSION_TAG%%\r}"

base-notebook/hooks/index.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})<br />[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)<br />[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|"
1+
INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`<br />\`jupyter/${IMAGE_SHORT_NAME}:${PY_VERSION_TAG}\`<br />\`jupyter/${IMAGE_SHORT_NAME}:${NB_VERSION_TAG}\`<br />\`jupyter/${IMAGE_SHORT_NAME}:${LAB_VERSION_TAG}\`<br />\`jupyter/${IMAGE_SHORT_NAME}:${HUB_VERSION_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})<br />[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)<br />[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|"
22
sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE"

base-notebook/hooks/post_push

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/bin/bash
22
set -e
33

4-
# Tag the latest build with the short git sha. Push the tag in addition
5-
# to the "latest" tag already pushed.
6-
GIT_SHA_TAG=${SOURCE_COMMIT:0:12}
7-
docker tag $IMAGE_NAME $DOCKER_REPO:$GIT_SHA_TAG
8-
docker push $DOCKER_REPO:$GIT_SHA_TAG
4+
# Apply and push all tags
5+
source hooks/apply_tags
6+
docker push $DOCKER_REPO
97

108
# Create a working directory.
119
BUILD_TIMESTAMP=$(date -u +%FT%TZ)

0 commit comments

Comments
 (0)