summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2017-05-04 14:21:34 -0400
committerMicah Anderson <micah@riseup.net>2017-05-04 14:30:39 -0400
commit6bcbff22d1cf82b33e29eadf8e1cb33c6e21009d (patch)
tree0aafc10530683ed816ce8f4514967bb28dfd0086
parentaa8cf504f876182048e1f0e5b72b234b10a7f472 (diff)
Build docker image and push it to the container registry when tests/docker are changed
-rw-r--r--.gitlab-ci.yml34
-rw-r--r--tests/docker/Dockerfile14
2 files changed, 44 insertions, 4 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 43923a79..0502f064 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,8 +4,13 @@ stages:
- build
- e2e
+variables:
+ BITMASK_IMAGE: bitmask-dev:latest
+ SOLEDAD_IMAGE: soledad:latest
+ DOCKER_DRIVER: overlay
+
linux_test:
- image: leapcode/soledad:latest
+ image: "${CI_REGISTRY_IMAGE}/${SOLEDAD_IMAGE}"
stage: test
script:
- tox --recreate -e py27-dev
@@ -21,7 +26,7 @@ osx_test:
- osx
bitmask_latest_bundle:
- image: leapcode/bitmask-dev:latest
+ image: "${CI_REGISTRY_IMAGE}/${BITMASK_IMAGE}"
stage: bundle
script: pkg/build_bundle_with_venv.sh
artifacts:
@@ -33,7 +38,7 @@ bitmask_latest_bundle:
- linux
build_ui:
- image: leapcode/bitmask-dev:latest
+ image: "${CI_REGISTRY_IMAGE}/${BITMASK_IMAGE}"
stage: build
script:
- cd ui && make dev-build
@@ -41,7 +46,7 @@ build_ui:
- linux
e2e_tests:
- image: leapcode/bitmask-dev:latest
+ image: "${CI_REGISTRY_IMAGE}/${BITMASK_IMAGE}"
stage: e2e
allow_failure: true
script:
@@ -53,3 +58,24 @@ e2e_tests:
- make test_e2e
tags:
- linux
+
+build_docker_image:
+ image: "${CI_REGISTRY_IMAGE}/${BITMASK_IMAGE}"
+ stage: test
+ services:
+ - docker:dind
+ tags:
+ - docker-in-docker
+ before_script:
+ - >
+ export LAST_COMMIT=$(curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" ${CI_PROJECT_URL}/pipelines |
+ python -c "import sys, json; print json.load(sys.stdin)[1]['sha']")
+ script:
+ - >
+ if git diff $LAST_COMMIT HEAD --name-only|grep tests/docker; then
+ docker --version
+ docker info
+ docker login -u gitlab-ci-token -e sysdev@leap.se -p $CI_JOB_TOKEN $CI_REGISTRY
+ docker build -t ${CI_REGISTRY_IMAGE}:${BITMASK_IMAGE} tests/docker
+ docker push ${CI_REGISTRY_IMAGE}:${BITMASK_IMAGE}
+ fi
diff --git a/tests/docker/Dockerfile b/tests/docker/Dockerfile
new file mode 100644
index 00000000..2be124e8
--- /dev/null
+++ b/tests/docker/Dockerfile
@@ -0,0 +1,14 @@
+# start with a fresh official ruby image
+# https://hub.docker.com/_/ruby/
+FROM ubuntu:16.04
+
+MAINTAINER LEAP Encryption Access Project <info@leap.se>
+LABEL Description="Image for building bitmask-dev based on Ubuntu 16:04" Vendor="LEAP" Version="1.0"
+
+RUN apt-get update
+
+# Install bitmask-dev build and test deps
+RUN apt-get -y install build-essential python-virtualenv libpython-dev \
+ libsqlcipher-dev libssl-dev libffi-dev python-pyqt5 python-pyqt5.qtwebkit \
+ nodejs npm nodejs-legacy git swaks uuid-runtime \
+ patchelf libusb-0.1-4