-
Notifications
You must be signed in to change notification settings - Fork 178
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
159 lines (150 loc) · 5.56 KB
/
.gitlab-ci.yml
File metadata and controls
159 lines (150 loc) · 5.56 KB
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
stages:
- build
- tests
- deploy
- ci-build
variables:
GIT_SUBMODULE_STRATEGY: recursive
# Only clone submodules required by default test jobs
GIT_SUBMODULE_PATHS: libdatadog tests/FeatureFlags/ffe-system-test-data
RELIABILITY_ENV_BRANCH:
value: "master"
description: "Run a specific datadog-reliability-env branch downstream"
SYSTEM_TESTS_LIBRARY: php
include:
- project: DataDog/apm-reliability/libdatadog-build
ref: 5826819695d93286569e70ed087ae6bf906ce2c3
file: templates/ci_authenticated_job.yml
- local: .gitlab/ci-images.yml
generate-templates:
stage: build
image: registry.ddbuild.io/images/mirror/php:8.2-cli
tags: [ "arch:amd64" ]
needs: []
script:
- |
touch libdatadog.env # always present so dotenv artifact never errors
# On libdatadog CI schedule: fetch the latest SHA from GitHub, export it so
# generate-common.php can embed it directly in compilation job before_scripts.
if [ "${SCHEDULED_LIBDATADOG_LATEST:-}" = "true" ]; then
set -x
apt update
apt install -y git
LIBDATADOG_PINNED_SHA=$(git ls-tree HEAD libdatadog | awk '{print $3}')
LIBDATADOG_OVERRIDE_SHA=$(git ls-remote https://github.com/DataDog/libdatadog main | cut -f1)
export LIBDATADOG_OVERRIDE_SHA LIBDATADOG_PINNED_SHA
printf 'LIBDATADOG_OVERRIDE_SHA=%s\nLIBDATADOG_PINNED_SHA=%s\n' "$LIBDATADOG_OVERRIDE_SHA" "$LIBDATADOG_PINNED_SHA" >> libdatadog.env
if [ "$LIBDATADOG_OVERRIDE_SHA" = "$LIBDATADOG_PINNED_SHA" ]; then
echo 'LIBDATADOG_NO_CHANGES=true' >> libdatadog.env
else
echo 'LIBDATADOG_NO_CHANGES=false' >> libdatadog.env
fi
elif [ "${CI_COMMIT_BRANCH:-}" = "bot/libdatadog-latest" ]; then
# Feedback run after a bot commit: the submodule already points to the tested SHA.
# Don't export — generate-common.php must not inject fetch/checkout (no-op anyway).
set -x
apt update
apt install -y git
LIBDATADOG_SHA=$(git ls-tree HEAD libdatadog | awk '{print $3}')
printf 'LIBDATADOG_OVERRIDE_SHA=%s\nLIBDATADOG_FEEDBACK_RUN=true\n' "$LIBDATADOG_SHA" >> libdatadog.env
fi
- php ./.gitlab/generate-package.php | tee .gitlab/package-gen.yml
- php ./.gitlab/generate-tracer.php | tee .gitlab/tracer-gen.yml
- php ./.gitlab/generate-appsec.php | tee .gitlab/appsec-gen.yml
- php ./.gitlab/generate-profiler.php | tee .gitlab/profiler-gen.yml
- php ./.gitlab/generate-shared.php | tee .gitlab/shared-gen.yml
variables:
GIT_SUBMODULE_STRATEGY: none
artifacts:
paths:
- .gitlab/*-gen.yml
reports:
dotenv: libdatadog.env
tracer-trigger:
stage: tests
needs: [ "generate-templates" ]
trigger:
include:
- artifact: .gitlab/tracer-gen.yml
job: "generate-templates"
strategy: depend
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_PATHS: libdatadog tests/FeatureFlags/ffe-system-test-data
appsec-trigger:
stage: tests
needs: [ "generate-templates" ]
trigger:
include:
- artifact: .gitlab/appsec-gen.yml
job: "generate-templates"
strategy: depend
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
GIT_SUBMODULE_PATHS: libdatadog appsec/third_party/cpp-base64 appsec/third_party/libddwaf appsec/third_party/libddwaf-rust appsec/third_party/msgpack-c
profiler-trigger:
stage: tests
needs: [ "generate-templates" ]
trigger:
include:
- artifact: .gitlab/profiler-gen.yml
job: "generate-templates"
strategy: depend
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
shared-trigger:
stage: tests
needs: [ "generate-templates" ]
trigger:
include:
- artifact: .gitlab/shared-gen.yml
job: "generate-templates"
strategy: depend
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
package-trigger:
stage: build
needs: [ "generate-templates" ]
trigger:
include:
- artifact: .gitlab/package-gen.yml
job: "generate-templates"
- local: .gitlab/benchmarks.yml
strategy: depend
forward:
pipeline_variables: true
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_PATHS: libdatadog tests/FeatureFlags/ffe-system-test-data appsec/third_party/cpp-base64 appsec/third_party/libddwaf appsec/third_party/libddwaf-rust appsec/third_party/msgpack-c
NIGHTLY_BUILD: $NIGHTLY_BUILD
# Runs after the full CI completes. Triggered in two situations:
# 1. Scheduled libdatadog CI run (SCHEDULED_LIBDATADOG_LATEST=true)
# 2. Push to bot/libdatadog-latest by the bot — feeds CI results back so we can verify whether Claude's fixes actually worked. The [no-ci-feedback] marker in bot commits prevents triggering a third run.
analyze-and-create-pr:
stage: deploy
rules:
- if: $SCHEDULED_LIBDATADOG_LATEST == "true"
when: always
- if: '$CI_COMMIT_BRANCH == "bot/libdatadog-latest" && $CI_COMMIT_AUTHOR =~ /github-actions\[bot\]/ && $CI_COMMIT_MESSAGE !~ /\[no-ci-feedback\]/'
when: always
- when: never
needs:
- job: generate-templates
artifacts: true
- tracer-trigger
- appsec-trigger
- profiler-trigger
- shared-trigger
- package-trigger
trigger:
include:
- local: .gitlab/libdatadog-latest.yml
strategy: depend
variables:
LIBDATADOG_OVERRIDE_SHA: $LIBDATADOG_OVERRIDE_SHA
LIBDATADOG_PINNED_SHA: $LIBDATADOG_PINNED_SHA
LIBDATADOG_NO_CHANGES: $LIBDATADOG_NO_CHANGES
LIBDATADOG_FEEDBACK_RUN: $LIBDATADOG_FEEDBACK_RUN
PARENT_PIPELINE_ID: $CI_PIPELINE_ID