Update circle ci pipeline with goss tests

This commit is contained in:
Adrien Ferrand 2018-09-17 17:32:33 +02:00
parent bed2fd11bb
commit cf81044989

View File

@ -1,14 +1,22 @@
version: 2 version: 2
jobs: jobs:
build: build-n-test:
machine: true machine: true
steps: steps:
- checkout - checkout
- run: - run:
name: Build container
command: | command: |
docker pull adferrand/backuppc || true docker pull adferrand/backuppc || true
docker build --pull --cache-from adferrand/backuppc -t adferrand/backuppc . docker build --pull --cache-from adferrand/backuppc -t adferrand/backuppc .
- run: - run:
name: Test container
command: |
mkdir -p ./bin
curl -fsSL https://goss.rocks/install | GOSS_DST=./bin sh
GOSS_PATH=./bin/goss GOSS_SLEEP=1 GOSS_FILES_PATH=./tests ./bin/dgoss run -e LETSENCRYPT_STAGING=true adferrand/backuppc
- run:
name: Save container
command: | command: |
mkdir -p workspace mkdir -p workspace
docker save adferrand/backuppc > workspace/docker-backuppc.tar docker save adferrand/backuppc > workspace/docker-backuppc.tar
@ -16,29 +24,21 @@ jobs:
root: workspace root: workspace
paths: paths:
- docker-backuppc.tar - docker-backuppc.tar
test:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run:
command:
docker load < /tmp/workspace/docker-backuppc.tar
- run:
command:
docker run --rm adferrand/backuppc echo 'Hello World!'
deploy: deploy:
machine: true machine: true
steps: steps:
- attach_workspace: - attach_workspace:
at: /tmp/workspace at: /tmp/workspace
- run: - run:
name: Load container
command: command:
docker load < /tmp/workspace/docker-backuppc.tar docker load < /tmp/workspace/docker-backuppc.tar
- run: - run:
name: Login to DockerHub
command: command:
echo "${DOCKER_PASS}" | docker login -u ${DOCKER_USER} --password-stdin echo "${DOCKER_PASS}" | docker login -u ${DOCKER_USER} --password-stdin
- deploy: - deploy:
name: Deploy to DockerHub
command: | command: |
if [ ${CIRCLE_BRANCH} = master ]; then DOCKER_TAG=latest; else DOCKER_TAG=${CIRCLE_TAG:-${CIRCLE_BRANCH}}; fi if [ ${CIRCLE_BRANCH} = master ]; then DOCKER_TAG=latest; else DOCKER_TAG=${CIRCLE_TAG:-${CIRCLE_BRANCH}}; fi
docker tag adferrand/backuppc adferrand/backuppc:${DOCKER_TAG} docker tag adferrand/backuppc adferrand/backuppc:${DOCKER_TAG}
@ -47,13 +47,7 @@ workflows:
version: 2 version: 2
main-pipeline: main-pipeline:
jobs: jobs:
- build: - build-n-test:
filters:
tags:
only: /^[0-9.]+/
- test:
requires:
- build
filters: filters:
tags: tags:
only: /^[0-9.]+/ only: /^[0-9.]+/