Skip to content

Commit 51e7672

Browse files
committedNov 16, 2018
[docker] simpler configuration to provide different build options
1 parent 6a9db5a commit 51e7672

File tree

6 files changed

+33
-83
lines changed

6 files changed

+33
-83
lines changed
 

‎.ci/travis/code_layout/after_script.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎.ci/travis/linux/after_script.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎.ci/travis/linux/before_script.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ DOCKER_DEPS_PUSH=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && [[ $TRAVIS_EVENT_TYP
2525
DOCKER_DEPS_IMAGE_REBUILD=$( [[ $TRAVIS_COMMIT_MESSAGE =~ '[docker] update dependencies' ]] && echo "true" || echo "false" )
2626
# on cron job, QGIS image is built and push without testing
2727
DOCKER_QGIS_IMAGE_BUILD_PUSH=$(create_qgis_image)
28-
QGIS_LAST_BUILD_SUCCESS=true # TODO use API to know if last build succeed https://developer.travis-ci.com/resource/builds
2928

3029

3130
echo "travis_fold:start:travis_env"
@@ -36,18 +35,17 @@ echo "DOCKER_TAG: $DOCKER_TAG"
3635
echo "TRAVIS_COMMIT_MESSAGE: $TRAVIS_COMMIT_MESSAGE"
3736
echo "DOCKER_DEPS_PUSH: $DOCKER_DEPS_PUSH"
3837
echo "DOCKER_DEPS_IMAGE_REBUILD: $DOCKER_DEPS_IMAGE_REBUILD"
39-
echo "DOCKER_QGIS_IMAGE_BUILD_PUSH: $DOCKER_QGIS_IMAGE_BUILD_PUSH"
40-
echo "QGIS_LAST_BUILD_SUCCESS: $QGIS_LAST_BUILD_SUCCESS"
38+
echo "DOCKER_BUILD_QGIS_IMAGE: $DOCKER_BUILD_QGIS_IMAGE"
4139
echo "TRAVIS_TIMESTAMP: $TRAVIS_TIMESTAMP"
4240
echo "travis_fold:end:travis_env"
4341

4442

4543
echo "travis_fold:start:docker_build"
4644
echo "${bold}Docker build deps${endbold}"
4745
docker --version
48-
if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ false ]]; then
46+
if [[ $DOCKER_BUILD_QGIS_IMAGE =~ false ]]; then
4947
docker-compose --version
50-
docker-compose -f "${DOCKER_COMPOSE}" config
48+
docker-compose -f ${TRAVIS_BUILD_DIR}/.docker/docker-compose.travis.yml config
5149
fi
5250

5351
if [[ $DOCKER_DEPS_IMAGE_REBUILD =~ true ]]; then

‎.ci/travis/linux/script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ DOCKER_QGIS_IMAGE_BUILD_PUSH=$(create_qgis_image)
2222

2323
mkdir -p "$CCACHE_DIR"
2424

25-
if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ true ]]; then
25+
if [[ DOCKER_BUILD_QGIS_IMAGE =~ true ]]; then
2626
DIR=$(git rev-parse --show-toplevel)/.docker
2727
pushd "${DIR}"
2828
echo "${bold}Building QGIS Docker image '${DOCKER_TAG}'...${endbold}"

‎.ci/travis/scripts/travis_envvar_helper.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎.travis.yml

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,37 @@ cache:
1010
- $HOME/.ccache
1111
timeout: 1000
1212

13+
global:
14+
env:
15+
- TRAVIS_TIMESTAMP=$(date +%s)
16+
- CCACHE_DIR=${HOME}/.ccache
17+
1318
matrix:
1419
fast_finish: true
1520
include:
21+
22+
##########################################################
23+
#
24+
# TESTS FOR STANDARD COMMITS
25+
#
26+
##########################################################
27+
1628
##########################################################
1729
# QGIS TESTS ON BIONIC
1830
##########################################################
1931
- os: linux
32+
if: type != cron
2033
services: docker
2134
env:
2235
- TRAVIS_CONFIG=linux
23-
- DOCKER_COMPOSE=${TRAVIS_BUILD_DIR}/.docker/docker-compose.travis.yml
24-
# TRAVIS_BRANCH is either the git tag or the branch name when no tag
2536
- DOCKER_TAG=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && echo $TRAVIS_BRANCH | sed 's/master/latest/' || echo "latest" )
26-
- TRAVIS_TIMESTAMP=$(date +%s)
27-
- CCACHE_DIR=${HOME}/.ccache
28-
if: type!=cron
37+
- DOCKER_BUILD_QGIS_IMAGE=false
2938

