Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit ccc99cd

Browse files
committed
Beefed up .travis.yml so we can get automatic builds.
1 parent fd33dfb commit ccc99cd

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed

.travis.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ notifications:
66
irc:
77
channels:
88
- "irc.mozilla.org#heka"
9+
services:
10+
- docker
911
addons:
1012
apt:
1113
packages:
1214
- protobuf-compiler
1315
- cmake
1416
- libgeoip-dev
17+
- debhelper
1518
install:
1619
- . build.sh
1720
script:
18-
- make test
21+
- make test && make deb && ./../docker/release_travis.sh

docker/Dockerfile.travis

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM debian:jessie
2+
MAINTAINER Xavier Lange <[email protected]> (@tureus)
3+
4+
ADD heka.deb /tmp/heka.deb
5+
RUN apt-get update && apt-get install -y libgeoip1 && dpkg -i /tmp/heka.deb && rm /tmp/heka.deb

docker/TRAVIS_README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
TRAVIS README
2+
====
3+
4+
[Travis CI](https://travis-ci.org) is used to run the heka test suite on every push and pull request to github. Those travis runs end with a docker build and push to the semi-official docker repository.
5+
6+
Travis Setup
7+
---
8+
9+
The docker build relies on environmental variables being set for login. Here they are, in case you'd like to auto build heka for your fork. You'll need to install the travis command line tool and inject some docker variables:
10+
11+
```
12+
gem install travis
13+
travis login --org
14+
travis env set DOCKER_EMAIL $YOUR_DOCKER_ACCT_EMAIL
15+
travis env set DOCKER_USERNAME $YOUR_DOCKER_ACCT_USERNAME
16+
travis env set DOCKER_PASSWORD $YOUR_DOCKER_ACCT_PASSWD
17+
travis env set --public DOCKER_REPO_SLUG xrlx/heka
18+
```
19+
20+
These values are used by the `docker/release_travis.sh`. The unit tests must pass for the docker image to be built.
21+
22+
Docker Images
23+
---
24+
25+
The `$DOCKER_REPO_SLUG` is used to craft the `docker push $DOCKER_REPO_SLUG:$TAG`. The `$TAG` is determined using a git tag, if that's what kicked off travis, or more like the git branch which received a push. Pull requests will not generate image builds.

docker/release_travis.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
if [[ $DOCKER_REPO_SLUG == "" ]]; then
5+
echo "must set DOCKER_REPO_SLUG ENV var"
6+
exit 1
7+
fi
8+
9+
if [[ $TRAVIS_TAG != "" ]]; then
10+
DOCKER_TAG=$TRAVIS_TAG
11+
elif [[ $TRAVIS_BRANCH != "" ]]; then
12+
DOCKER_TAG=$TRAVIS_BRANCH
13+
else
14+
echo "Skipping docker build because this is a pull request (${TRAVIS_PULL_REQUEST})"
15+
exit 0
16+
fi
17+
18+
IMAGE="${DOCKER_REPO_SLUG}:${TRAVIS_BRANCH}"
19+
20+
cd $TRAVIS_BUILD_DIR
21+
mkdir /tmp/heka
22+
find . -name "*.deb" -exec cp {} /tmp/heka/heka.deb \;
23+
cp docker/Dockerfile.travis /tmp/heka/Dockerfile
24+
25+
docker build -t $IMAGE /tmp/heka
26+
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
27+
docker push $IMAGE

0 commit comments

Comments
 (0)