-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.yml
81 lines (80 loc) · 2.7 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# define our templated standard build config here
# this has to go at the start, so we can reference it in our CircleCI job config later
build-config: &build-config
docker:
- image: docker:stable-git
steps:
- checkout
- setup_remote_docker
- restore_cache:
keys:
- v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}
paths:
- /caches/docker-cache.tar
- run:
name: Load previous Docker image layer cache
command: |
set +o pipefail
docker load -i /caches/docker-cache.tar | true
- run:
name: Set Docker image tag based on branch or git tag
command: |
if [ ! -z "${CIRCLE_TAG}" ] ; then
echo 'export DOCKER_TAG=${CIRCLE_TAG}' >> $BASH_ENV
elif [ "${CIRCLE_BRANCH}" == "master" ] ; then
echo 'export DOCKER_TAG=latest' >> $BASH_ENV
else
echo 'export DOCKER_TAG=$( echo ${CIRCLE_BRANCH} | cut -f 2 -d / )' >> $BASH_ENV
fi
- run:
name: Build Docker image
command: |
source ${BASH_ENV}
docker build --cache-from=coco/${CIRCLE_JOB}:${DOCKER_TAG} -t coco/${CIRCLE_JOB}:${DOCKER_TAG} ${CIRCLE_JOB}/
- run:
name: Create new Docker image layer cache
command: |
source ${BASH_ENV}
mkdir -p /caches
docker save -o /caches/docker-cache.tar coco/${CIRCLE_JOB}:${DOCKER_TAG}
- save_cache:
key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ epoch }}
paths:
- /caches/docker-cache.tar
- deploy:
name: Push Docker image
command: |
source ${BASH_ENV}
echo Pushing coco/${CIRCLE_JOB}:${DOCKER_TAG}
docker login -u ${DOCKER_USER} -p ${DOCKER_ACCESS_TOKEN}
docker push coco/${CIRCLE_JOB}:${DOCKER_TAG}
# define our CircleCI config here
version: 2
workflows:
version: 2
build:
jobs:
- trigger-provisioner-builds:
filters:
tags:
only: /.*/
context: cm-team-dockerhub
jobs:
trigger-provisioner-builds:
docker:
- image: docker:stable-git
steps:
- checkout
- run:
name: Trigger builds of updated provisioners
command: |
apk -q --no-progress upgrade --no-cache libcurl
apk -q --no-progress --update add curl
.circleci/build_provisioners.sh
content-jenkins-provisioner: *build-config
pac-aurora-provisioner: *build-config
upp-concept-publishing-provisioner: *build-config
upp-elasticsearch-provisioner: *build-config
upp-factset-provisioner: *build-config
upp-concept-notifications-provisioner: *build-config
upp-concept-events-pipeline-provisioner: *build-config