Skip to content

Commit

Permalink
[docker] simpler configuration to provide different build options
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Nov 16, 2018
1 parent 6a9db5a commit 51e7672
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 83 deletions.
15 changes: 0 additions & 15 deletions .ci/travis/code_layout/after_script.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .ci/travis/linux/after_script.sh

This file was deleted.

8 changes: 3 additions & 5 deletions .ci/travis/linux/before_script.sh
Expand Up @@ -25,7 +25,6 @@ DOCKER_DEPS_PUSH=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && [[ $TRAVIS_EVENT_TYP
DOCKER_DEPS_IMAGE_REBUILD=$( [[ $TRAVIS_COMMIT_MESSAGE =~ '[docker] update dependencies' ]] && echo "true" || echo "false" )
# on cron job, QGIS image is built and push without testing
DOCKER_QGIS_IMAGE_BUILD_PUSH=$(create_qgis_image)
QGIS_LAST_BUILD_SUCCESS=true # TODO use API to know if last build succeed https://developer.travis-ci.com/resource/builds


echo "travis_fold:start:travis_env"
Expand All @@ -36,18 +35,17 @@ echo "DOCKER_TAG: $DOCKER_TAG"
echo "TRAVIS_COMMIT_MESSAGE: $TRAVIS_COMMIT_MESSAGE"
echo "DOCKER_DEPS_PUSH: $DOCKER_DEPS_PUSH"
echo "DOCKER_DEPS_IMAGE_REBUILD: $DOCKER_DEPS_IMAGE_REBUILD"
echo "DOCKER_QGIS_IMAGE_BUILD_PUSH: $DOCKER_QGIS_IMAGE_BUILD_PUSH"
echo "QGIS_LAST_BUILD_SUCCESS: $QGIS_LAST_BUILD_SUCCESS"
echo "DOCKER_BUILD_QGIS_IMAGE: $DOCKER_BUILD_QGIS_IMAGE"
echo "TRAVIS_TIMESTAMP: $TRAVIS_TIMESTAMP"
echo "travis_fold:end:travis_env"


echo "travis_fold:start:docker_build"
echo "${bold}Docker build deps${endbold}"
docker --version
if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ false ]]; then
if [[ $DOCKER_BUILD_QGIS_IMAGE =~ false ]]; then
docker-compose --version
docker-compose -f "${DOCKER_COMPOSE}" config
docker-compose -f ${TRAVIS_BUILD_DIR}/.docker/docker-compose.travis.yml config
fi

if [[ $DOCKER_DEPS_IMAGE_REBUILD =~ true ]]; then
Expand Down
2 changes: 1 addition & 1 deletion .ci/travis/linux/script.sh
Expand Up @@ -22,7 +22,7 @@ DOCKER_QGIS_IMAGE_BUILD_PUSH=$(create_qgis_image)

mkdir -p "$CCACHE_DIR"

if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ true ]]; then
if [[ DOCKER_BUILD_QGIS_IMAGE =~ true ]]; then
DIR=$(git rev-parse --show-toplevel)/.docker
pushd "${DIR}"
echo "${bold}Building QGIS Docker image '${DOCKER_TAG}'...${endbold}"
Expand Down
14 changes: 0 additions & 14 deletions .ci/travis/scripts/travis_envvar_helper.sh

This file was deleted.

62 changes: 29 additions & 33 deletions .travis.yml
Expand Up @@ -10,27 +10,37 @@ cache:
- $HOME/.ccache
timeout: 1000

global:
env:
- TRAVIS_TIMESTAMP=$(date +%s)
- CCACHE_DIR=${HOME}/.ccache

matrix:
fast_finish: true
include:

##########################################################
#
# TESTS FOR STANDARD COMMITS
#
##########################################################

##########################################################
# QGIS TESTS ON BIONIC
##########################################################
- os: linux
if: type != cron
services: docker
env:
- TRAVIS_CONFIG=linux
- DOCKER_COMPOSE=${TRAVIS_BUILD_DIR}/.docker/docker-compose.travis.yml
# TRAVIS_BRANCH is either the git tag or the branch name when no tag
- DOCKER_TAG=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && echo $TRAVIS_BRANCH | sed 's/master/latest/' || echo "latest" )
- TRAVIS_TIMESTAMP=$(date +%s)
- CCACHE_DIR=${HOME}/.ccache
if: type!=cron
- DOCKER_BUILD_QGIS_IMAGE=false

##########################################################
# CODE LAYOUT
##########################################################

- os: linux
if: type != cron
env:
- TRAVIS_CONFIG=code_layout
addons:
Expand Down Expand Up @@ -68,46 +78,36 @@ matrix:



##########################################################
#
# DOCKER IMAGE BUILD JOBS ON CRON
#
##########################################################



##########################################################
#
# DOCKER IMAGE BUILD JOBS ON CRON OR TAG
#
##########################################################


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

##########################################################
# COSMIC DOCKER BUILD ON CRON
# COSMIC DOCKER BUILD ON CRON OR TAG
##########################################################
- os: linux
if: repo = qgis/QGIS AND (tag IS PRESENT OR type = cron)
services: docker
env:
- TRAVIS_CONFIG=linux
- DOCKER_COMPOSE=${TRAVIS_BUILD_DIR}/.docker/docker-compose.travis.yml
# TRAVIS_BRANCH is either the git tag or the branch name when no tag
- DOCKER_TAG=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && echo $TRAVIS_BRANCH | sed 's/master/latest/' || echo "latest" )
- TRAVIS_TIMESTAMP=$(date +%s)
- CCACHE_DIR=${HOME}/.ccache
- DOCKER_TAG=$( echo $TRAVIS_BRANCH | sed 's/master/latest/' )
- DOCKER_DEBIAN_DISTRO=cosmic
if: type=cron

- DOCKER_BUILD_QGIS_IMAGE=true



Expand All @@ -134,7 +134,6 @@ notifications:
on_success: change
skip_join: true

notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/467e3aff72e344d1dae3
Expand All @@ -153,6 +152,3 @@ before_script:

script:
- ./.ci/travis/${TRAVIS_CONFIG}/script.sh

after_script:
- ./.ci/travis/${TRAVIS_CONFIG}/after_script.sh

0 comments on commit 51e7672

Please sign in to comment.