Skip to content

Commit 914e7bb

Browse files
authored
[docker] create images for final releases (#6594)
* [docker] create images for final releases based on git tags * fix script
1 parent 88e8acd commit 914e7bb

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

.ci/travis/linux/before_script.sh

+11-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ set -e
1717

1818
pushd .docker
1919

20+
source $(git rev-parse --show-toplevel)/.ci/travis/scripts/travis_envvar_helper.sh
21+
22+
23+
DOCKER_DEPS_PUSH=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && [[ $TRAVIS_EVENT_TYPE =~ push ]] && echo "true" || echo "false" )
24+
DOCKER_DEPS_IMAGE_REBUILD=$( [[ $TRAVIS_COMMIT_MESSAGE =~ '[docker] update dependencies' ]] && echo "true" || echo "false" )
25+
# on cron job, QGIS image is built and push without testing
26+
DOCKER_QGIS_IMAGE_BUILD_PUSH=create_qgis_image
27+
QGIS_LAST_BUILD_SUCCESS=true # TODO use API to know if last build succeed https://developer.travis-ci.com/resource/builds
28+
29+
2030
echo "travis_fold:start:travis_env"
2131
echo "${bold}${endbold}"
2232
echo "TRAVIS_BRANCH: $TRAVIS_BRANCH"
@@ -33,7 +43,7 @@ echo "travis_fold:end:travis_env"
3343
echo "travis_fold:start:docker_build"
3444
echo "${bold}Docker build deps${endbold}"
3545
docker --version
36-
if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ false ]]; then
46+
if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH -eq 0 ]]; then
3747
docker-compose --version
3848
docker-compose -f $DOCKER_COMPOSE config
3949
fi

.ci/travis/linux/script.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515

1616
set -e
1717

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

20+
DOCKER_QGIS_IMAGE_BUILD_PUSH=create_qgis_image
1921

2022
mkdir -p $CCACHE_DIR
2123

22-
if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH =~ true ]]; then
24+
if [[ $DOCKER_QGIS_IMAGE_BUILD_PUSH -eq 1 ]]; then
2325
DIR=$(git rev-parse --show-toplevel)/.docker
2426
pushd ${DIR}
2527
echo "${bold}Building QGIS Docker image '${DOCKER_TAG}'...${endbold}"
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
function create_qgis_image {
4+
5+
if [[ ! $TRAVIS_REPO_SLUG =~ qgis/QGIS ]]; then
6+
return 0
7+
fi
8+
if [[ $TRAVIS_EVENT_TYPE =~ cron ]] || [[ -n $TRAVIS_TAG ]]; then
9+
return 1;
10+
fi
11+
return 0;
12+
}

.travis.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ matrix:
88
env:
99
- TRAVIS_CONFIG=linux
1010
- DOCKER_COMPOSE=${TRAVIS_BUILD_DIR}/.docker/docker-compose.travis.yml
11+
# TRAVIS_BRANCH is either the git tag or the branch name when no tag
1112
- DOCKER_TAG=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && echo $TRAVIS_BRANCH | sed 's/master/latest/' || echo "latest" )
12-
- DOCKER_DEPS_PUSH=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && [[ $TRAVIS_EVENT_TYPE =~ push ]] && echo "true" || echo "false" )
13-
- DOCKER_DEPS_IMAGE_REBUILD=$( [[ $TRAVIS_COMMIT_MESSAGE =~ '[docker] update dependencies' ]] && echo "true" || echo "false" )
14-
# on cron job, QGIS image is built and push without testing
15-
- DOCKER_QGIS_IMAGE_BUILD_PUSH=$( [[ $TRAVIS_REPO_SLUG =~ qgis/QGIS ]] && [[ $TRAVIS_EVENT_TYPE =~ cron ]] && echo "true" || echo "false" )
16-
- QGIS_LAST_BUILD_SUCCESS=true # TODO use API to know if last build succeed https://developer.travis-ci.com/resource/builds
1713
- TRAVIS_TIMESTAMP=$(date +%s)
1814
- CCACHE_DIR=${HOME}/.ccache
1915
dist: trusty

0 commit comments

Comments
 (0)