build docker container after tests pass

master
Justin Riley 2017-04-14 12:15:23 -04:00
parent 763616c132
commit 4dd482eb3d
3 changed files with 35 additions and 14 deletions

View File

@ -1,21 +1,33 @@
image: python:2.7.12-slim stages:
- test
cache: - build
paths:
- pip-cache
before_script:
- bash ci-scripts/before.sh
variables:
COVERAGE_FILE: .coverage
PIP_CACHE_DIR: pip-cache
ONE_AUTH: "/tmp/test-one-auth"
ONE_XMLRPC: "http://localhost:2633/RPC2"
pytest: pytest:
stage: test stage: test
image: python:2.7.12-slim
cache:
paths:
- pip-cache
before_script:
- ci-scripts/before.sh
variables:
COVERAGE_FILE: .coverage
PIP_CACHE_DIR: pip-cache
ONE_AUTH: "/tmp/test-one-auth"
ONE_XMLRPC: "http://localhost:2633/RPC2"
script: script:
- python setup.py test - python setup.py test
tags: tags:
- docker - docker
- docker-build
build_image:
stage: build
image: docker:git
variables:
GODEBUG: 'netdns=cgo'
script:
- ci-scripts/build-image.sh
tags:
- docker
- docker-build

0
ci-scripts/before.sh Normal file → Executable file
View File

9
ci-scripts/build-image.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
set -e
DOCKER_IMAGE_TAG=${CI_BUILD_REF_NAME}
if [ ${DOCKER_IMAGE_TAG} == "master" ]; then
DOCKER_IMAGE_TAG="latest"
fi
docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
docker build -t $CI_REGISTRY_IMAGE:${DOCKER_IMAGE_TAG} .
docker push $CI_REGISTRY_IMAGE:${DOCKER_IMAGE_TAG}