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

Beefed up .travis.yml so we can get automatic builds. #1926

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ notifications:
irc:
channels:
- "irc.mozilla.org#heka"
services:
- docker
addons:
apt:
packages:
- protobuf-compiler
- cmake
- libgeoip-dev
- debhelper
install:
- . build.sh
script:
- make test
- make test && make deb && ./../docker/release_travis.sh
5 changes: 5 additions & 0 deletions docker/Dockerfile.travis
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM debian:jessie
MAINTAINER Xavier Lange <[email protected]> (@tureus)

ADD heka.deb /tmp/heka.deb
RUN apt-get update && apt-get install -y libgeoip1 && dpkg -i /tmp/heka.deb && rm /tmp/heka.deb
25 changes: 25 additions & 0 deletions docker/TRAVIS_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
TRAVIS README
====

[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.

Travis Setup
---

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:

```
gem install travis
travis login --org
travis env set DOCKER_EMAIL $YOUR_DOCKER_ACCT_EMAIL
travis env set DOCKER_USERNAME $YOUR_DOCKER_ACCT_USERNAME
travis env set DOCKER_PASSWORD $YOUR_DOCKER_ACCT_PASSWD
travis env set --public DOCKER_REPO_SLUG xrlx/heka
```

These values are used by the `docker/release_travis.sh`. The unit tests must pass for the docker image to be built.

Docker Images
---

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.
27 changes: 27 additions & 0 deletions docker/release_travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -ex

if [[ $DOCKER_REPO_SLUG == "" ]]; then
echo "must set DOCKER_REPO_SLUG ENV var"
exit 1
fi

if [[ $TRAVIS_TAG != "" ]]; then
DOCKER_TAG=$TRAVIS_TAG
elif [[ $TRAVIS_BRANCH != "" ]]; then
DOCKER_TAG=$TRAVIS_BRANCH
else
echo "Skipping docker build because this is a pull request (${TRAVIS_PULL_REQUEST})"
exit 0
fi

IMAGE="${DOCKER_REPO_SLUG}:${TRAVIS_BRANCH}"

cd $TRAVIS_BUILD_DIR
mkdir /tmp/heka
find . -name "*.deb" -exec cp {} /tmp/heka/heka.deb \;
cp docker/Dockerfile.travis /tmp/heka/Dockerfile

docker build -t $IMAGE /tmp/heka
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker push $IMAGE