docker-backuppc/.circleci/config.yml

62 lines
1.8 KiB
YAML
Raw Normal View History

2018-09-16 11:39:13 +02:00
version: 2
jobs:
build-n-test:
2018-09-16 12:29:15 +02:00
machine: true
2018-09-16 11:39:13 +02:00
steps:
- checkout
- run:
name: Build container
2018-09-16 22:16:21 +02:00
command: |
docker pull adferrand/backuppc || true
2018-09-17 10:22:07 +02:00
docker build --pull --cache-from adferrand/backuppc -t adferrand/backuppc .
2018-09-16 11:39:13 +02:00
- 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
2018-09-16 12:03:05 +02:00
command: |
mkdir -p workspace
2018-09-16 14:49:34 +02:00
docker save adferrand/backuppc > workspace/docker-backuppc.tar
2018-09-16 11:39:13 +02:00
- persist_to_workspace:
2018-09-16 12:03:05 +02:00
root: workspace
2018-09-16 11:39:13 +02:00
paths:
- docker-backuppc.tar
deploy:
2018-09-16 12:29:15 +02:00
machine: true
2018-09-16 11:39:13 +02:00
steps:
- attach_workspace:
at: /tmp/workspace
- run:
name: Load container
2018-09-16 11:39:13 +02:00
command:
docker load < /tmp/workspace/docker-backuppc.tar
2018-09-16 22:19:47 +02:00
- run:
name: Login to DockerHub
2018-09-16 22:19:47 +02:00
command:
2018-09-16 22:23:24 +02:00
echo "${DOCKER_PASS}" | docker login -u ${DOCKER_USER} --password-stdin
- deploy:
name: Deploy to DockerHub
2018-09-16 14:57:29 +02:00
command: |
2018-09-16 22:10:35 +02:00
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 push adferrand/backuppc:${DOCKER_TAG}
2018-09-16 11:39:13 +02:00
workflows:
version: 2
2018-09-17 10:34:06 +02:00
main-pipeline:
2018-09-16 11:39:13 +02:00
jobs:
- build-n-test:
2018-09-16 11:39:13 +02:00
filters:
tags:
2018-09-17 10:10:59 +02:00
only: /^[0-9.]+/
- deploy:
requires:
2018-09-18 12:10:23 +02:00
- build-n-test
filters:
branches:
2018-09-17 10:10:59 +02:00
only: /^(master|4|3)$/
2018-09-16 11:49:57 +02:00
tags:
2018-09-17 10:10:59 +02:00
only: /^[0-9.]+/