diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ec04c8ab..971744c2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,8 +13,21 @@ jobs: name: Build Docker Images runs-on: ubuntu-latest steps: - - name: Checkout Repo + - name: Clone Main Repo uses: actions/checkout@v2 + - name: Debug + run: | + pwd + ls -al + - name: Clone Wiki + uses: actions/checkout@v2 + with: + repository: ${{github.repository}}.wiki + path: "${{github.repository}}.wiki" + - name: Debug + run: | + pwd + ls -al - name: Set Up Python uses: actions/setup-python@v2 with: @@ -25,10 +38,13 @@ jobs: make dev-env lint-install - name: Lint Dockerfiles run: make lint-all - - name: Debug python - run: which pytest - name: Build Docker Images - run: make build-test-all + run: make build/base-notebook test/base-notebook # build-test-all + - name: Run Post-Build Hooks + run: make hook/base-notebook #hooks-all + env: + COMMIT_MSG: "${{github.event.head_commit.message}}" + WIKI_PATH: "${{runner.temp}}/${{github.repository}}.wiki" push: name: Push Docker Images @@ -37,5 +53,11 @@ jobs: - build if: github.ref == 'refs/heads/master' steps: - - name: TODO - run: echo "todo" + - name: Push Images + run: make push-all + # TODO: doesn't support working directory + - name: Push Wiki + uses: mikeal/publish-to-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{github.repository}}.wiki diff --git a/Makefile b/Makefile index 5ab9caf1..a479e389 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,18 @@ dev/%: ## run a foreground container for a stack dev-env: ## install libraries required to build docs and run tests pip install -r requirements-dev.txt +hook/%: export COMMIT_MSG?=$(shell git log -1 --pretty=%B) +hook/%: export GITHUB_SHA?=$(shell git rev-parse HEAD) +hook/%: export WIKI_PATH?=./wiki +hook/%: ## run post-build hooks for an image + BUILD_TIMESTAMP="$$(date -u +%FT%TZ)" \ + DOCKER_REPO="$(OWNER)/$(notdir $@)" \ + IMAGE_NAME="$(OWNER)/$(notdir $@):latest" \ + IMAGE_SHORT_NAME="$(notdir $@)" \ + $(SHELL) $(notdir $@)/hooks/run_hook + +hook-all: $(foreach I,$(ALL_IMAGES),hook/$(I) ) ## run post-build hooks for all images + lint/%: ARGS?= lint/%: ## lint the dockerfile(s) for a stack @echo "Linting Dockerfiles in $(notdir $@)..." @@ -121,6 +133,12 @@ pull/%: DARGS?= pull/%: ## pull a jupyter image docker pull $(DARGS) $(OWNER)/$(notdir $@) +push/%: DARGS?= +push/%: ## push all tags for a jupyter image + docker push $(DARGS) $(OWNER)/$(notdir $@) + +push-all: $(foreach I,$(ALL_IMAGES),push/$(I) ) ## push all tagged images + run/%: DARGS?= run/%: ## run a bash in interactive mode in a stack docker run -it --rm $(DARGS) $(OWNER)/$(notdir $@) $(SHELL) @@ -129,22 +147,8 @@ run-sudo/%: DARGS?= run-sudo/%: ## run a bash in interactive mode as root in a stack docker run -it --rm -u root $(DARGS) $(OWNER)/$(notdir $@) $(SHELL) -tx-en: ## rebuild en locale strings and push to master (req: GH_TOKEN) - @git config --global user.email "travis@travis-ci.org" - @git config --global user.name "Travis CI" - @git checkout master - - @make -C docs clean gettext - @cd docs && sphinx-intl update -p _build/gettext -l en - - @git add docs/locale/en - @git commit -m "[ci skip] Update en source strings (build: $$TRAVIS_JOB_NUMBER)" - - @git remote add origin-tx https://$${GH_TOKEN}@github.com/jupyter/docker-stacks.git - @git push -u origin-tx master - test/%: ## run tests against a stack (only common tests or common tests + specific tests) @if [ ! -d "$(notdir $@)/test" ]; then TEST_IMAGE="$(OWNER)/$(notdir $@)" pytest -m "not info" test; \ else TEST_IMAGE="$(OWNER)/$(notdir $@)" pytest -m "not info" test $(notdir $@)/test; fi -test-all: $(foreach I,$(ALL_IMAGES),test/$(I)) ## test all stacks +test-all: $(foreach I,$(ALL_IMAGES),test/$(I)) ## test all stacks \ No newline at end of file diff --git a/all-spark-notebook/hooks/index.tmpl b/all-spark-notebook/hooks/index.tmpl deleted file mode 100644 index fb2c6056..00000000 --- a/all-spark-notebook/hooks/index.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" -sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE" \ No newline at end of file diff --git a/all-spark-notebook/hooks/post_push b/all-spark-notebook/hooks/post_push deleted file mode 100755 index 1f9f1914..00000000 --- a/all-spark-notebook/hooks/post_push +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -e - -# 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} -docker tag $IMAGE_NAME $DOCKER_REPO:$GIT_SHA_TAG -docker push $DOCKER_REPO:$GIT_SHA_TAG - -# Create a working directory. -BUILD_TIMESTAMP=$(date -u +%FT%TZ) -WORKDIR=$(mktemp -d) -GIT_URI="git@github.com:jupyter/docker-stacks.wiki.git" -GIT_SANDBOX="${WORKDIR}/docker-stacks.wiki" -IMAGE_SHORT_NAME=$(basename $DOCKER_REPO) -MANIFEST_FILE="${GIT_SANDBOX}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" -INDEX_FILE="${GIT_SANDBOX}/Home.md" - -# Configure git so it can push back to GitHub. -eval $(ssh-agent -s) -ssh-add <(base64 -d <(echo "$DEPLOY_KEY")) -ssh-add -l -git config --global user.email "jupyter@googlegroups.com" -git config --global user.name "Jupyter Docker Stacks" - -# Glone the GitHub project wiki. -pushd "$WORKDIR" -git clone "$GIT_URI" -popd - -# Render the build manifest template. -mkdir -p $(dirname "$MANIFEST_FILE") -source hooks/manifest.tmpl -source hooks/index.tmpl - -# Push the wiki update back to GitHub. -pushd "$GIT_SANDBOX" -git add . -git commit -m "DOC: Build ${MANIFEST_FILE}" -git push -u origin master -popd - -# Shutdown the ssh agent for good measure. -ssh-agent -k - -# Invoke all downstream build triggers. -set +e -for url in $(echo $NEXT_BUILD_TRIGGERS | sed "s/,/ /g") -do - curl -X POST $url -done \ No newline at end of file diff --git a/all-spark-notebook/hooks/manifest.tmpl b/all-spark-notebook/hooks/run_hook old mode 100644 new mode 100755 similarity index 53% rename from all-spark-notebook/hooks/manifest.tmpl rename to all-spark-notebook/hooks/run_hook index 69610a25..4081da99 --- a/all-spark-notebook/hooks/manifest.tmpl +++ b/all-spark-notebook/hooks/run_hook @@ -1,9 +1,24 @@ +#!/bin/bash +set -e + +# Apply tags +GIT_SHA_TAG=${GITHUB_SHA:0:12} +docker tag $IMAGE_NAME "$DOCKER_REPO:$GIT_SHA_TAG" + +# Update index +INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" +sed "/|-|/a ${INDEX_ROW}" -i "${WIKI_PATH}/Home.md" + +# Build manifest +MANIFEST_FILE="${WIKI_PATH}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" +mkdir -p $(dirname "$MANIFEST_FILE") + cat << EOF > "$MANIFEST_FILE" * Build datetime: ${BUILD_TIMESTAMP} * DockerHub build code: ${BUILD_CODE} * Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} * Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") -* Git commit SHA: [${SOURCE_COMMIT}](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT}) +* Git commit SHA: [${GITHUB_SHA}](https://github.com/jupyter/docker-stacks/commit/${GITHUB_SHA}) * Git commit message: \`\`\` ${COMMIT_MSG} diff --git a/base-notebook/hooks/apply_tags b/base-notebook/hooks/apply_tags deleted file mode 100644 index 580fae97..00000000 --- a/base-notebook/hooks/apply_tags +++ /dev/null @@ -1,15 +0,0 @@ -#!/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" -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}" \ No newline at end of file diff --git a/base-notebook/hooks/index.tmpl b/base-notebook/hooks/index.tmpl deleted file mode 100644 index c6f8f897..00000000 --- a/base-notebook/hooks/index.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${PY_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${NB_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${LAB_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${HUB_VERSION_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" -sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE" \ No newline at end of file diff --git a/base-notebook/hooks/manifest.tmpl b/base-notebook/hooks/manifest.tmpl deleted file mode 100644 index 378a94cb..00000000 --- a/base-notebook/hooks/manifest.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -cat << EOF > "$MANIFEST_FILE" -* Build datetime: ${BUILD_TIMESTAMP} -* DockerHub build code: ${BUILD_CODE} -* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} -* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") -* Git commit SHA: [${SOURCE_COMMIT}](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT}) -* Git commit message: -\`\`\` -${COMMIT_MSG} -\`\`\` - -## Python Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} python --version) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda info) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda list) -\`\`\` - -## Apt Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} apt list --installed) -\`\`\` -EOF \ No newline at end of file diff --git a/base-notebook/hooks/post_checkout b/base-notebook/hooks/post_checkout deleted file mode 100644 index b72ed53b..00000000 --- a/base-notebook/hooks/post_checkout +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -if [[ "$COMMIT_MSG" = *"skip ci"* || "$COMMIT_MSG" = *"ci skip"* ]]; then - exit 1; -fi \ No newline at end of file diff --git a/base-notebook/hooks/post_push b/base-notebook/hooks/post_push deleted file mode 100755 index 07c18214..00000000 --- a/base-notebook/hooks/post_push +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -set -e - -# Apply and push all tags -source hooks/apply_tags -docker push $DOCKER_REPO - -# Create a working directory. -BUILD_TIMESTAMP=$(date -u +%FT%TZ) -WORKDIR=$(mktemp -d) -GIT_URI="git@github.com:jupyter/docker-stacks.wiki.git" -GIT_SANDBOX="${WORKDIR}/docker-stacks.wiki" -IMAGE_SHORT_NAME=$(basename $DOCKER_REPO) -MANIFEST_FILE="${GIT_SANDBOX}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" -INDEX_FILE="${GIT_SANDBOX}/Home.md" - -# Configure git so it can push back to GitHub. -eval $(ssh-agent -s) -ssh-add <(base64 -d <(echo "$DEPLOY_KEY")) -ssh-add -l -git config --global user.email "jupyter@googlegroups.com" -git config --global user.name "Jupyter Docker Stacks" - -# Glone the GitHub project wiki. -pushd "$WORKDIR" -git clone "$GIT_URI" -popd - -# Render the build manifest template. -mkdir -p $(dirname "$MANIFEST_FILE") -source hooks/manifest.tmpl -source hooks/index.tmpl - -# Push the wiki update back to GitHub. -pushd "$GIT_SANDBOX" -git add . -git commit -m "DOC: Build ${MANIFEST_FILE}" -git push -u origin master -popd - -# Shutdown the ssh agent for good measure. -ssh-agent -k - -# Invoke all downstream build triggers. -set +e -for url in $(echo $NEXT_BUILD_TRIGGERS | sed "s/,/ /g") -do - curl -X POST $url -done \ No newline at end of file diff --git a/base-notebook/hooks/run_hook b/base-notebook/hooks/run_hook new file mode 100755 index 00000000..8704721c --- /dev/null +++ b/base-notebook/hooks/run_hook @@ -0,0 +1,56 @@ +#!/bin/bash +set -e + +# Apply tags +GIT_SHA_TAG=${GITHUB_SHA: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" +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}" + +# Update index +INDEX_FILE="${WIKI_PATH}/Home.md" +INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${PY_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${NB_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${LAB_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${HUB_VERSION_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" +sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE" +head -n 25 "$INDEX_FILE" + +# Build manifest +MANIFEST_FILE="${WIKI_PATH}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" +mkdir -p $(dirname "$MANIFEST_FILE") +cat << EOF > "$MANIFEST_FILE" +* Build datetime: ${BUILD_TIMESTAMP} +* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} +* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") +* Git commit SHA: [${GITHUB_SHA}](https://github.com/jupyter/docker-stacks/commit/${GITHUB_SHA}) +* Git commit message: +\`\`\` +${COMMIT_MSG} +\`\`\` + +## Python Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} python --version) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda info) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda list) +\`\`\` + +## Apt Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} apt list --installed) +\`\`\` +EOF + +cat "$MANIFEST_FILE" \ No newline at end of file diff --git a/datascience-notebook/hooks/apply_tags b/datascience-notebook/hooks/apply_tags deleted file mode 100644 index f219d585..00000000 --- a/datascience-notebook/hooks/apply_tags +++ /dev/null @@ -1,19 +0,0 @@ -#!/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/index.tmpl b/datascience-notebook/hooks/index.tmpl deleted file mode 100644 index 27b81060..00000000 --- a/datascience-notebook/hooks/index.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${PY_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${JULIA_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${R_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${NB_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${LAB_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${HUB_VERSION_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" -sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE" \ No newline at end of file diff --git a/datascience-notebook/hooks/manifest.tmpl b/datascience-notebook/hooks/manifest.tmpl deleted file mode 100644 index 1eb525fe..00000000 --- a/datascience-notebook/hooks/manifest.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -cat << EOF > "$MANIFEST_FILE" -* Build datetime: ${BUILD_TIMESTAMP} -* DockerHub build code: ${BUILD_CODE} -* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} -* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") -* Git commit SHA: [${SOURCE_COMMIT}](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT}) -* Git commit message: -\`\`\` -${COMMIT_MSG} -\`\`\` - -## Julia Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} julia -E 'using InteractiveUtils; versioninfo()') -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} julia -E 'import Pkg; Pkg.status()') -\`\`\` - -## Python Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} python --version) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda info) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda list) -\`\`\` - -## R Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} R --version) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} R --silent -e 'installed.packages(.Library)[, c(1,3)]') -\`\`\` - -## Apt Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} apt list --installed) -\`\`\` -EOF \ No newline at end of file diff --git a/datascience-notebook/hooks/post_push b/datascience-notebook/hooks/post_push deleted file mode 100755 index 220afebe..00000000 --- a/datascience-notebook/hooks/post_push +++ /dev/null @@ -1,55 +0,0 @@ -#!/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} -docker tag $IMAGE_NAME $DOCKER_REPO:$GIT_SHA_TAG -docker push $DOCKER_REPO:$GIT_SHA_TAG - -# Create a working directory. -BUILD_TIMESTAMP=$(date -u +%FT%TZ) -WORKDIR=$(mktemp -d) -GIT_URI="git@github.com:jupyter/docker-stacks.wiki.git" -GIT_SANDBOX="${WORKDIR}/docker-stacks.wiki" -IMAGE_SHORT_NAME=$(basename $DOCKER_REPO) -MANIFEST_FILE="${GIT_SANDBOX}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" -INDEX_FILE="${GIT_SANDBOX}/Home.md" - -# Configure git so it can push back to GitHub. -eval $(ssh-agent -s) -ssh-add <(base64 -d <(echo "$DEPLOY_KEY")) -ssh-add -l -git config --global user.email "jupyter@googlegroups.com" -git config --global user.name "Jupyter Docker Stacks" - -# Glone the GitHub project wiki. -pushd "$WORKDIR" -git clone "$GIT_URI" -popd - -# Render the build manifest template. -mkdir -p $(dirname "$MANIFEST_FILE") -source hooks/manifest.tmpl -source hooks/index.tmpl - -# Push the wiki update back to GitHub. -pushd "$GIT_SANDBOX" -git add . -git commit -m "DOC: Build ${MANIFEST_FILE}" -git push -u origin master -popd - -# Shutdown the ssh agent for good measure. -ssh-agent -k - -# Invoke all downstream build triggers. -set +e -for url in $(echo $NEXT_BUILD_TRIGGERS | sed "s/,/ /g") -do - curl -X POST $url -done diff --git a/datascience-notebook/hooks/run_hook b/datascience-notebook/hooks/run_hook new file mode 100755 index 00000000..2877dfb0 --- /dev/null +++ b/datascience-notebook/hooks/run_hook @@ -0,0 +1,78 @@ +#!/bin/bash +set -e + +# Apply tags +GIT_SHA_TAG=${GITHUB_SHA: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}" + + +# Update index +INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${PY_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${JULIA_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${R_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${NB_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${LAB_VERSION_TAG}\`
\`jupyter/${IMAGE_SHORT_NAME}:${HUB_VERSION_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" +sed "/|-|/a ${INDEX_ROW}" -i "${WIKI_PATH}/Home.md" + +# Build manifest +MANIFEST_FILE="${WIKI_PATH}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" +mkdir -p $(dirname "$MANIFEST_FILE") + +cat << EOF > "$MANIFEST_FILE" +* Build datetime: ${BUILD_TIMESTAMP} +* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} +* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") +* Git commit SHA: [${GITHUB_SHA}](https://github.com/jupyter/docker-stacks/commit/${GITHUB_SHA}) +* Git commit message: +\`\`\` +${COMMIT_MSG} +\`\`\` + +## Julia Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} julia -E 'using InteractiveUtils; versioninfo()') +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} julia -E 'import Pkg; Pkg.status()') +\`\`\` + +## Python Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} python --version) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda info) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda list) +\`\`\` + +## R Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} R --version) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} R --silent -e 'installed.packages(.Library)[, c(1,3)]') +\`\`\` + +## Apt Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} apt list --installed) +\`\`\` +EOF \ No newline at end of file diff --git a/minimal-notebook/hooks/index.tmpl b/minimal-notebook/hooks/index.tmpl deleted file mode 100644 index fb2c6056..00000000 --- a/minimal-notebook/hooks/index.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" -sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE" \ No newline at end of file diff --git a/minimal-notebook/hooks/manifest.tmpl b/minimal-notebook/hooks/manifest.tmpl deleted file mode 100644 index 378a94cb..00000000 --- a/minimal-notebook/hooks/manifest.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -cat << EOF > "$MANIFEST_FILE" -* Build datetime: ${BUILD_TIMESTAMP} -* DockerHub build code: ${BUILD_CODE} -* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} -* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") -* Git commit SHA: [${SOURCE_COMMIT}](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT}) -* Git commit message: -\`\`\` -${COMMIT_MSG} -\`\`\` - -## Python Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} python --version) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda info) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda list) -\`\`\` - -## Apt Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} apt list --installed) -\`\`\` -EOF \ No newline at end of file diff --git a/minimal-notebook/hooks/post_push b/minimal-notebook/hooks/post_push deleted file mode 100755 index 1f9f1914..00000000 --- a/minimal-notebook/hooks/post_push +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -e - -# 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} -docker tag $IMAGE_NAME $DOCKER_REPO:$GIT_SHA_TAG -docker push $DOCKER_REPO:$GIT_SHA_TAG - -# Create a working directory. -BUILD_TIMESTAMP=$(date -u +%FT%TZ) -WORKDIR=$(mktemp -d) -GIT_URI="git@github.com:jupyter/docker-stacks.wiki.git" -GIT_SANDBOX="${WORKDIR}/docker-stacks.wiki" -IMAGE_SHORT_NAME=$(basename $DOCKER_REPO) -MANIFEST_FILE="${GIT_SANDBOX}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" -INDEX_FILE="${GIT_SANDBOX}/Home.md" - -# Configure git so it can push back to GitHub. -eval $(ssh-agent -s) -ssh-add <(base64 -d <(echo "$DEPLOY_KEY")) -ssh-add -l -git config --global user.email "jupyter@googlegroups.com" -git config --global user.name "Jupyter Docker Stacks" - -# Glone the GitHub project wiki. -pushd "$WORKDIR" -git clone "$GIT_URI" -popd - -# Render the build manifest template. -mkdir -p $(dirname "$MANIFEST_FILE") -source hooks/manifest.tmpl -source hooks/index.tmpl - -# Push the wiki update back to GitHub. -pushd "$GIT_SANDBOX" -git add . -git commit -m "DOC: Build ${MANIFEST_FILE}" -git push -u origin master -popd - -# Shutdown the ssh agent for good measure. -ssh-agent -k - -# Invoke all downstream build triggers. -set +e -for url in $(echo $NEXT_BUILD_TRIGGERS | sed "s/,/ /g") -do - curl -X POST $url -done \ No newline at end of file diff --git a/minimal-notebook/hooks/run_hook b/minimal-notebook/hooks/run_hook new file mode 100755 index 00000000..4575a2d2 --- /dev/null +++ b/minimal-notebook/hooks/run_hook @@ -0,0 +1,45 @@ +#!/bin/bash +set -e + +# Apply tags +GIT_SHA_TAG=${GITHUB_SHA:0:12} +docker tag $IMAGE_NAME "$DOCKER_REPO:$GIT_SHA_TAG" + +# Update index +INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" +sed "/|-|/a ${INDEX_ROW}" -i "${WIKI_PATH}/Home.md" + +# Build manifest +MANIFEST_FILE="${WIKI_PATH}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" +mkdir -p $(dirname "$MANIFEST_FILE") + +cat << EOF > "$MANIFEST_FILE" +* Build datetime: ${BUILD_TIMESTAMP} +* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} +* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") +* Git commit SHA: [${GITHUB_SHA}](https://github.com/jupyter/docker-stacks/commit/${GITHUB_SHA}) +* Git commit message: +\`\`\` +${COMMIT_MSG} +\`\`\` + +## Python Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} python --version) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda info) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda list) +\`\`\` + +## Apt Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} apt list --installed) +\`\`\` +EOF \ No newline at end of file diff --git a/pyspark-notebook/hooks/index.tmpl b/pyspark-notebook/hooks/index.tmpl deleted file mode 100644 index fb2c6056..00000000 --- a/pyspark-notebook/hooks/index.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" -sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE" \ No newline at end of file diff --git a/pyspark-notebook/hooks/manifest.tmpl b/pyspark-notebook/hooks/manifest.tmpl deleted file mode 100644 index e1058b95..00000000 --- a/pyspark-notebook/hooks/manifest.tmpl +++ /dev/null @@ -1,37 +0,0 @@ -cat << EOF > "$MANIFEST_FILE" -* Build datetime: ${BUILD_TIMESTAMP} -* DockerHub build code: ${BUILD_CODE} -* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} -* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") -* Git commit SHA: [${SOURCE_COMMIT}](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT}) -* Git commit message: -\`\`\` -${COMMIT_MSG} -\`\`\` - -## Apache Spark - -\`\`\` -$(docker run --rm ${IMAGE_NAME} bash -c '$SPARK_HOME/bin/spark-submit --version' 2>&1) -\`\`\` - -## Python Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} python --version) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda info) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda list) -\`\`\` - -## Apt Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} apt list --installed) -\`\`\` -EOF \ No newline at end of file diff --git a/pyspark-notebook/hooks/post_push b/pyspark-notebook/hooks/post_push deleted file mode 100755 index 1f9f1914..00000000 --- a/pyspark-notebook/hooks/post_push +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -e - -# 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} -docker tag $IMAGE_NAME $DOCKER_REPO:$GIT_SHA_TAG -docker push $DOCKER_REPO:$GIT_SHA_TAG - -# Create a working directory. -BUILD_TIMESTAMP=$(date -u +%FT%TZ) -WORKDIR=$(mktemp -d) -GIT_URI="git@github.com:jupyter/docker-stacks.wiki.git" -GIT_SANDBOX="${WORKDIR}/docker-stacks.wiki" -IMAGE_SHORT_NAME=$(basename $DOCKER_REPO) -MANIFEST_FILE="${GIT_SANDBOX}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" -INDEX_FILE="${GIT_SANDBOX}/Home.md" - -# Configure git so it can push back to GitHub. -eval $(ssh-agent -s) -ssh-add <(base64 -d <(echo "$DEPLOY_KEY")) -ssh-add -l -git config --global user.email "jupyter@googlegroups.com" -git config --global user.name "Jupyter Docker Stacks" - -# Glone the GitHub project wiki. -pushd "$WORKDIR" -git clone "$GIT_URI" -popd - -# Render the build manifest template. -mkdir -p $(dirname "$MANIFEST_FILE") -source hooks/manifest.tmpl -source hooks/index.tmpl - -# Push the wiki update back to GitHub. -pushd "$GIT_SANDBOX" -git add . -git commit -m "DOC: Build ${MANIFEST_FILE}" -git push -u origin master -popd - -# Shutdown the ssh agent for good measure. -ssh-agent -k - -# Invoke all downstream build triggers. -set +e -for url in $(echo $NEXT_BUILD_TRIGGERS | sed "s/,/ /g") -do - curl -X POST $url -done \ No newline at end of file diff --git a/pyspark-notebook/hooks/run_hook b/pyspark-notebook/hooks/run_hook new file mode 100755 index 00000000..4a5f3d04 --- /dev/null +++ b/pyspark-notebook/hooks/run_hook @@ -0,0 +1,51 @@ +#!/bin/bash +set -e + +# Apply tags +GIT_SHA_TAG=${GITHUB_SHA:0:12} +docker tag $IMAGE_NAME "$DOCKER_REPO:$GIT_SHA_TAG" + +# Update index +INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" +sed "/|-|/a ${INDEX_ROW}" -i "${WIKI_PATH}/Home.md" + +# Build manifest +MANIFEST_FILE="${WIKI_PATH}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" +mkdir -p $(dirname "$MANIFEST_FILE") + +cat << EOF > "$MANIFEST_FILE" +* Build datetime: ${BUILD_TIMESTAMP} +* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} +* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") +* Git commit SHA: [${GITHUB_SHA}](https://github.com/jupyter/docker-stacks/commit/${GITHUB_SHA}) +* Git commit message: +\`\`\` +${COMMIT_MSG} +\`\`\` + +## Apache Spark + +\`\`\` +$(docker run --rm ${IMAGE_NAME} bash -c '$SPARK_HOME/bin/spark-submit --version' 2>&1) +\`\`\` + +## Python Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} python --version) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda info) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda list) +\`\`\` + +## Apt Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} apt list --installed) +\`\`\` +EOF \ No newline at end of file diff --git a/r-notebook/hooks/index.tmpl b/r-notebook/hooks/index.tmpl deleted file mode 100644 index fb2c6056..00000000 --- a/r-notebook/hooks/index.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" -sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE" \ No newline at end of file diff --git a/r-notebook/hooks/manifest.tmpl b/r-notebook/hooks/manifest.tmpl deleted file mode 100644 index 63f72a8f..00000000 --- a/r-notebook/hooks/manifest.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -cat << EOF > "$MANIFEST_FILE" -* Build datetime: ${BUILD_TIMESTAMP} -* DockerHub build code: ${BUILD_CODE} -* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} -* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") -* Git commit SHA: [${SOURCE_COMMIT}](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT}) -* Git commit message: -\`\`\` -${COMMIT_MSG} -\`\`\` - -## R Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} R --version) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} R --silent -e 'installed.packages(.Library)[, c(1,3)]') -\`\`\` - -## Python Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} python --version) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda info) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda list) -\`\`\` - -## Apt Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} apt list --installed) -\`\`\` -EOF \ No newline at end of file diff --git a/r-notebook/hooks/post_push b/r-notebook/hooks/post_push deleted file mode 100755 index 1f9f1914..00000000 --- a/r-notebook/hooks/post_push +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -e - -# 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} -docker tag $IMAGE_NAME $DOCKER_REPO:$GIT_SHA_TAG -docker push $DOCKER_REPO:$GIT_SHA_TAG - -# Create a working directory. -BUILD_TIMESTAMP=$(date -u +%FT%TZ) -WORKDIR=$(mktemp -d) -GIT_URI="git@github.com:jupyter/docker-stacks.wiki.git" -GIT_SANDBOX="${WORKDIR}/docker-stacks.wiki" -IMAGE_SHORT_NAME=$(basename $DOCKER_REPO) -MANIFEST_FILE="${GIT_SANDBOX}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" -INDEX_FILE="${GIT_SANDBOX}/Home.md" - -# Configure git so it can push back to GitHub. -eval $(ssh-agent -s) -ssh-add <(base64 -d <(echo "$DEPLOY_KEY")) -ssh-add -l -git config --global user.email "jupyter@googlegroups.com" -git config --global user.name "Jupyter Docker Stacks" - -# Glone the GitHub project wiki. -pushd "$WORKDIR" -git clone "$GIT_URI" -popd - -# Render the build manifest template. -mkdir -p $(dirname "$MANIFEST_FILE") -source hooks/manifest.tmpl -source hooks/index.tmpl - -# Push the wiki update back to GitHub. -pushd "$GIT_SANDBOX" -git add . -git commit -m "DOC: Build ${MANIFEST_FILE}" -git push -u origin master -popd - -# Shutdown the ssh agent for good measure. -ssh-agent -k - -# Invoke all downstream build triggers. -set +e -for url in $(echo $NEXT_BUILD_TRIGGERS | sed "s/,/ /g") -do - curl -X POST $url -done \ No newline at end of file diff --git a/r-notebook/hooks/run_hook b/r-notebook/hooks/run_hook new file mode 100755 index 00000000..9ef33976 --- /dev/null +++ b/r-notebook/hooks/run_hook @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +# Apply tags +GIT_SHA_TAG=${GITHUB_SHA:0:12} +docker tag $IMAGE_NAME "$DOCKER_REPO:$GIT_SHA_TAG" + +# Update index +INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" +sed "/|-|/a ${INDEX_ROW}" -i "${WIKI_PATH}/Home.md" + +# Build manifest +MANIFEST_FILE="${WIKI_PATH}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" +mkdir -p $(dirname "$MANIFEST_FILE") + +cat << EOF > "$MANIFEST_FILE" +* Build datetime: ${BUILD_TIMESTAMP} +* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} +* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") +* Git commit SHA: [${GITHUB_SHA}](https://github.com/jupyter/docker-stacks/commit/${GITHUB_SHA}) +* Git commit message: +\`\`\` +${COMMIT_MSG} +\`\`\` + +## R Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} R --version) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} R --silent -e 'installed.packages(.Library)[, c(1,3)]') +\`\`\` + +## Python Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} python --version) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda info) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda list) +\`\`\` + +## Apt Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} apt list --installed) +\`\`\` +EOF \ No newline at end of file diff --git a/scipy-notebook/hooks/index.tmpl b/scipy-notebook/hooks/index.tmpl deleted file mode 100644 index fb2c6056..00000000 --- a/scipy-notebook/hooks/index.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" -sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE" \ No newline at end of file diff --git a/scipy-notebook/hooks/manifest.tmpl b/scipy-notebook/hooks/manifest.tmpl deleted file mode 100644 index 378a94cb..00000000 --- a/scipy-notebook/hooks/manifest.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -cat << EOF > "$MANIFEST_FILE" -* Build datetime: ${BUILD_TIMESTAMP} -* DockerHub build code: ${BUILD_CODE} -* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} -* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") -* Git commit SHA: [${SOURCE_COMMIT}](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT}) -* Git commit message: -\`\`\` -${COMMIT_MSG} -\`\`\` - -## Python Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} python --version) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda info) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda list) -\`\`\` - -## Apt Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} apt list --installed) -\`\`\` -EOF \ No newline at end of file diff --git a/scipy-notebook/hooks/post_push b/scipy-notebook/hooks/post_push deleted file mode 100755 index 1f9f1914..00000000 --- a/scipy-notebook/hooks/post_push +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -e - -# 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} -docker tag $IMAGE_NAME $DOCKER_REPO:$GIT_SHA_TAG -docker push $DOCKER_REPO:$GIT_SHA_TAG - -# Create a working directory. -BUILD_TIMESTAMP=$(date -u +%FT%TZ) -WORKDIR=$(mktemp -d) -GIT_URI="git@github.com:jupyter/docker-stacks.wiki.git" -GIT_SANDBOX="${WORKDIR}/docker-stacks.wiki" -IMAGE_SHORT_NAME=$(basename $DOCKER_REPO) -MANIFEST_FILE="${GIT_SANDBOX}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" -INDEX_FILE="${GIT_SANDBOX}/Home.md" - -# Configure git so it can push back to GitHub. -eval $(ssh-agent -s) -ssh-add <(base64 -d <(echo "$DEPLOY_KEY")) -ssh-add -l -git config --global user.email "jupyter@googlegroups.com" -git config --global user.name "Jupyter Docker Stacks" - -# Glone the GitHub project wiki. -pushd "$WORKDIR" -git clone "$GIT_URI" -popd - -# Render the build manifest template. -mkdir -p $(dirname "$MANIFEST_FILE") -source hooks/manifest.tmpl -source hooks/index.tmpl - -# Push the wiki update back to GitHub. -pushd "$GIT_SANDBOX" -git add . -git commit -m "DOC: Build ${MANIFEST_FILE}" -git push -u origin master -popd - -# Shutdown the ssh agent for good measure. -ssh-agent -k - -# Invoke all downstream build triggers. -set +e -for url in $(echo $NEXT_BUILD_TRIGGERS | sed "s/,/ /g") -do - curl -X POST $url -done \ No newline at end of file diff --git a/scipy-notebook/hooks/run_hook b/scipy-notebook/hooks/run_hook new file mode 100755 index 00000000..4575a2d2 --- /dev/null +++ b/scipy-notebook/hooks/run_hook @@ -0,0 +1,45 @@ +#!/bin/bash +set -e + +# Apply tags +GIT_SHA_TAG=${GITHUB_SHA:0:12} +docker tag $IMAGE_NAME "$DOCKER_REPO:$GIT_SHA_TAG" + +# Update index +INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" +sed "/|-|/a ${INDEX_ROW}" -i "${WIKI_PATH}/Home.md" + +# Build manifest +MANIFEST_FILE="${WIKI_PATH}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" +mkdir -p $(dirname "$MANIFEST_FILE") + +cat << EOF > "$MANIFEST_FILE" +* Build datetime: ${BUILD_TIMESTAMP} +* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} +* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") +* Git commit SHA: [${GITHUB_SHA}](https://github.com/jupyter/docker-stacks/commit/${GITHUB_SHA}) +* Git commit message: +\`\`\` +${COMMIT_MSG} +\`\`\` + +## Python Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} python --version) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda info) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda list) +\`\`\` + +## Apt Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} apt list --installed) +\`\`\` +EOF \ No newline at end of file diff --git a/tensorflow-notebook/hooks/index.tmpl b/tensorflow-notebook/hooks/index.tmpl deleted file mode 100644 index fb2c6056..00000000 --- a/tensorflow-notebook/hooks/index.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" -sed "/|-|/a ${INDEX_ROW}" -i "$INDEX_FILE" \ No newline at end of file diff --git a/tensorflow-notebook/hooks/manifest.tmpl b/tensorflow-notebook/hooks/manifest.tmpl deleted file mode 100644 index 378a94cb..00000000 --- a/tensorflow-notebook/hooks/manifest.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -cat << EOF > "$MANIFEST_FILE" -* Build datetime: ${BUILD_TIMESTAMP} -* DockerHub build code: ${BUILD_CODE} -* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} -* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") -* Git commit SHA: [${SOURCE_COMMIT}](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT}) -* Git commit message: -\`\`\` -${COMMIT_MSG} -\`\`\` - -## Python Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} python --version) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda info) -\`\`\` - -\`\`\` -$(docker run --rm ${IMAGE_NAME} conda list) -\`\`\` - -## Apt Packages - -\`\`\` -$(docker run --rm ${IMAGE_NAME} apt list --installed) -\`\`\` -EOF \ No newline at end of file diff --git a/tensorflow-notebook/hooks/post_push b/tensorflow-notebook/hooks/post_push deleted file mode 100755 index 1f9f1914..00000000 --- a/tensorflow-notebook/hooks/post_push +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -e - -# 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} -docker tag $IMAGE_NAME $DOCKER_REPO:$GIT_SHA_TAG -docker push $DOCKER_REPO:$GIT_SHA_TAG - -# Create a working directory. -BUILD_TIMESTAMP=$(date -u +%FT%TZ) -WORKDIR=$(mktemp -d) -GIT_URI="git@github.com:jupyter/docker-stacks.wiki.git" -GIT_SANDBOX="${WORKDIR}/docker-stacks.wiki" -IMAGE_SHORT_NAME=$(basename $DOCKER_REPO) -MANIFEST_FILE="${GIT_SANDBOX}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" -INDEX_FILE="${GIT_SANDBOX}/Home.md" - -# Configure git so it can push back to GitHub. -eval $(ssh-agent -s) -ssh-add <(base64 -d <(echo "$DEPLOY_KEY")) -ssh-add -l -git config --global user.email "jupyter@googlegroups.com" -git config --global user.name "Jupyter Docker Stacks" - -# Glone the GitHub project wiki. -pushd "$WORKDIR" -git clone "$GIT_URI" -popd - -# Render the build manifest template. -mkdir -p $(dirname "$MANIFEST_FILE") -source hooks/manifest.tmpl -source hooks/index.tmpl - -# Push the wiki update back to GitHub. -pushd "$GIT_SANDBOX" -git add . -git commit -m "DOC: Build ${MANIFEST_FILE}" -git push -u origin master -popd - -# Shutdown the ssh agent for good measure. -ssh-agent -k - -# Invoke all downstream build triggers. -set +e -for url in $(echo $NEXT_BUILD_TRIGGERS | sed "s/,/ /g") -do - curl -X POST $url -done \ No newline at end of file diff --git a/tensorflow-notebook/hooks/run_hook b/tensorflow-notebook/hooks/run_hook new file mode 100755 index 00000000..4575a2d2 --- /dev/null +++ b/tensorflow-notebook/hooks/run_hook @@ -0,0 +1,45 @@ +#!/bin/bash +set -e + +# Apply tags +GIT_SHA_TAG=${GITHUB_SHA:0:12} +docker tag $IMAGE_NAME "$DOCKER_REPO:$GIT_SHA_TAG" + +# Update index +INDEX_ROW="|\`${BUILD_TIMESTAMP}\`|\`jupyter/${IMAGE_SHORT_NAME}:${GIT_SHA_TAG}\`|[Git diff](https://github.com/jupyter/docker-stacks/commit/${SOURCE_COMMIT})
[Dockerfile](https://github.com/jupyter/docker-stacks/blob/${SOURCE_COMMIT}/${IMAGE_SHORT_NAME}/Dockerfile)
[Build manifest](./${IMAGE_SHORT_NAME}-${GIT_SHA_TAG})|" +sed "/|-|/a ${INDEX_ROW}" -i "${WIKI_PATH}/Home.md" + +# Build manifest +MANIFEST_FILE="${WIKI_PATH}/manifests/${IMAGE_SHORT_NAME}-${GIT_SHA_TAG}.md" +mkdir -p $(dirname "$MANIFEST_FILE") + +cat << EOF > "$MANIFEST_FILE" +* Build datetime: ${BUILD_TIMESTAMP} +* Docker image: ${DOCKER_REPO}:${GIT_SHA_TAG} +* Docker image size: $(docker images ${IMAGE_NAME} --format "{{.Size}}") +* Git commit SHA: [${GITHUB_SHA}](https://github.com/jupyter/docker-stacks/commit/${GITHUB_SHA}) +* Git commit message: +\`\`\` +${COMMIT_MSG} +\`\`\` + +## Python Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} python --version) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda info) +\`\`\` + +\`\`\` +$(docker run --rm ${IMAGE_NAME} conda list) +\`\`\` + +## Apt Packages + +\`\`\` +$(docker run --rm ${IMAGE_NAME} apt list --installed) +\`\`\` +EOF \ No newline at end of file