forked from DataDog/dd-trace-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
180 lines (168 loc) · 5.54 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
stages:
- build
- publish
- deploy
variables:
GIT_PROFILER_REF: master
DEPLOY_TO_REL_ENV:
value: "false"
description: "Set to true to override rules in the reliability-env pipeline (e.g. override 'only deploy master')"
DOWNSTREAM_BRANCH:
value: "master"
description: "Run a specific datadog-reliability-env branch downstream"
DEPLOY_TO_DEBUGGER_BACKEND:
value: "false"
description: "Set to true to deploy to debugger backend demo application"
build:
only:
- master
- main
- /^hotfix.*$/
- /^release.*$/
except:
variables:
- $DEPLOY_TO_REL_ENV == "true"
stage: build
tags: ["runner:windows-docker", "windowsversion:1809"]
script:
- if (Test-Path build-out) { remove-item -recurse -force build-out }
- if (Test-Path artifacts) { remove-item -recurse -force artifacts }
- docker run --rm -m 4096M -v "$(Get-Location):c:\mnt" -e CI_JOB_ID=${CI_JOB_ID} -e ENABLE_MULTIPROCESSOR_COMPILATION=false -e WINDOWS_BUILDER=true -e AWS_NETWORKING=true -e SIGN_WINDOWS=true datadog/dd-trace-dotnet-docker-build:latest
- mkdir artifacts
- xcopy /e/s build-out\${CI_JOB_ID}\*.* artifacts
- remove-item -recurse -force build-out\${CI_JOB_ID}
- get-childitem build-out
- get-childitem artifacts
artifacts:
expire_in: 2 weeks
paths:
- artifacts
publish:
only:
- master
- main
- /^hotfix.*$/
- /^release.*$/
except:
variables:
- $DEPLOY_TO_REL_ENV == "true"
stage: publish
tags: ["runner:windows-docker", "windowsversion:1809"]
dependencies:
- build
script:
- $result = aws sts assume-role --role-arn "arn:aws:iam::486234852809:role/ci-datadog-windows-filter" --role-session-name AWSCLI-Session
- $resultjson = $result | convertfrom-json
- $credentials = $($resultjson.Credentials)
- $Env:AWS_ACCESS_KEY_ID="$($credentials.AccessKeyId)"
- $Env:AWS_SECRET_ACCESS_KEY="$($credentials.SecretAccessKey)"
- $Env:AWS_SESSION_TOKEN="$($credentials.SessionToken)"
- |
$i = 0
do {
try {
# The grants option at the end is used to allow public access on the files we upload as the acls only aren't enough.
aws s3 cp artifacts/ s3://dd-windowsfilter/builds/tracer/${CI_COMMIT_SHA} --recursive --region us-east-1 --exclude "*" --include "*.zip" --include "*.msi" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers full=id=3a6e02b08553fd157ae3fb918945dd1eaae5a1aa818940381ef07a430cf25732
If ($LASTEXITCODE -eq 0) {
return
}
throw "Error uploading artifacts to S3"
} catch {
$msg = $Error[0].Exception.Message
Write-Output "Encountered error during while publishing to S3. Error Message is $msg."
Write-Output "Retrying..."
$i++
Start-Sleep -Milliseconds 100
}
} while ($i -lt 3)
deploy_to_reliability_env:
stage: deploy
rules:
- if: '$DEPLOY_TO_REL_ENV == "true"'
trigger:
project: DataDog/apm-reliability/datadog-reliability-env
branch: $DOWNSTREAM_BRANCH
variables:
UPSTREAM_PACKAGE_JOB: build
UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME
FORCE_TRIGGER: $DEPLOY_TO_REL_ENV
deploy_to_docker_registries:
stage: deploy
rules:
- if: '$POPULATE_CACHE'
when: never
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(-prerelease)?$/'
when: on_success
- when: manual
allow_failure: true
trigger:
project: DataDog/public-images
branch: main
strategy: depend
variables:
IMG_SOURCES: ghcr.io/datadog/dd-trace-dotnet/dd-lib-dotnet-init:$CI_COMMIT_SHA
IMG_DESTINATIONS: dd-lib-dotnet-init:$CI_COMMIT_TAG
IMG_SIGNING: "false"
deploy_musl_tag_to_docker_registries:
stage: deploy
rules:
- if: '$POPULATE_CACHE'
when: never
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(-prerelease)?$/'
when: on_success
- when: manual
allow_failure: true
trigger:
project: DataDog/public-images
branch: main
strategy: depend
variables:
IMG_SOURCES: ghcr.io/datadog/dd-trace-dotnet/dd-lib-dotnet-init:$CI_COMMIT_SHA-musl
IMG_DESTINATIONS: dd-lib-dotnet-init:$CI_COMMIT_TAG-musl
IMG_SIGNING: "false"
deploy_latest_tag_to_docker_registries:
stage: deploy
rules:
- if: '$POPULATE_CACHE'
when: never
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(-prerelease)?$/'
when: on_success
- when: manual
allow_failure: true
trigger:
project: DataDog/public-images
branch: main
strategy: depend
variables:
IMG_SOURCES: ghcr.io/datadog/dd-trace-dotnet/dd-lib-dotnet-init:$CI_COMMIT_SHA
IMG_DESTINATIONS: dd-lib-dotnet-init:latest
IMG_SIGNING: "false"
deploy_latest_musl_tag_to_docker_registries:
stage: deploy
rules:
- if: '$POPULATE_CACHE'
when: never
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(-prerelease)?$/'
when: on_success
- when: manual
allow_failure: true
trigger:
project: DataDog/public-images
branch: main
strategy: depend
variables:
IMG_SOURCES: ghcr.io/datadog/dd-trace-dotnet/dd-lib-dotnet-init:$CI_COMMIT_SHA-musl
IMG_DESTINATIONS: dd-lib-dotnet-init:latest-musl
IMG_SIGNING: "false"
deploy_to_debugger_backend:
stage: deploy
rules:
- if: '$DEPLOY_TO_DEBUGGER_BACKEND == "true"'
trigger:
project: DataDog/debugger-backend
branch: main
variables:
UPSTREAM_PACKAGE_JOB: build
UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME
UPSTREAM_BRANCH: $CI_COMMIT_BRANCH
UPSTREAM_TAG: $DEPLOY_TAG