3039
##########################################################
3140
# CODE LAYOUT
3241
##########################################################
33-
42+
- os: linux
43+
if: type != cron
3444
env:
3545
- TRAVIS_CONFIG=code_layout
3646
addons:
@@ -68,46 +78,36 @@ matrix:
6878

6979

7080

71-
##########################################################
72-
#
73-
# DOCKER IMAGE BUILD JOBS ON CRON
74-
#
75-
##########################################################
76-
77-
78-
81+
##########################################################
82+
#
83+
# DOCKER IMAGE BUILD JOBS ON CRON OR TAG
84+
#
85+
##########################################################
7986

8087

8188
##########################################################
82-
# BIONIC DOCKER BUILD ON CRON
89+
# BIONIC DOCKER BUILD ON CRON OR TAG
8390
##########################################################
8491
- os: linux
92+
if: repo = qgis/QGIS AND (tag IS PRESENT OR type = cron)
8593
services: docker
8694
env:
8795
- TRAVIS_CONFIG=linux
88-
- DOCKER_COMPOSE=${TRAVIS_BUILD_DIR}/.docker/docker-compose.travis.yml
89-
# TRAVIS_BRANCH is either the git tag or the branch name when no tag
90-
- DOCKER_TAG=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && echo $TRAVIS_BRANCH | sed 's/master/latest/' || echo "latest" )
91-
- TRAVIS_TIMESTAMP=$(date +%s)
92-
- CCACHE_DIR=${HOME}/.ccache
96+
- DOCKER_TAG=$( echo $TRAVIS_BRANCH | sed 's/master/latest/' )
9397
- DOCKER_DEBIAN_DISTRO=bionic
94-
if: type=cron
98+
- DOCKER_BUILD_QGIS_IMAGE=true
9599

96100
##########################################################
97-
# COSMIC DOCKER BUILD ON CRON
101+
# COSMIC DOCKER BUILD ON CRON OR TAG
98102
##########################################################
99103
- os: linux
104+
if: repo = qgis/QGIS AND (tag IS PRESENT OR type = cron)
100105
services: docker
101106
env:
102107
- TRAVIS_CONFIG=linux
103-
- DOCKER_COMPOSE=${TRAVIS_BUILD_DIR}/.docker/docker-compose.travis.yml
104-
# TRAVIS_BRANCH is either the git tag or the branch name when no tag
105-
- DOCKER_TAG=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && echo $TRAVIS_BRANCH | sed 's/master/latest/' || echo "latest" )
106-
- TRAVIS_TIMESTAMP=$(date +%s)
107-
- CCACHE_DIR=${HOME}/.ccache
108+
- DOCKER_TAG=$( echo $TRAVIS_BRANCH | sed 's/master/latest/' )
108109
- DOCKER_DEBIAN_DISTRO=cosmic
109-
if: type=cron
110-
110+
- DOCKER_BUILD_QGIS_IMAGE=true
111111

112112

113113

@@ -134,7 +134,6 @@ notifications:
134134
on_success: change
135135
skip_join: true
136136

137-
notifications:
138137
webhooks:
139138
urls:
140139
- https://webhooks.gitter.im/e/467e3aff72e344d1dae3
@@ -153,6 +152,3 @@ before_script:
153152

154153
script:
155154
- ./.ci/travis/${TRAVIS_CONFIG}/script.sh
156-
157-
after_script:
158-
- ./.ci/travis/${TRAVIS_CONFIG}/after_script.sh

0 commit comments

Comments
 (0)
Please sign in to comment.