forked from DataDog/datadog-agent
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
244 lines (221 loc) · 9.68 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
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
stages:
- triggers
# Gitlab CI Process:
# - Molecule instances spun up won't run for longer than 2 hours and 30 minutes. After the max time, a script will clean those instances to prevent EC2 costs from racking up from zombie instances
# - Only one instance per branch is allowed. What that means is if you push up another commit, the prepare stage will destroy the ec2 machine from your previous builds. If you get a message that says x-x-x-branch-name-lock, that means you have a prev branch still running and need to kill that branch to release the lock to allow your new branch to continue. This prevents a lot of useless EC2 instances from running and building up costs (We did include interrupt but GitLab seems to be broken on interrupts atm)
# - If a step in the "Cleanup" stage ran to destroy a molecule machine, or your acceptance step complains about "Unable to reach the ssh machine", then your molecule instance might have been destroyed or cleaned up. To recreate it, rerun the appropriate "Prepare" stage step to spin the machine back up
# Supported Commit Message Functionality:
# ** Default: Note these do not have to be defined, by default everything will be included except secrets and localinstall which **
# ** falls on master and tags **
# The following will run a single molecule pipeline and ignore the rest
# this will reduce ec2 costs, possible wait times and clutter
# - "<commit message> [molecule-compose]"
# - "<commit message> [molecule-integrations]"
# - "<commit message> [molecule-secrets]"
# - "<commit message> [molecule-localinstall]"
# - "<commit message> [molecule-kubernetes]"
# - "<commit message> [molecule-swarm]"
# - "<commit message> [molecule-vms]"
# You can also reduce ec2 costs and clutter by defining the py version you want to build
# - "<commit message> [py2]"
# - "<commit message> [py3]"
# This would be ideal to reduce the pipeline build to only what's required
# You can combine tags from the top to stack filters for example:
# - "<commit message> [py2][molecule-compose]"
# - "<commit message> [py3][molecule-secrets][molecule-vms]"
# You can also reduce the costs by running no molecule tests
# - "<commit message> [molecule-none]"
variables: &commonvariables
# The SRC_PATH is in the GOPATH of the builders which
# currently is /go
SRC_PATH: /go/src/github.com/StackVista/stackstate-agent
# Directory in which we execute the omnibus build.
# For an unknown reason, it does not go well with
# a ruby dependency if we build directly into $CI_PROJECT_DIR/.omnibus
OMNIBUS_BASE_DIR: /.omnibus
OMNIBUS_BASE_DIR_WIN: c:/omnibus-ruby #\$CI_RUNNER_ID
# Directory in which we execute the omnibus build for SUSE
# as we want to separate the RPM built for this distro.
BCC_VERSION: v0.12.0
SYSTEM_PROBE_GO_VERSION: 1.16.7
DATADOG_AGENT_EMBEDDED_PATH: /opt/datadog-agent/embedded
ARCH: amd64
VCINSTALLDIR: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community"
MOLECULE_K8S_CLUSTER: eks_test_cluster_1_21
# This variable represents which one of the gitlab pipelines will contain most of the jobs that's not required for both pipelines to run.
# IE VMS is a massive jobs and only has to run on either v2 or the v3 pipeline. With this variable you can control on which of the pipelines
# do jobs like these run on
PRIMARY_MAJOR_VERSION: '3'
PROCESS_AGENT_TEST_REPO: stackstate-process-agent-test
AGENT_HELM_CHART_VERSION: ""
STACKSTATE_HELM_CHART_VERSION: ""
RUNNERS_IP: $RUNNERS_IP # IP of NAT Gateway from tooling account (where kubernetes runners live)
STS_DOCKER_K8S_REPO: stackstate-k8s-agent
STS_DOCKER_K8S_REPO_CLUSTER: stackstate-k8s-cluster-agent
DD_KUBE_RESOURCES_NAMESPACE: "default" # this is here to make sure k8s based unit tests do not pick up namespaces from the environment when running in k8s
.agent2_variables: &agent2_variables
CONDA_ENV: ddpy2
PYTHON_RUNTIMES: '2'
MAJOR_VERSION: '2'
STS_VER: 'v2'
STS_AWS_RELEASE_BUCKET: stackstate-agent-2
STS_AWS_TEST_BUCKET: stackstate-agent-2-test
STS_AWS_RELEASE_BUCKET_YUM: stackstate-agent-2-rpm
STS_AWS_TEST_BUCKET_YUM: stackstate-agent-2-rpm-test
STS_AWS_RELEASE_BUCKET_WIN: stackstate-agent-2
STS_AWS_TEST_BUCKET_WIN: stackstate-agent-2-test
STS_DOCKER_RELEASE_REPO: stackstate-agent-2
STS_DOCKER_TEST_REPO: stackstate-agent-2-test
STS_DOCKER_RELEASE_REPO_TRACE: stackstate-trace-agent
STS_DOCKER_TEST_REPO_TRACE: stackstate-trace-agent-test
STS_DOCKER_RELEASE_REPO_CLUSTER: stackstate-cluster-agent
STS_DOCKER_TEST_REPO_CLUSTER: stackstate-cluster-agent-test
STS_DOCKER_RELEASE_REPO_SWARM: stackstate-swarm-agent
STS_DOCKER_TEST_REPO_SWARM: stackstate-swarm-agent-test
.agent3_variables: &agent3_variables
CONDA_ENV: ddpy3
PYTHON_RUNTIMES: '3'
MAJOR_VERSION: '3'
STS_VER: 'v3'
STS_AWS_RELEASE_BUCKET: stackstate-agent-3
STS_AWS_TEST_BUCKET: stackstate-agent-3-test
STS_AWS_RELEASE_BUCKET_YUM: stackstate-agent-3-rpm
STS_AWS_TEST_BUCKET_YUM: stackstate-agent-3-rpm-test
STS_AWS_RELEASE_BUCKET_WIN: stackstate-agent-3
STS_AWS_TEST_BUCKET_WIN: stackstate-agent-3-test
STS_DOCKER_RELEASE_REPO: stackstate-agent
STS_DOCKER_TEST_REPO: stackstate-agent-test
STS_DOCKER_RELEASE_REPO_TRACE: stackstate-trace-agent
STS_DOCKER_TEST_REPO_TRACE: stackstate-trace-agent-test
STS_DOCKER_RELEASE_REPO_CLUSTER: stackstate-cluster-agent
STS_DOCKER_TEST_REPO_CLUSTER: stackstate-cluster-agent-test
STS_DOCKER_RELEASE_REPO_SWARM: stackstate-swarm-agent
STS_DOCKER_TEST_REPO_SWARM: stackstate-swarm-agent-test
# we do not build trace-agent and cluster-agent for v2
.rules:
- &exclude_on_cluster_agent
if: $CI_COMMIT_MESSAGE =~ /\[cluster-agent]/
when: never
- &include_on_cluster_agent
if: $CI_COMMIT_MESSAGE =~ /\[cluster-agent]/
when: on_success
- &exclude_on_tag_v2
if: $CI_COMMIT_TAG =~ /2\..*/
when: never
- &exclude_on_tag_v3
if: $CI_COMMIT_TAG =~ /3\..*/
when: never
- &scheduled_master_pipeline
if: $CI_COMMIT_TAG || ($CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule")
when: always
.other_files_rule: &other_files_rule
# Check if any files (not MD) changed
# Glob syntax that checks for changes in all files except files that end with .md, .mdown or .markdown extension.
# (Glob syntax tester: https://toools.cloud/miscellaneous/glob-tester)
# Run pipeline for merge requests and not for branch pipelines when a commit is pushed
- if: $CI_MERGE_REQUEST_IID
changes:
- "**/{!(*.markdown|*.mdown|*.md),.*}"
# If any non-MD files changed, always run the pipeline.
when: always
# Do not run pipeline for branch commits when there is an open merge request available
- if: $CI_OPEN_MERGE_REQUESTS && $CI_COMMIT_BRANCH
when: never
# Run pipeline for branch commits when no merge requests are available
- if: $CI_COMMIT_BRANCH || $CI_COMMIT_REF_NAME == "master"
changes:
- "**/{!(*.markdown|*.mdown|*.md),.*}"
# If any non-MD files changed, always run the pipeline.
when: always
.md_only_rule: &md_only_rule
# Check if any MD files changed
# Glob syntax that checks for changes in files ending with .md, .mdown or .markdown extension.
# (Glob syntax tester: https://toools.cloud/miscellaneous/glob-tester)
# Run pipeline for merge requests and not for branch pipelines when a commit is pushed
- if: $CI_MERGE_REQUEST_IID
changes:
- "**/*.{markdown,mdown,md}"
# If only MD files changed, don't run the pipeline.
when: manual
# Allow failure must be true, else manual pipelines can never be successful without running the manual jobs.
allow_failure: true
# Do not run pipeline for branch commits when there is an open merge request available
- if: $CI_OPEN_MERGE_REQUESTS && $CI_COMMIT_BRANCH
when: never
# Run pipeline for branch commits when no merge requests are available
- if: $CI_COMMIT_BRANCH || $CI_COMMIT_REF_NAME == "master"
changes:
- "**/*.{markdown,mdown,md}"
# If only MD files changed, don't run the pipeline.
when: manual
# Allow failure must be true, else manual pipelines can never be successful without running the manual jobs.
allow_failure: true
#agent2:
# stage: triggers
# variables:
# <<: *commonvariables
# <<: *agent2_variables
# trigger:
# include: .gitlab-ci-agent.yml
# strategy: depend
# rules:
# - <<: *exclude_on_cluster_agent
# # exclude this pipeline if we're running a v3 tag pipeline
# - <<: *exclude_on_tag_v3
# - if: $CI_COMMIT_MESSAGE =~ /\[py3]/
# when: never
# - <<: *scheduled_master_pipeline
# - *other_files_rule
# - *md_only_rule
# - when: always
agent3:
stage: triggers
variables:
<<: *commonvariables
<<: *agent3_variables
trigger:
include: .gitlab-ci-agent.yml
strategy: depend
rules:
- <<: *exclude_on_cluster_agent
# exclude this pipeline if we're running a v2 tag pipeline
- <<: *exclude_on_tag_v2
- if: $CI_COMMIT_MESSAGE =~ /\[py2]/
when: never
- <<: *scheduled_master_pipeline
- *other_files_rule
- *md_only_rule
- when: always
cluster_agent:
stage: triggers
variables:
<<: *commonvariables
<<: *agent3_variables
trigger:
include: .gitlab-ci-cluster-agent.yml
strategy: depend
rules:
- <<: *include_on_cluster_agent
- when: never
build_beest_runners:
stage: triggers
trigger:
include: .gitlab-ci-beest.yml
strategy: depend
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
build_agent_runners:
stage: triggers
variables:
<<: *commonvariables
trigger:
include: .gitlab-ci-build-runners.yml
strategy: depend
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH