Skip to content

Commit 93ebb1b

Browse files
author
Alan Christie
committed
- An attempt to fix pull-requests from foreign repos
- Testing now done locally - Publishing (and docker login) now also requires a password
1 parent bff7dd8 commit 93ebb1b

File tree

1 file changed

+36
-30
lines changed

1 file changed

+36
-30
lines changed

.travis.yml

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,78 +10,84 @@
1010
#
1111
# DOCKER_USERNAME If PUBLISH_IMAGES is 'yes'
1212
# DOCKER_PASSWORD If PUBLISH_IMAGES is 'yes'
13+
#
14+
# -----------------
15+
#
16+
# NOTE: Pull requests from foreign repositories will not
17+
# result in encrupted variables being set.
18+
# So, regardless of the state of PUBLISH_IMAGES,
19+
# images will only be published if DOCKER_PASSWORD is defined.
1320

1421
os: linux
1522
services:
1623
- docker
1724

1825
stages:
26+
- name: test
1927
- name: publish latest
2028
if: |
2129
branch = master \
22-
AND env(PUBLISH_IMAGES) = yes
23-
- name: test latest
24-
if: |
25-
branch = master \
26-
AND env(PUBLISH_IMAGES) = yes
30+
AND env(PUBLISH_IMAGES) = yes \
31+
AND env(DOCKER_PASSWORD) IS present
2732
- name: publish tag
2833
if: |
2934
tag IS present \
30-
AND env(PUBLISH_IMAGES) = yes
35+
AND env(PUBLISH_IMAGES) = yes \
36+
AND env(DOCKER_PASSWORD) IS present
3137
- name: publish stable
3238
if: |
3339
tag IS present \
3440
AND tag =~ ^([0-9]+\.){1,2}[0-9]+$ \
35-
AND env(PUBLISH_IMAGES) = yes
36-
37-
before_script:
38-
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
41+
AND env(PUBLISH_IMAGES) = yes \
42+
AND env(DOCKER_PASSWORD) IS present
3943
4044
jobs:
4145
include:
4246

47+
- stage: test
48+
name: Test Local Image
49+
script:
50+
- docker build -t informaticsmatters/rdkit_pipelines:latest -f Dockerfile-rdkit .
51+
- docker build -t squonk/rdkit-pipelines-sdposter:latest -f Dockerfile-sdposter .
52+
- git clone https://github.com/InformaticsMatters/pipelines-utils.git
53+
- cd pipelines-utils/src/groovy
54+
- groovy PipelineTester.groovy -indocker
55+
4356
# Publish-stage jobs...
44-
# Every successful master build results in a latest image (above)
57+
# Every successful master build results in a latest image
4558
# and every tag results in a tagged image in Docker Hub.
4659
# Tags that match a RegEx are considered 'official' tags
4760
# and also result in a 'stable' image tag.
4861

4962
- stage: publish latest
50-
name: Latest Image
63+
name: Publish Latest Image
5164
script:
5265
# Build and push the pipelines-rdkit image and its sd-poster
5366
- docker build -t informaticsmatters/rdkit_pipelines:latest -f Dockerfile-rdkit .
54-
- docker push informaticsmatters/rdkit_pipelines:latest
5567
- docker build -t squonk/rdkit-pipelines-sdposter:latest -f Dockerfile-sdposter .
68+
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
69+
- docker push informaticsmatters/rdkit_pipelines:latest
5670
- docker push squonk/rdkit-pipelines-sdposter:latest
5771

58-
- stage: test latest
59-
name: Test Latest Image
60-
script:
61-
# Pull the latest pipelines-rdkit image
62-
# then clone the utils rep (containing the test engine)
63-
# and then run the tests
64-
- docker pull informaticsmatters/rdkit_pipelines:latest
65-
- git clone https://github.com/InformaticsMatters/pipelines-utils.git
66-
- cd pipelines-utils/src/groovy
67-
- groovy PipelineTester.groovy -indocker
68-
6972
- stage: publish tag
70-
name: Tagged Image
73+
name: Publish Tagged Image
7174
script:
7275
# Build and push the pipelines-rdkit image and its sd-poster
7376
- docker build -t informaticsmatters/rdkit_pipelines:${TRAVIS_TAG} -f Dockerfile-rdkit .
74-
- docker push informaticsmatters/rdkit_pipelines:${TRAVIS_TAG}
7577
- docker build -t squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG} -f Dockerfile-sdposter .
78+
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
79+
- docker push informaticsmatters/rdkit_pipelines:${TRAVIS_TAG}
7680
- docker push squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG}
7781

7882
- stage: publish stable
79-
name: Stable Image
83+
name: Publish Stable Image
8084
script:
81-
# Pull the corresponding pipelines-rdkit image tag and push it as 'stable'
85+
# Pull the corresponding pipelines-rdkit image tag
86+
# and push it again as 'stable'
87+
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
8288
- docker pull informaticsmatters/rdkit_pipelines:${TRAVIS_TAG}
83-
- docker tag informaticsmatters/rdkit_pipelines:${TRAVIS_TAG} informaticsmatters/rdkit_pipelines:stable
84-
- docker push informaticsmatters/rdkit_pipelines:stable
8589
- docker pull squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG}
90+
- docker tag informaticsmatters/rdkit_pipelines:${TRAVIS_TAG} informaticsmatters/rdkit_pipelines:stable
8691
- docker tag squonk/rdkit-pipelines-sdposter:${TRAVIS_TAG} squonk/rdkit-pipelines-sdposter:stable
92+
- docker push informaticsmatters/rdkit_pipelines:stable
8793
- docker push squonk/rdkit-pipelines-sdposter:stable

0 commit comments

Comments
 (0)