Skip to content

Commit 9cf6faf

Browse files
authored
CI docker (strapdata#6)
(cherry picked from commit 251b8c5)
1 parent c5b638e commit 9cf6faf

File tree

11 files changed

+59
-436
lines changed

11 files changed

+59
-436
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ html_docs
4444
/tmp/
4545
eclipse-build
4646
/private/
47+
48+
docker

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
dist: trusty
22
sudo: required
3+
env:
4+
global:
5+
# this variable determine when docker images are tagged 'latest'
6+
- LATEST_VERSION=6.2.3
7+
38
language:
49
- java
510
- bash
@@ -71,6 +76,6 @@ deploy:
7176

7277
- provider: script
7378
skip_cleanup: true
74-
script: bash docker/build.sh
79+
script: bash ./docker-ci.sh
7580
on:
7681
tags: true

docker-ci.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
3+
# fails on error and trace execution
4+
set -ex
5+
6+
# shallow clone of the elassandra docker repository
7+
rm -rf docker
8+
git clone --depth 1 https://github.com/strapdata/docker-elassandra.git docker
9+
cd docker
10+
11+
# set parameters
12+
if [ "$TRAVIS" = "true" ]; then
13+
# Special branching to be ran under travis
14+
15+
export REPO_NAME=${TRAVIS_REPO_SLUG}
16+
export REPO_DIR=${TRAVIS_BUILD_DIR}
17+
18+
if [ -n "$TRAVIS_TAG" ]; then
19+
# publish to docker hub when a tag is set
20+
export DOCKER_PUBLISH=true
21+
22+
# try to infer if the current build need to be tagged "latest"
23+
ELASTICSEARCH_VERSION=$(echo "$TRAVIS_TAG" | sed 's/v\(.*\..*.\..*\)\..*/\1/')
24+
if [ "$ELASTICSEARCH_VERSION" = "$LATEST_VERSION" ]; then
25+
export DOCKER_LATEST=true
26+
fi
27+
fi
28+
29+
else
30+
export REPO_DIR=../
31+
fi
32+
33+
# try 5 times, because gpg servers suck
34+
n=0
35+
until [ $n -ge 5 ]
36+
do
37+
echo "build try number $n"
38+
# build and publish the docker image
39+
./build.sh && break
40+
n=$[$n+1]
41+
sleep 1
42+
done
43+
if [ $n -eq 5 ]; then
44+
echo "failed to build image"
45+
exit 1
46+
fi
47+
48+
49+
# clean up
50+
cd ../
51+
rm -rf docker

docker/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker/Dockerfile

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

docker/README.md

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

docker/build.sh

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

0 commit comments

Comments
 (0)