-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathdocker_linux.yml
308 lines (285 loc) · 11.6 KB
/
docker_linux.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
---
.docker_build_job_definition:
stage: container_build
script:
- TAG_SUFFIX=${TAG_SUFFIX:-}
- BUILD_ARG=${BUILD_ARG:-}
- |
if [[ "$BUCKET_BRANCH" == "nightly" && ( "$IMAGE" =~ "ci/datadog-agent/agent" || "$IMAGE" =~ "ci/datadog-agent/cluster-agent" || "$IMAGE" =~ "ci/datadog-agent/cws-instrumentation" ) ]]; then
export ECR_RELEASE_SUFFIX="-nightly"
else
export ECR_RELEASE_SUFFIX=${CI_COMMIT_TAG+-release}
fi
- TARGET_TAG=${IMAGE}${ECR_RELEASE_SUFFIX}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}$TAG_SUFFIX-$ARCH
# DockerHub login for build to limit rate limit when pulling base images
- DOCKER_LOGIN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $DOCKER_REGISTRY_RO user) || exit $?
- $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $DOCKER_REGISTRY_RO token | docker login --username "$DOCKER_LOGIN" --password-stdin "$DOCKER_REGISTRY_URL"
- EXIT="${PIPESTATUS[0]}"; if [ $EXIT -ne 0 ]; then echo "Unable to locate credentials needs gitlab runner restart"; exit $EXIT; fi
# Build image, use target none label to avoid replication
- docker buildx build --no-cache --push --pull --platform linux/$ARCH --build-arg CIBUILD=true --build-arg GENERAL_ARTIFACTS_CACHE_BUCKET_URL=${GENERAL_ARTIFACTS_CACHE_BUCKET_URL} $BUILD_ARG --build-arg DD_GIT_REPOSITORY_URL=https://github.com/DataDog/datadog-agent --build-arg DD_GIT_COMMIT_SHA=${CI_COMMIT_SHA} --file $BUILD_CONTEXT/Dockerfile --tag ${TARGET_TAG} --label "org.opencontainers.image.created=$(date --rfc-3339=seconds)" --label "org.opencontainers.image.authors=Datadog <package@datadoghq.com>" --label "org.opencontainers.image.source=https://github.com/DataDog/datadog-agent" --label "org.opencontainers.image.version=$(inv agent.version)" --label "org.opencontainers.image.revision=${CI_COMMIT_SHA}" --label "org.opencontainers.image.vendor=Datadog, Inc." --label "target=none" $BUILD_CONTEXT
# Squash image
- crane flatten -t ${TARGET_TAG} ${TARGET_TAG}
# Workaround for temporary network failures
retry: 2
timeout: 30m
# Base template for jobs that don't rely on the packaging job artifacts but
# rather from binaries stored in the 'dd-ci-artefacts-build-stable' bucket
.docker_build_s3:
before_script:
- aws s3 sync --only-show-errors $S3_ARTIFACTS_URI $BUILD_CONTEXT
# Base template to move the packaged artifact from gitlab into the build
# context
.docker_build_artifact:
before_script:
- mv $OMNIBUS_PACKAGE_DIR/*.xz $BUILD_CONTEXT
.docker_build_job_definition_amd64:
extends: .docker_build_job_definition
image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES
tags: ["arch:amd64"]
variables:
ARCH: amd64
.docker_build_job_definition_arm64:
extends: .docker_build_job_definition
image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_arm64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES
tags: ["arch:arm64"]
variables:
ARCH: arm64
# build agent7 image
docker_build_agent7:
extends: [.docker_build_job_definition_amd64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-agent-7-x64
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7
BUILD_ARG: --target test --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-amd64.tar.xz
single_machine_performance-amd64-a7:
extends: .docker_publish_job_definition
stage: container_build
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- docker_build_agent7
variables:
IMG_REGISTRIES: internal-aws-smp
IMG_SOURCES: ${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-amd64
IMG_DESTINATIONS: 08450328-agent:${CI_COMMIT_SHA}-7-amd64
docker_build_agent7_arm64:
extends: [.docker_build_job_definition_arm64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-agent-7-arm64
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7
BUILD_ARG: --target test --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-arm64.tar.xz
# build agent7 fips image
docker_build_fips_agent7:
extends: [.docker_build_job_definition_amd64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-agent-7-x64-fips
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-fips
BUILD_ARG: --target test --build-arg FIPS_ENABLED=1 --build-arg DD_AGENT_ARTIFACT=datadog-fips-agent-7*-amd64.tar.xz
docker_build_fips_agent7_arm64:
extends: [.docker_build_job_definition_arm64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-agent-7-arm64-fips
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-fips
BUILD_ARG: --target test --build-arg FIPS_ENABLED=1 --build-arg DD_AGENT_ARTIFACT=datadog-fips-agent-7*-arm64.tar.xz
# build agent7 jmx image
docker_build_agent7_jmx:
extends: [.docker_build_job_definition_amd64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-agent-7-x64
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-jmx
BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-amd64.tar.xz
docker_build_agent7_jmx_arm64:
extends: [.docker_build_job_definition_arm64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-agent-7-arm64
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-jmx
BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-agent-7*-arm64.tar.xz
docker_build_fips_agent7_jmx:
extends: [.docker_build_job_definition_amd64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-agent-7-x64-fips
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-fips-jmx
BUILD_ARG: --target test --build-arg FIPS_ENABLED=1 --build-arg WITH_JMX=true --build-arg WITH_JMX_FIPS=true --build-arg DD_AGENT_ARTIFACT=datadog-fips-agent-7*-amd64.tar.xz
docker_build_fips_agent7_arm64_jmx:
extends: [.docker_build_job_definition_arm64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-agent-7-arm64-fips
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-fips-jmx
BUILD_ARG: --target test --build-arg FIPS_ENABLED=1 --build-arg WITH_JMX=true --build-arg WITH_JMX_FIPS=true --build-arg DD_AGENT_ARTIFACT=datadog-fips-agent-7*-arm64.tar.xz
# build agent7 UA image
docker_build_ot_agent7:
extends: [.docker_build_job_definition_amd64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-ot-agent-7-x64
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-ot-beta
BUILD_ARG: --target test --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-amd64.tar.xz
docker_build_ot_agent7_arm64:
extends: [.docker_build_job_definition_arm64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-ot-agent-7-arm64
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-ot-beta
BUILD_ARG: --target test --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-arm64.tar.xz
# build agent7 jmx image
docker_build_ot_agent7_jmx:
extends: [.docker_build_job_definition_amd64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-ot-agent-7-x64
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-ot-beta-jmx
BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-amd64.tar.xz
docker_build_ot_agent7_jmx_arm64:
extends: [.docker_build_job_definition_arm64, .docker_build_artifact]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: datadog-ot-agent-7-arm64
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/agent
BUILD_CONTEXT: Dockerfiles/agent
TAG_SUFFIX: -7-ot-beta-jmx
BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent-7*-arm64.tar.xz
# build the cluster-agent image
docker_build_cluster_agent_amd64:
extends: [.docker_build_job_definition_amd64, .docker_build_s3]
rules: !reference [.on_tag_or_a7]
needs:
- job: cluster_agent-build_amd64
artifacts: false
- job: cws_instrumentation-build_amd64
artifacts: false
- job: cws_instrumentation-build_arm64
artifacts: false
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/cluster-agent
BUILD_CONTEXT: Dockerfiles/cluster-agent
before_script:
- !reference [.docker_build_s3, before_script]
- cp -Rvf Dockerfiles/agent/nosys-seccomp Dockerfiles/cluster-agent/
docker_build_cluster_agent_arm64:
extends: [.docker_build_job_definition_arm64, .docker_build_s3]
rules: !reference [.on_tag_or_a7]
needs:
- job: cluster_agent-build_arm64
artifacts: false
- job: cws_instrumentation-build_amd64
artifacts: false
- job: cws_instrumentation-build_arm64
artifacts: false
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/cluster-agent
BUILD_CONTEXT: Dockerfiles/cluster-agent
before_script:
- !reference [.docker_build_s3, before_script]
- cp -Rvf Dockerfiles/agent/nosys-seccomp Dockerfiles/cluster-agent/
# build the cws-instrumentation image
docker_build_cws_instrumentation_amd64:
extends: [.docker_build_job_definition_amd64, .docker_build_s3]
rules: !reference [.on_tag_or_a7]
needs:
- job: cws_instrumentation-build_amd64
artifacts: false
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/cws-instrumentation
BUILD_CONTEXT: Dockerfiles/cws-instrumentation
docker_build_cws_instrumentation_arm64:
extends: [.docker_build_job_definition_arm64, .docker_build_s3]
rules: !reference [.on_tag_or_a7]
needs:
- job: cws_instrumentation-build_arm64
artifacts: false
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/cws-instrumentation
BUILD_CONTEXT: Dockerfiles/cws-instrumentation
# build the dogstatsd image
docker_build_dogstatsd_amd64:
extends: [.docker_build_job_definition_amd64, .docker_build_s3]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: build_dogstatsd_static-binary_x64
artifacts: false
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/dogstatsd
BUILD_CONTEXT: Dockerfiles/dogstatsd/alpine
timeout: 20m
# build the dogstatsd image
docker_build_dogstatsd_arm64:
extends: [.docker_build_job_definition_arm64, .docker_build_s3]
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- job: build_dogstatsd_static-binary_arm64
artifacts: false
variables:
IMAGE: registry.ddbuild.io/ci/datadog-agent/dogstatsd
BUILD_CONTEXT: Dockerfiles/dogstatsd/alpine
timeout: 20m