forked from DataDog/chaos-controller
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
168 lines (151 loc) · 5.71 KB
/
.gitlab-ci.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2021 Datadog, Inc.
---
variables:
CURRENT_CI_IMAGE: 0.4.0
CONTROLLER_IMAGE_NAME: chaos-controller
INJECTOR_IMAGE_NAME: chaos-injector
HANDLER_IMAGE_NAME: chaos-handler
stages:
- ci-image
- build
- pre-release
- release
- release-public
# CI image
.docker-runner: &docker-runner
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:18.03.1
tags:
- "runner:docker"
- "size:large"
ci-image:
<<: *docker-runner
stage: ci-image
when: manual
except: [tags, schedules]
script:
- docker build --tag 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/chaos-controller:$CURRENT_CI_IMAGE ci
- docker push 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/chaos-controller:$CURRENT_CI_IMAGE
# main
.common: &common
tags:
- "runner:main"
- "size:large"
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/chaos-controller:$CURRENT_CI_IMAGE
build:make:
<<: *common
stage: build
when: always
script:
- make
artifacts:
paths:
- bin/injector/injector
- bin/manager/manager
- bin/handler/handler
# meta-release
# release image and common stuff
.meta-release: &meta-release
<<: *common
tags:
- "runner:docker"
- "size:large"
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker-push:v2875076-79d562c-1.4.0
before_script:
- echo "Logging into the Docker Hub"
- DOCKER_REGISTRY_LOGIN=$(aws ssm get-parameter --region us-east-1 --name ci.chaos-engineering.docker_hub_login --with-decryption --query "Parameter.Value" --out text)
- aws ssm get-parameter --region us-east-1 --name ci.chaos-engineering.docker_hub_pwd --with-decryption --query "Parameter.Value" --out text | docker login --username "$DOCKER_REGISTRY_LOGIN" --password-stdin docker.io
# pre-release
# build the target from the local Dockerfile and push it to
# AWS staging registry
.pre-release: &pre-release
<<: *meta-release
stage: pre-release
script:
- release.sh --build-from=./bin/manager/Dockerfile --build-context=./bin/manager/ 727006795293.dkr.ecr.us-east-1.amazonaws.com/${CONTROLLER_IMAGE_NAME} ${TAG}
- release.sh --build-from=./bin/injector/Dockerfile --build-context=./bin/injector/ 727006795293.dkr.ecr.us-east-1.amazonaws.com/${INJECTOR_IMAGE_NAME} ${TAG}
- release.sh --build-from=./bin/handler/Dockerfile --build-context=./bin/handler/ 727006795293.dkr.ecr.us-east-1.amazonaws.com/${HANDLER_IMAGE_NAME} ${TAG}
dependencies:
- build:make
# pre-release-ref
# build a reference image tag for controller images
pre-release-ref:
<<: *pre-release
when: manual
except:
- tags
variables:
TAG: "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
# pre-release-tag
# build a tag image tag for controller images
pre-release-tag:
<<: *pre-release
when: always
only:
- tags
variables:
TAG: "${CI_COMMIT_TAG}"
# release
# build the target from the local Dockerfile and push it unified registry
.release: &release
<<: *meta-release
stage: release
when: always
only:
- tags
script:
- release.sh --pull-from=727006795293.dkr.ecr.us-east-1.amazonaws.com/${IMAGE}:${TAG} eu.gcr.io/datadog-staging/${IMAGE} ${TAG}
- release.sh --pull-from=727006795293.dkr.ecr.us-east-1.amazonaws.com/${IMAGE}:${TAG} eu.gcr.io/datadog-prod/${IMAGE} ${TAG}
- release.sh --pull-from=727006795293.dkr.ecr.us-east-1.amazonaws.com/${IMAGE}:${TAG} 464622532012.dkr.ecr.us-east-1.amazonaws.com/${IMAGE} ${TAG}
- release.sh --pull-from=727006795293.dkr.ecr.us-east-1.amazonaws.com/${IMAGE}:${TAG} 020998557671.dkr.ecr.us-east-1.amazonaws.com/${IMAGE} ${TAG}
- release.sh --pull-from=727006795293.dkr.ecr.us-east-1.amazonaws.com/${IMAGE}:${TAG} registry.ddbuild.io/${IMAGE} ${TAG}
- release.sh --pull-from=727006795293.dkr.ecr.us-east-1.amazonaws.com/${IMAGE}:${TAG} 486234852809.dkr.ecr.us-east-1.amazonaws.com/${IMAGE} ${TAG}
before_script:
- set -x
- ./ci/supplement_docker_headers.sh
release-controller:
<<: *release
variables:
IMAGE: "${CONTROLLER_IMAGE_NAME}"
TAG: "${CI_COMMIT_TAG}"
release-injector:
<<: *release
variables:
IMAGE: "${INJECTOR_IMAGE_NAME}"
TAG: "${CI_COMMIT_TAG}"
release-handler:
<<: *release
variables:
IMAGE: "${HANDLER_IMAGE_NAME}"
TAG: "${CI_COMMIT_TAG}"
.release-docker-hub: &release-docker-hub
<<: *meta-release
stage: release-public
tags: [ "runner:docker", "size:large" ]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker-notary:v1912023-8c8dc1c-0.6.1
script:
- docker pull 727006795293.dkr.ecr.us-east-1.amazonaws.com/${CONTROLLER_IMAGE_NAME}:${TAG}
- docker tag 727006795293.dkr.ecr.us-east-1.amazonaws.com/${CONTROLLER_IMAGE_NAME}:${TAG} datadog/${CONTROLLER_IMAGE_NAME}:${TAG}
- docker push datadog/${CONTROLLER_IMAGE_NAME}:${TAG}
- docker pull 727006795293.dkr.ecr.us-east-1.amazonaws.com/${INJECTOR_IMAGE_NAME}:${TAG}
- docker tag 727006795293.dkr.ecr.us-east-1.amazonaws.com/${INJECTOR_IMAGE_NAME}:${TAG} datadog/${INJECTOR_IMAGE_NAME}:${TAG}
- docker push datadog/${INJECTOR_IMAGE_NAME}:${TAG}
- docker pull 727006795293.dkr.ecr.us-east-1.amazonaws.com/${HANDLER_IMAGE_NAME}:${TAG}
- docker tag 727006795293.dkr.ecr.us-east-1.amazonaws.com/${HANDLER_IMAGE_NAME}:${TAG} datadog/${HANDLER_IMAGE_NAME}:${TAG}
- docker push datadog/${HANDLER_IMAGE_NAME}:${TAG}
release-docker-hub-ref:
<<: *release-docker-hub
when: manual
except:
- tags
variables:
TAG: "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
release-docker-hub-tag:
<<: *release-docker-hub
when: manual
only:
- tags
variables:
TAG: "${CI_COMMIT_TAG}"