-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
69 lines (62 loc) · 2.47 KB
/
.gitlab-ci.yml
File metadata and controls
69 lines (62 loc) · 2.47 KB
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
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc.
variables:
# These are gitlab variables so that it's easier to do a manual deploy
# If these are set with value and description, then it gives you UI elements
DOWNSTREAM_BUILD_BRANCH:
value: "main"
description: "Run the build CI on this branch"
workflow:
rules:
# If triggered by tag, run only for release tags and not rc
- if: '$CI_COMMIT_TAG != null && ($CI_COMMIT_TAG =~ /^v.*-rc$/ || $CI_COMMIT_TAG !~ /^v/)'
when: never
- when: always
# Triggers a build within the Datadog infrastructure in the ddprof-build repository
trigger_internal_build:
variables:
DDPROF_COMMIT_BRANCH: ${CI_COMMIT_BRANCH}
DDPROF_COMMIT_SHA: ${CI_COMMIT_SHA}
DDPROF_SHORT_COMMIT_SHA: ${CI_COMMIT_SHORT_SHA}
DDPROF_COMMIT_TAG: ${CI_COMMIT_TAG}
# Reliability environment downstream branch
DDPROF_RELENV_BRANCH: ${DDPROF_RELENV_BRANCH-"master"}
trigger:
project: DataDog/apm-reliability/ddprof-build
strategy: depend
branch: $DOWNSTREAM_BUILD_BRANCH
# Following jobs are required otherwise gitsync will not report downstream pipeline failure to github
# This job is used to determine is downstream pipeline has succeeded
report_failure:
tags: ["arch:amd64"]
when: on_failure
needs: [trigger_internal_build]
# allow_failure: true prevents the job from showing up in github statuses (because it's filtered by gitsync)
allow_failure: true
script:
- echo "STATUS=1" >> .env
artifacts:
reports:
dotenv: .env
report_success:
tags: ["arch:amd64"]
when: on_success
needs: [trigger_internal_build]
# allow_failure: true prevents the job from showing up in github statuses (because it's filtered by gitsync)
allow_failure: true
script:
- echo "STATUS=0" >> .env
artifacts:
reports:
dotenv: .env
# Final job that will show in github statuses
report_gitlab_CI_status:
tags: ["arch:amd64"]
when: always
stage: .post
script:
- if [ "$STATUS" -eq 1 ]; then
- echo "If you see this failing, it means downstream pipeline failed. Follow the link to the pipeline in the right panel and check downstream pipeline."
- echo "To update pipeline status first retry the failed jobs in the downstream pipeline and once they succeed rerun this job."
- fi
- exit ${STATUS}