forked from DataDog/dd-trace-rb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
184 lines (170 loc) · 4.73 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
stages:
- manual-images
- package
- deploy
- macrobenchmarks
- microbenchmarks
include:
- remote: https://gitlab-templates.ddbuild.io/apm/packaging.yml
- local: ".gitlab/benchmarks.yml"
# -----------------------------------------------------
# Reliability Environment configuration
# -----------------------------------------------------
variables:
RUBY_PACKAGE_VERSION:
description: "The version of the gem to build the rpm/deb package"
DOWNSTREAM_BRANCH:
value: "master"
description: "Run a specific datadog-reliability-env branch downstream"
RUBY_CUSTOM_IMAGE_BASE: $DOCKER_REGISTRY/ci/dd-trace-rb/custom_ruby
default:
tags: [ "runner:main", "size:large" ]
build-image:
stage: manual-images
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push"
changes:
- .gitlab/Dockerfile-*
when: manual
allow_failure: true
tags: [ "runner:docker" ]
image: $DOCKER_REGISTRY/docker:20.10.13
parallel:
matrix:
# ADD NEW RUBIES HERE
- RUBY_VERSION: [ '3.2.2', '3.1.4', '3.0.6', '2.7.8' ]
script:
- >
docker build
--tag $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:$CI_PIPELINE_ID
--file .gitlab/Dockerfile-$RUBY_VERSION
.
- docker push --all-tags $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION
promote-image:
stage: manual-images
when: manual
tags: [ "runner:docker" ]
image: $DOCKER_REGISTRY/docker:20.10.13
parallel:
matrix:
# ADD NEW RUBIES HERE
- RUBY_VERSION: [ '3.2.2', '3.1.4', '3.0.6', '2.7.8' ]
script:
- docker pull $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:$CI_PIPELINE_ID
- docker tag $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:$CI_PIPELINE_ID $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:current
- docker push $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:current
install-base-ruby-gems:
image: $RUBY_CUSTOM_IMAGE_BASE/3.2.2:current
needs:
- check-gem-presence
stage: package
rules:
- if: $RUBY_PACKAGE_VERSION
when: on_success
- if: '$CI_COMMIT_TAG =~ /^v.*/'
when: on_success
script:
# This would install all dependencies
- .gitlab/prepare_pkg_directory.sh
- ruby pkg/install_ddtrace_deps.rb debase-ruby_core_source libdatadog libddwaf datadog-ci msgpack ffi ddtrace
artifacts:
paths:
- pkg
install-version-dependant-gems:
image: $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:current
parallel:
matrix:
- RUBY_VERSION: ["2.7.8", "3.0.6", "3.1.4"]
rules:
- if: $RUBY_PACKAGE_VERSION
when: on_success
- if: '$CI_COMMIT_TAG =~ /^v.*/'
when: on_success
stage: package
needs:
- check-gem-presence
- install-base-ruby-gems
script:
- ruby pkg/install_ddtrace_deps.rb msgpack ffi ddtrace
artifacts:
paths:
- pkg
check-gem-presence:
image: $RUBY_CUSTOM_IMAGE_BASE/3.2.2:current
rules:
- if: $RUBY_PACKAGE_VERSION
when: on_success
- if: '$CI_COMMIT_TAG =~ /^v.*/'
when: on_success
stage: package
script:
- .gitlab/check_gem_presence.sh
package:
extends: .package
needs:
- check-gem-presence
- install-version-dependant-gems
- install-base-ruby-gems
rules:
- if: $RUBY_PACKAGE_VERSION
when: on_success
- if: '$CI_COMMIT_TAG =~ /^v.*/'
when: on_success
script:
- ls ../pkg
- ../.gitlab/build-deb-rpm.sh
.release-package:
stage: deploy
variables:
PRODUCT_NAME: auto_inject-ruby
deploy_to_reliability_env:
stage: deploy
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_success
- when: manual
allow_failure: true
trigger:
project: DataDog/apm-reliability/datadog-reliability-env
branch: $DOWNSTREAM_BRANCH
variables:
UPSTREAM_BRANCH: $CI_COMMIT_REF_NAME
UPSTREAM_PROJECT_ID: $CI_PROJECT_ID
UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME
UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA
deploy_to_docker_registries:
stage: deploy
rules:
- if: '$POPULATE_CACHE'
when: never
- if: '$CI_COMMIT_TAG =~ /^v.*/'
when: delayed
start_in: 1 day
- when: manual
allow_failure: true
trigger:
project: DataDog/public-images
branch: main
strategy: depend
variables:
IMG_SOURCES: ghcr.io/datadog/dd-trace-rb/dd-lib-ruby-init:$CI_COMMIT_TAG
IMG_DESTINATIONS: dd-lib-ruby-init:$CI_COMMIT_TAG
IMG_SIGNING: "false"
deploy_latest_tag_to_docker_registries:
stage: deploy
rules:
- if: '$POPULATE_CACHE'
when: never
- if: '$CI_COMMIT_TAG =~ /^v.*/'
when: delayed
start_in: 1 day
- when: manual
allow_failure: true
trigger:
project: DataDog/public-images
branch: main
strategy: depend
variables:
IMG_SOURCES: ghcr.io/datadog/dd-trace-rb/dd-lib-ruby-init:$CI_COMMIT_TAG
IMG_DESTINATIONS: dd-lib-ruby-init:latest
IMG_SIGNING: "false"