Skip to content

Commit

Permalink
Poster now supports build-time IMAGE_TAG (#46)
Browse files Browse the repository at this point in the history
* - Supports TRAVIS_TAG

- Poster image '1.0.0' now sets Image-Tag header to '1.0.0'
- Removed concept of 'stable' images - not it's just 'latest' and '<tag>'

* - Poster now echos some stuff (importantly the IMAGE_TAG)

Co-authored-by: Alan Christie <alan.christie@matildapeak.com>
  • Loading branch information
alanbchristie and Alan Christie authored Aug 4, 2020
1 parent 2f9ee9d commit 8c47dc2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 26 deletions.
25 changes: 3 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ stages:
if: |
tag IS present \
AND env(PUBLISH_IMAGES) = yes
- name: publish stable
if: |
tag IS present \
AND tag =~ ^([0-9]+\.){1,2}[0-9]+$ \
AND env(PUBLISH_IMAGES) = yes
jobs:
include:
Expand Down Expand Up @@ -64,26 +59,12 @@ jobs:
- stage: publish tag
name: Publish Tagged Image
script:
# Build and push the pipelines-rdkit image and its sd-poster
# Build and push the pipelines-rdkit image and its sd-poster.
# The poster will have its IMAGE_TAG set to TRAVIS_TAG
- docker build -t informaticsmatters/rdkit_pipelines:${TRAVIS_TAG} -f Dockerfile-rdkit .
- docker build -t squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG} -f Dockerfile-sdposter .
- docker build -t squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG} -f Dockerfile-sdposter --build-arg image_tag=${TRAVIS_TAG} .
- if [ -n "$DOCKER_PASSWORD" ]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
docker push informaticsmatters/rdkit_pipelines:${TRAVIS_TAG};
docker push squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG};
fi

- stage: publish stable
name: Publish Stable Image
script:
# Pull the corresponding pipelines-rdkit image tag
# and push it again as 'stable'
- if [ -n "$DOCKER_PASSWORD" ]; then
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
docker pull informaticsmatters/rdkit_pipelines:${TRAVIS_TAG};
docker pull squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG};
docker tag informaticsmatters/rdkit_pipelines:${TRAVIS_TAG} informaticsmatters/rdkit_pipelines:stable;
docker tag squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG} squonk/rdkit-pipelines-sdposter:stable;
docker push informaticsmatters/rdkit_pipelines:stable;
docker push squonk/rdkit-pipelines-sdposter:stable;
fi
9 changes: 9 additions & 0 deletions Dockerfile-sdposter
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
FROM centos:7
MAINTAINER Tim Dudgeon <tdudgeon@informaticsmatters.com>

# The image tag for the pipelines we're expected to post.
# By default this is 'latest' but the build environment can
# use a built-arg to over-ride this.
# So, a poster container image built for Git tag '1.0.0' would be expected
# to have its IMAGE_TAG environment variable set to '1.0.0' and therefore
# running poster:1.0.0 would inject pipelines for container image '1.0.0'
ARG image_tag=latest
ENV IMAGE_TAG=$image_tag

# An image to populate the Core with the contents of the
# Service Descriptors located in SD_SRC.

Expand Down
17 changes: 13 additions & 4 deletions post-service-descriptors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@
set -e

POST=${1:-http://coreservices:8080/coreservices/rest/v1/services}
BASE_D='docker://github.com/InformaticsMatters/pipelines'
BASE_N='nextflow://github.com/InformaticsMatters/pipelines'
BASE_D=docker://github.com/InformaticsMatters/pipelines
BASE_N=nextflow://github.com/InformaticsMatters/pipelines
IMAGE_TAG=${IMAGE_TAG:-}
CT_DJ="application/x-squonk-service-descriptor-docker+json"
CT_DY="application/x-squonk-service-descriptor-docker+yaml"
CT_MM="multipart/mixed"

echo BASE_D="${BASE_D}"
echo BASE_N="${BASE_N}"
echo IMAGE_TAG="${IMAGE_TAG}"

for d in 'src/python/pipelines/dmpk' 'src/python/pipelines/docking' 'src/python/pipelines/rdkit' 'src/python/pipelines/dimorphite'
for d in 'src/python/pipelines/dmpk' \
'src/python/pipelines/docking' \
'src/python/pipelines/rdkit' \
'src/python/pipelines/dimorphite'
do
for file in $d/*.dsd.yml
do
Expand All @@ -23,12 +30,14 @@ do
-T $file\
-H "Content-Type: $CT_DY"\
-H "Base-URL: $BASE_D"\
-H "Image-Tag: $IMAGE_TAG"\
$POST
echo ""
done
done

for d in 'src/nextflow/docking' 'src/nextflow/rdkit'
for d in 'src/nextflow/docking' \
'src/nextflow/rdkit'
do
for file in $d/*.nsd.yml
do
Expand Down

0 comments on commit 8c47dc2

Please sign in to comment.