docker-backuppc/.circleci/config.yml

68 lines
1.8 KiB
YAML
Raw Normal View History

2018-09-16 11:39:13 +02:00
version: 2
jobs:
build:
2018-09-16 12:29:15 +02:00
machine: true
2018-09-16 11:39:13 +02:00
steps:
- checkout
- run:
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:
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
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!'
2018-09-16 11:39:13 +02:00
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:
command:
docker load < /tmp/workspace/docker-backuppc.tar
2018-09-16 22:19:47 +02:00
- run:
command:
2018-09-16 22:23:24 +02:00
echo "${DOCKER_PASS}" | docker login -u ${DOCKER_USER} --password-stdin
2018-09-16 11:39:13 +02:00
- deploy:
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
build-n-deploy:
jobs:
- build:
filters:
2018-09-16 11:49:57 +02:00
tags:
2018-09-17 10:10:59 +02:00
only: /^[0-9.]+/
- test:
2018-09-16 11:39:13 +02:00
requires:
- build
filters:
tags:
2018-09-17 10:10:59 +02:00
only: /^[0-9.]+/
- deploy:
requires:
- 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.]+/