Skip to content

Commit

Permalink
[docker] create images for final releases (#6594)
Browse files Browse the repository at this point in the history
* [docker] create images for final releases

based on git tags

* fix script
  • Loading branch information
3nids committed Mar 14, 2018
1 parent ad6491d commit 2700f77
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
12 changes: 11 additions & 1 deletion .ci/travis/linux/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ set -e

pushd .docker

source $(git rev-parse --show-toplevel)/.ci/travis/scripts/travis_envvar_helper.sh


DOCKER_DEPS_PUSH=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && [[ $TRAVIS_EVENT_TYPE =~ push ]] && echo "true" || echo "false" )
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"
echo "${bold}${endbold}"
echo "TRAVIS_BRANCH: $TRAVIS_BRANCH"
Expand All @@ -33,7 +43,7 @@ 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_QGIS_IMAGE_BUILD_PUSH -eq 0 ]]; then
docker-compose --version
docker-compose -f $DOCKER_COMPOSE config
fi
Expand Down
4 changes: 3 additions & 1 deletion .ci/travis/linux/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@

set -e

source $(git rev-parse --show-toplevel)/.ci/travis/scripts/travis_envvar_helper.sh

DOCKER_QGIS_IMAGE_BUILD_PUSH=create_qgis_image

mkdir -p $CCACHE_DIR

if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ true ]]; then
if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH -eq 1 ]]; then
DIR=$(git rev-parse --show-toplevel)/.docker
pushd ${DIR}
echo "${bold}Building QGIS Docker image '${DOCKER_TAG}'...${endbold}"
Expand Down
12 changes: 12 additions & 0 deletions .ci/travis/scripts/travis_envvar_helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

function create_qgis_image {

if [[ ! $TRAVIS_REPO_SLUG =~ qgis/QGIS ]]; then
return 0
fi
if [[ $TRAVIS_EVENT_TYPE =~ cron ]] || [[ -n $TRAVIS_TAG ]]; then
return 1;
fi
return 0;
}
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ matrix:
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" )
- DOCKER_DEPS_PUSH=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && [[ $TRAVIS_EVENT_TYPE =~ push ]] && echo "true" || echo "false" )
- 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=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && [[ $TRAVIS_EVENT_TYPE =~ cron ]] && echo "true" || echo "false" )
- QGIS_LAST_BUILD_SUCCESS=true # TODO use API to know if last build succeed https://developer.travis-ci.com/resource/builds
- TRAVIS_TIMESTAMP=$(date +%s)
- CCACHE_DIR=${HOME}/.ccache
dist: trusty
Expand Down

0 comments on commit 2700f77

Please sign in to comment.