From 3a5126d6fdd92119d2edfbc177a173822bd3580c Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Thu, 27 Sep 2018 11:45:19 +0200 Subject: [PATCH] Add a trigger to build on dockerhub --- .circleci/config.yml | 45 +++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 26d62cd..9d67e88 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,28 @@ version: 2 + +workflows: + version: 2 + main-pipeline: + jobs: + - build-n-test: + filters: + tags: + only: /^[0-9.]+/ + - deploy: + requires: + - build-n-test + filters: + branches: + only: /^(master|4|3)$/ + tags: + only: /^[0-9.]+/ + - trigger-dockerhub: + requires: + - build-n-test + filters: + branches: + only: master + jobs: build-n-test: machine: true @@ -43,19 +67,10 @@ jobs: 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} -workflows: - version: 2 - main-pipeline: - jobs: - - build-n-test: - filters: - tags: - only: /^[0-9.]+/ + trigger-dockerhub: + machine: true + steps: - deploy: - requires: - - build-n-test - filters: - branches: - only: /^(master|4|3)$/ - tags: - only: /^[0-9.]+/ + name: Trigger DockerHub build + command: | + curl -H "Content-Type: application/json" --data '{"docker_tag": "master"}' -X POST https://registry.hub.docker.com/u/adferrand/backuppc/trigger/463a9d6d-4293-42bb-861f-72e450a22656/