Skip to content

Commit ca66839

Browse files
alanbchristieAlan Christie
andauthored
- Doc tweak (#43)
* - Doc tweak * - Moved Docker password check to stage * - Reduces stage count Co-authored-by: Alan Christie <[email protected]>
1 parent 84063fe commit ca66839

File tree

1 file changed

+30
-37
lines changed

1 file changed

+30
-37
lines changed

.travis.yml

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
#
99
# If you set PUBLISH_IMAGES you must also set the following: -
1010
#
11-
# DOCKER_USERNAME If PUBLISH_IMAGES is 'yes'
12-
# DOCKER_PASSWORD If PUBLISH_IMAGES is 'yes'
11+
# DOCKER_USERNAME
12+
# DOCKER_PASSWORD
1313
#
1414
# -----------------
1515
#
1616
# NOTE: Pull requests from foreign repositories will not
17-
# result in encrupted variables being set.
17+
# result in encrypted variables being set.
1818
# So, regardless of the state of PUBLISH_IMAGES,
1919
# images will only be published if DOCKER_PASSWORD is defined.
2020

@@ -23,42 +23,26 @@ services:
2323
- docker
2424

2525
stages:
26-
- name: test
2726
- name: publish latest
2827
if: |
2928
branch = master \
30-
AND env(PUBLISH_IMAGES) = yes \
31-
AND env(DOCKER_PASSWORD) IS present \
32-
AND env(DOCKER_PASSWORD) =~ ^\S+$
29+
AND env(PUBLISH_IMAGES) = yes
3330
- name: publish tag
3431
if: |
3532
tag IS present \
36-
AND env(PUBLISH_IMAGES) = yes \
37-
AND env(DOCKER_PASSWORD) IS present \
38-
AND env(DOCKER_PASSWORD) =~ ^\S+$
33+
AND env(PUBLISH_IMAGES) = yes
3934
- name: publish stable
4035
if: |
4136
tag IS present \
4237
AND tag =~ ^([0-9]+\.){1,2}[0-9]+$ \
43-
AND env(PUBLISH_IMAGES) = yes \
44-
AND env(DOCKER_PASSWORD) IS present \
45-
AND env(DOCKER_PASSWORD) =~ ^\S+$
38+
AND env(PUBLISH_IMAGES) = yes
4639
4740
jobs:
4841
include:
4942

50-
- stage: test
51-
name: Test Local Image
52-
script:
53-
- docker build -t informaticsmatters/rdkit_pipelines:latest -f Dockerfile-rdkit .
54-
- docker build -t squonk/rdkit-pipelines-sdposter:latest -f Dockerfile-sdposter .
55-
- git clone https://github.com/InformaticsMatters/pipelines-utils.git
56-
- cd pipelines-utils/src/groovy
57-
- groovy PipelineTester.groovy -indocker
58-
5943
# Publish-stage jobs...
60-
# Every successful master build results in a latest image
61-
# and every tag results in a tagged image in Docker Hub.
44+
# Every successful master build results in a build (and test)
45+
# of the latest image and every tag results in a tagged image in Docker Hub.
6246
# Tags that match a RegEx are considered 'official' tags
6347
# and also result in a 'stable' image tag.
6448

@@ -68,29 +52,38 @@ jobs:
6852
# Build and push the pipelines-rdkit image and its sd-poster
6953
- docker build -t informaticsmatters/rdkit_pipelines:latest -f Dockerfile-rdkit .
7054
- docker build -t squonk/rdkit-pipelines-sdposter:latest -f Dockerfile-sdposter .
71-
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
72-
- docker push informaticsmatters/rdkit_pipelines:latest
73-
- docker push squonk/rdkit-pipelines-sdposter:latest
55+
- git clone https://github.com/InformaticsMatters/pipelines-utils.git
56+
- cd pipelines-utils/src/groovy
57+
- groovy PipelineTester.groovy -indocker
58+
- if [ -n "$DOCKER_PASSWORD" ]; then
59+
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
60+
docker push informaticsmatters/rdkit_pipelines:latest;
61+
docker push squonk/rdkit-pipelines-sdposter:latest;
62+
fi
7463

7564
- stage: publish tag
7665
name: Publish Tagged Image
7766
script:
7867
# Build and push the pipelines-rdkit image and its sd-poster
7968
- docker build -t informaticsmatters/rdkit_pipelines:${TRAVIS_TAG} -f Dockerfile-rdkit .
8069
- docker build -t squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG} -f Dockerfile-sdposter .
81-
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
82-
- docker push informaticsmatters/rdkit_pipelines:${TRAVIS_TAG}
83-
- docker push squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG}
70+
- if [ -n "$DOCKER_PASSWORD" ]; then
71+
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
72+
docker push informaticsmatters/rdkit_pipelines:${TRAVIS_TAG};
73+
docker push squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG};
74+
fi
8475

8576
- stage: publish stable
8677
name: Publish Stable Image
8778
script:
8879
# Pull the corresponding pipelines-rdkit image tag
8980
# and push it again as 'stable'
90-
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
91-
- docker pull informaticsmatters/rdkit_pipelines:${TRAVIS_TAG}
92-
- docker pull squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG}
93-
- docker tag informaticsmatters/rdkit_pipelines:${TRAVIS_TAG} informaticsmatters/rdkit_pipelines:stable
94-
- docker tag squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG} squonk/rdkit-pipelines-sdposter:stable
95-
- docker push informaticsmatters/rdkit_pipelines:stable
96-
- docker push squonk/rdkit-pipelines-sdposter:stable
81+
- if [ -n "$DOCKER_PASSWORD" ]; then
82+
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
83+
docker pull informaticsmatters/rdkit_pipelines:${TRAVIS_TAG};
84+
docker pull squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG};
85+
docker tag informaticsmatters/rdkit_pipelines:${TRAVIS_TAG} informaticsmatters/rdkit_pipelines:stable;
86+
docker tag squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG} squonk/rdkit-pipelines-sdposter:stable;
87+
docker push informaticsmatters/rdkit_pipelines:stable;
88+
docker push squonk/rdkit-pipelines-sdposter:stable;
89+
fi

0 commit comments

Comments
 (0)