1
+ variables:
2
+ CI_DOCKER_TARGET_IMAGE: registry.ddbuild.io/ci/datadog-lambda-js
3
+ CI_DOCKER_TARGET_VERSION: latest
4
+
1
5
stages:
2
6
- build
3
7
- test
@@ -11,18 +15,6 @@ default:
11
15
# Retry when the runner fails to start
12
16
- runner_system_failure
13
17
14
- .install-node: &install-node
15
- - apt-get update
16
- - apt-get install -y ca-certificates curl gnupg xxd
17
- - mkdir -p /etc/apt/keyrings
18
- - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
19
- # We are explicitly setting the node_18.x version for the installation
20
- - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
21
- - apt-get update
22
- - apt-get install nodejs -y
23
- - npm install --global yarn
24
- - npm install --global typescript
25
-
26
18
.node-before-script: &node-before-script
27
19
- echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc
28
20
- echo 'yarn-offline-mirror-pruning true' >> .yarnrc
@@ -36,10 +28,10 @@ default:
36
28
- $CI_PROJECT_DIR/.yarn-cache
37
29
policy: pull
38
30
39
- build- layer ({ { $runtime .name } }):
31
+ build layer ({ { $runtime .name } }):
40
32
stage: build
41
33
tags: ["arch:amd64"]
42
- image: registry.ddbuild.io/images/docker:20.10
34
+ image: $ { CI_DOCKER_TARGET_IMAGE } :$ { CI_DOCKER_TARGET_VERSION }
43
35
artifacts:
44
36
expire_in: 1 hr # Unsigned zips expire in 1 hour
45
37
paths:
@@ -49,14 +41,14 @@ build-layer ({{ $runtime.name }}):
49
41
script:
50
42
- NODE_VERSION={ { $runtime .node_version } } ./scripts/build_layers.sh
51
43
52
- check- layer- size ({ { $runtime .name } }):
44
+ check layer size ({ { $runtime .name } }):
53
45
stage: test
54
46
tags: ["arch:amd64"]
55
- image: registry.ddbuild.io/images/docker:20.10
47
+ image: $ { CI_DOCKER_TARGET_IMAGE } :$ { CI_DOCKER_TARGET_VERSION }
56
48
needs:
57
- - build- layer ({ { $runtime .name } })
49
+ - build layer ({ { $runtime .name } })
58
50
dependencies:
59
- - build- layer ({ { $runtime .name } })
51
+ - build layer ({ { $runtime .name } })
60
52
script:
61
53
- NODE_VERSION={ { $runtime .node_version } } ./scripts/check_layer_size.sh
62
54
@@ -66,122 +58,119 @@ lint ({{ $runtime.name }}):
66
58
image: registry.ddbuild.io/images/mirror/node:{ { $runtime .node_major_version } }-bullseye
67
59
cache: & { { $runtime .name } }-cache
68
60
before_script: *node-before-script
61
+ needs: []
69
62
script:
70
63
- yarn check-formatting
71
64
- yarn lint
72
65
73
- unit- test ({ { $runtime .name } }):
66
+ unit test ({ { $runtime .name } }):
74
67
stage: test
75
68
tags: ["arch:amd64"]
76
69
image: registry.ddbuild.io/images/mirror/node:{ { $runtime .node_major_version } }-bullseye
77
70
cache: & { { $runtime .name } }-cache
78
71
before_script: *node-before-script
72
+ needs: []
79
73
script:
80
74
- yarn build
81
75
- yarn test --ci --forceExit --detectOpenHandles
82
76
- bash <(curl -s https://codecov.io/bash)
83
77
84
- integration- test ({ { $runtime .name } }):
78
+ integration test ({ { $runtime .name } }):
85
79
stage: test
86
80
tags: ["arch:amd64"]
87
- image: registry.ddbuild.io/images/docker:20.10-py3
81
+ image: $ { CI_DOCKER_TARGET_IMAGE } :$ { CI_DOCKER_TARGET_VERSION }
88
82
needs:
89
- - build- layer ({ { $runtime .name } })
83
+ - build layer ({ { $runtime .name } })
90
84
dependencies:
91
- - build- layer ({ { $runtime .name } })
85
+ - build layer ({ { $runtime .name } })
92
86
cache: & { { $runtime .name } }-cache
93
87
variables:
94
88
CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true"
95
89
before_script:
96
- - *install-node
97
- - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source ./ci/get_secrets.sh
98
- - yarn global add serverless@^3.38.0 --prefix /usr/local
90
+ - EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source .gitlab/scripts/get_secrets.sh
99
91
- cd integration_tests && yarn install && cd ..
100
92
script:
101
93
- RUNTIME_PARAM={ { $runtime .node_major_version } } ./scripts/run_integration_tests.sh
102
94
103
95
{ { range $environment := (ds " environments" ).environments } }
104
96
105
97
{ { if or (eq $environment .name " prod" ) } }
106
- sign- layer ({ { $runtime .name } }):
98
+ sign layer ({ { $runtime .name } }):
107
99
stage: sign
108
100
tags: ["arch:amd64"]
109
- image: registry.ddbuild.io/images/docker:20.10-py3
101
+ image: $ { CI_DOCKER_TARGET_IMAGE } :$ { CI_DOCKER_TARGET_VERSION }
110
102
rules:
111
103
- if: '$CI_COMMIT_TAG =~ /^v.*/'
112
104
when: manual
113
105
needs:
114
- - build- layer ({ { $runtime .name } })
115
- - check- layer- size ({ { $runtime .name } })
106
+ - build layer ({ { $runtime .name } })
107
+ - check layer size ({ { $runtime .name } })
116
108
- lint ({ { $runtime .name } })
117
- - unit- test ({ { $runtime .name } })
118
- - integration- test ({ { $runtime .name } })
109
+ - unit test ({ { $runtime .name } })
110
+ - integration test ({ { $runtime .name } })
119
111
dependencies:
120
- - build- layer ({ { $runtime .name } })
112
+ - build layer ({ { $runtime .name } })
121
113
artifacts: # Re specify artifacts so the modified signed file is passed
122
114
expire_in: 1 day # Signed layers should expire after 1 day
123
115
paths:
124
116
- .layers/datadog_lambda_node{ { $runtime .node_version } }.zip
125
117
before_script:
126
- - apt-get update
127
- - apt-get install -y uuid-runtime
128
- - EXTERNAL_ID_NAME={ { $environment .external_id } } ROLE_TO_ASSUME={ { $environment .role_to_assume } } AWS_ACCOUNT={ { $environment .account } } source ./ci/get_secrets.sh
118
+ - EXTERNAL_ID_NAME={ { $environment .external_id } } ROLE_TO_ASSUME={ { $environment .role_to_assume } } AWS_ACCOUNT={ { $environment .account } } source .gitlab/scripts/get_secrets.sh
129
119
script:
130
120
- LAYER_FILE=datadog_lambda_node{ { $runtime .node_version } }.zip ./scripts/sign_layers.sh { { $environment .name } }
131
121
{ { end } }
132
122
133
- publish- layer- { { $environment .name } } ({ { $runtime .name } }):
123
+ publish layer { { $environment .name } } ({ { $runtime .name } }):
134
124
stage: publish
135
125
tags: ["arch:amd64"]
136
- image: registry.ddbuild.io/images/docker:20.10-py3
126
+ image: $ { CI_DOCKER_TARGET_IMAGE } :$ { CI_DOCKER_TARGET_VERSION }
137
127
rules:
138
128
- if: '"{ { $environment .name } }" =~ /^(sandbox|staging)/'
139
129
when: manual
140
130
allow_failure: true
141
131
- if: '$CI_COMMIT_TAG =~ /^v.*/'
142
132
needs:
143
133
{ { if or (eq $environment .name " prod" ) } }
144
- - sign- layer ({ { $runtime .name } })
134
+ - sign layer ({ { $runtime .name } })
145
135
{ { else } }
146
- - build- layer ({ { $runtime .name } })
147
- - check- layer- size ({ { $runtime .name } })
136
+ - build layer ({ { $runtime .name } })
137
+ - check layer size ({ { $runtime .name } })
148
138
- lint ({ { $runtime .name } })
149
- - unit- test ({ { $runtime .name } })
150
- - integration- test ({ { $runtime .name } })
139
+ - unit test ({ { $runtime .name } })
140
+ - integration test ({ { $runtime .name } })
151
141
{ { end } }
152
142
dependencies:
153
143
{ { if or (eq $environment .name " prod" ) } }
154
- - sign- layer ({ { $runtime .name } })
144
+ - sign layer ({ { $runtime .name } })
155
145
{ { else } }
156
- - build- layer ({ { $runtime .name } })
146
+ - build layer ({ { $runtime .name } })
157
147
{ { end } }
158
148
parallel:
159
149
matrix:
160
150
- REGION: { { range (ds " regions" ).regions } }
161
151
- { { .code } }
162
152
{ {- end} }
163
153
before_script:
164
- - EXTERNAL_ID_NAME={ { $environment .external_id } } ROLE_TO_ASSUME={ { $environment .role_to_assume } } AWS_ACCOUNT={ { $environment .account } } source ./ci /get_secrets.sh
154
+ - EXTERNAL_ID_NAME={ { $environment .external_id } } ROLE_TO_ASSUME={ { $environment .role_to_assume } } AWS_ACCOUNT={ { $environment .account } } source .gitlab/scripts /get_secrets.sh
165
155
script:
166
- - STAGE={ { $environment .name } } NODE_VERSION={ { $runtime .node_version } } ./ci /publish_layers.sh
156
+ - STAGE={ { $environment .name } } NODE_VERSION={ { $runtime .node_version } } .gitlab/scripts /publish_layers.sh
167
157
168
158
{ {- end } }
169
159
170
160
{ {- end } }
171
161
172
- publish- npm- package:
162
+ publish npm package:
173
163
stage: publish
174
164
tags: ["arch:amd64"]
175
- image: registry.ddbuild.io/images/docker:20.10-py3
165
+ image: $ { CI_DOCKER_TARGET_IMAGE } :$ { CI_DOCKER_TARGET_VERSION }
176
166
cache: []
177
167
rules:
178
168
- if: '$CI_COMMIT_TAG =~ /^v.*/'
179
169
when: manual
180
170
needs: { { range $runtime := (ds " runtimes" ).runtimes } }
181
- - sign- layer ({ { $runtime .name } })
171
+ - sign layer ({ { $runtime .name } })
182
172
{ {- end } }
183
173
before_script:
184
- - *install-node
185
174
- *node-before-script
186
175
script:
187
- - ./ci /publish_npm.sh
176
+ - .gitlab/scripts /publish_npm.sh
0 commit comments