-
Notifications
You must be signed in to change notification settings - Fork 44
/
.gitlab-ci.yml
207 lines (191 loc) · 6.03 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
before_script:
- rm -rf /root/go/src/gitlab.jiagouyun.com/cloudcare-tools/datakit
- mkdir -p /root/go/src/gitlab.jiagouyun.com/cloudcare-tools/datakit
- cp -r ./. /root/go/src/gitlab.jiagouyun.com/cloudcare-tools/datakit
- cd /root/go/src/gitlab.jiagouyun.com/cloudcare-tools/datakit
- source ~/.ossenv
- uname -a
- echo $DK_BPF_KERNEL_SRC_PATH
- export PATH=/usr/local/go1.19.12/bin:$PATH
- export GOROOT=/usr/local/go1.19.12
- go version
variables:
PROJECT: "datakit"
CI_VERSION: "1.61.0"
CI_TESTING_VERSION: $CI_VERSION-testing_$CI_COMMIT_BRANCH
DISABLED_MR_TARGET_BRANCHES: '/^master|main/'
DISABLED_MR_TITLE: '/^(\[Draft\]|\(Draft\)|Draft:)/'
stages:
- test
- deploy_ebpf
- deploy
# run lint and unit test for most of the branches
ci_lint_and_ut:
stage: deploy
resource_group: production
rules:
# No pipeline when there is a MR whose title starts with Draft
# Disable merge request to master/main branch
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(\[Draft\]|\(Draft\)|Draft:)/
when: never
# Trigger a pipeline in case of MR event, which means the MR is ready, since we did not go through the first case
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
script:
- nvm use v16.14.0
- make clean
- make detect_mr_target_branch MERGE_REQUEST_TARGET_BRANCH="$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
- make local # build binary
- make check_testing_conf_compatible
- make lint AUTO_FIX=off
- make ut DATAWAY_URL="$TESTING_METRIC_DATAWAY" UT_EXCLUDE="$UT_EXCLUDE" UT_ONLY="$UT_ONLY" UT_PARALLEL="$UT_PARALLEL"
tags:
- cloudcare-ft
ut-datakit-production:
stage: test
resource_group: production
only:
- unstable
- master
script:
- nvm use v16.14.0
- make clean
- make production_notify GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_VERSION"
- make lint AUTO_FIX=off
- make ut DATAWAY_URL="$TESTING_METRIC_DATAWAY" UT_EXCLUDE="$UT_EXCLUDE" UT_PARALLEL="$UT_PARALLEL"
tags:
- cloudcare-ft
ut-datakit-testing:
stage: test
resource_group: production
only:
- testing
- /^testing-.*$/
script:
- nvm use v16.14.0
- make clean
- make testing_notify GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_TESTING_VERSION"
#- make lint AUTO_FIX=off
#- make ut DATAWAY_URL="$TESTING_METRIC_DATAWAY" UT_EXCLUDE="$UT_EXCLUDE"
tags:
- cloudcare-ft
release-ebpf-amd64-testing:
stage: deploy_ebpf
resource_group: production
needs: [ut-datakit-testing]
image: pubrepo.jiagouyun.com/ebpf-dev/datakit-developer:1.9
only:
- testing
- /^testing-.*$/
script:
- make clean
- make pub_epbf_testing DATAKIT_EBPF_ARCHS="linux/amd64" GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_TESTING_VERSION"
tags:
- cloudcare-ft-docker
release-ebpf-aarch64-testing:
stage: deploy_ebpf
resource_group: production
needs: [ut-datakit-testing]
image: pubrepo.jiagouyun.com/ebpf-dev/datakit-developer:1.9
only:
- testing
- /^testing-.*$/
script:
- make clean
- make pub_epbf_testing DATAKIT_EBPF_ARCHS="linux/arm64" GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_TESTING_VERSION"
tags:
- dk-arm-docker-runner
release-ebpf-amd64-production:
stage: deploy_ebpf
resource_group: production
needs: [ut-datakit-production]
image: pubrepo.jiagouyun.com/ebpf-dev/datakit-developer:1.9
only:
- master
- unstable
script:
- make clean
- make pub_ebpf_production DATAKIT_EBPF_ARCHS="linux/amd64" GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_VERSION"
tags:
- cloudcare-ft-docker
release-ebpf-aarch64-production:
stage: deploy_ebpf
resource_group: production
needs: [ut-datakit-production]
image: pubrepo.jiagouyun.com/ebpf-dev/datakit-developer:1.9
only:
- master
- unstable
script:
- make clean
- make pub_ebpf_production DATAKIT_EBPF_ARCHS="linux/arm64" GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_VERSION"
tags:
- dk-arm-docker-runner
release-testing:
stage: deploy
resource_group: production
needs:
[
ut-datakit-testing,
release-ebpf-amd64-testing,
release-ebpf-aarch64-testing,
]
only:
- testing
- /^testing-.*$/
script:
- export AWS_ACCESS_KEY_ID="$TESTING_AWS_ACCESS_KEY_ID"
- export AWS_SECRET_ACCESS_KEY="$TESTING_AWS_SECRET_ACCESS_KEY"
# building && publish testing
- make clean
- make testing GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_TESTING_VERSION" PKGEBPF=true # do not set VERSION here, use git version
- make check_testing_conf_compatible
- make testing_image VERSION="$CI_TESTING_VERSION"
- make uos_image_testing GIT_BRANCH=$CI_COMMIT_BRANCH PKGEBPF=true VERSION="$CI_TESTING_VERSION"
tags:
- cloudcare-ft
release-stable:
stage: deploy
resource_group: production
needs:
[
ut-datakit-production,
release-ebpf-amd64-production,
release-ebpf-aarch64-production,
]
only:
- master
except: # disable CI on tag push
- tags
script:
- make clean
- make production GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_VERSION" PKGEBPF=true # update the version on each release
- make check_production_conf_compatible
- make pub_conf_samples
- make production_image GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_VERSION"
- make uos_image_production GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_VERSION" PKGEBPF=true
- make push_ligai_version VERSION="$CI_VERSION" LIGAI_CUSTOMFIELD=$LIGAI_CUSTOMFIELD LIGAI_AUTO_DEVOPS_TOKEN=$LIGAI_AUTO_DEVOPS_TOKEN LIGAI_API=$LIGAI_API
tags:
- cloudcare-ft
# for testing current issue, should delete after merge into master
current-testing:
stage: deploy
resource_group: production
only:
- /^xxx-.*$/
script:
- make clean
- make testing GIT_BRANCH=$CI_COMMIT_BRANCH VERSION="$CI_TESTING_VERSION"
- make testing_image VERSION="$CI_TESTING_VERSION"
tags:
- cloudcare-ft
build-profiling-image:
stage: deploy
resource_group: production
only:
- /^k8s_profilers[-_].*$/
script:
- pwd
- cd k8s-profilers && make build
- pwd
tags:
- cloudcare-ft