Skip to content

Commit

Permalink
Beam Enrich: build Docker image (closes #3815)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenFradet committed Aug 29, 2018
1 parent b318030 commit ff6ce6a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ before_install:
addons:
postgresql: '9.3'
services:
- docker
- postgresql
before_deploy:
- pip install --user release-manager==0.3.0
Expand Down Expand Up @@ -92,6 +93,12 @@ deploy:
on:
tags: true
condition: '$([[ "$TEST_DIR" == "3-enrich/spark-enrich/" ]] && .travis/is_release_tag.sh spark_enrich $TRAVIS_TAG && [ $? -eq 0 ] && echo "Deploying")'
- provider: script
script: ./.travis/deploy.sh beam_enrich $TRAVIS_TAG && ./.travis/deploy_docker.sh $TRAVIS_TAG
skip_cleanup: true
on:
tags: true
condition: '"$(.travis/is_release_tag.sh beam_enrich $TRAVIS_TAG)" == "" && $? == 0 && $TEST_DIR = 3-enrich/beam-enrich/'
- provider: script
script: ./.travis/deploy.sh hadoop_event_recovery $TRAVIS_TAG
skip_cleanup: true
Expand Down
22 changes: 22 additions & 0 deletions .travis/deploy_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

tag=$1

file="${HOME}/.dockercfg"
docker_repo="snowplow-docker-registry.bintray.io"
curl -X GET \
-u${BINTRAY_SNOWPLOW_DOCKER_USER}:${BINTRAY_SNOWPLOW_DOCKER_API_KEY} \
https://${docker_repo}/v2/auth > $file

cd $TEST_DIR

project_version=$(sbt version -Dsbt.log.noformat=true | perl -ne 'print "$1\n" if /info.*(\d+\.\d+\.\d+[^\r\n]*)/' | tail -n 1 | tr -d '\n')
if [[ "${tag}" = *"${project_version}" ]]; then
sbt docker:publishLocal
formatted_tag="${tag////:}"
docker push "${docker_repo}/snowplow/${formatted_tag//_/-}"
else
echo "Tag version '${tag}' doesn't match version in scala project ('${project_version}'). Aborting!"
exit 1
fi

7 changes: 7 additions & 0 deletions 3-enrich/beam-enrich/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ lazy val noPublishSettings = Seq(
publishArtifact := false
)

import com.typesafe.sbt.packager.docker._
dockerRepository := Some("snowplow-docker-registry.bintray.io")
dockerUsername := Some("snowplow")
dockerBaseImage := "snowplow-docker-registry.bintray.io/snowplow/base-debian:0.1.0"
maintainer in Docker := "Snowplow Analytics Ltd. <support@snowplowanalytics.com>"
daemonUser in Docker := "snowplow"

lazy val scioVersion = "0.5.7"
lazy val beamVersion = "2.5.0"
lazy val sceVersion = "0.35.0"
Expand Down
2 changes: 1 addition & 1 deletion 3-enrich/beam-enrich/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.9.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.5")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")

0 comments on commit ff6ce6a

Please sign in to comment.