forked from chef/omnibus-software
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy path.gitlab-ci.yml
97 lines (90 loc) · 2.68 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
include: "https://gitlab-templates.ddbuild.io/slack-notifier/v3-sdm/template.yml"
stages:
- test
- after-test
- check-downstream
- notify
# We're using two anchors because Gitlab doesn't allow us to use multiple anchors inside of a rules field.
.skip_stable_branches: &skip_stable_branches
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: never
- if: $CI_COMMIT_BRANCH =~ /^7.[0-9]{2}.x/
when: never
- if: $CI_COMMIT_TAG != null
when: never
- changes:
- "**/*.rb"
- Rakefile
- omnibus-software.gemspec
- Gemfile
when: always
.on_success_skip_stable_branches: &on_success_skip_stable_branches
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: never
- if: $CI_COMMIT_BRANCH =~ /^7.[0-9]{2}.x/
when: never
- if: $CI_COMMIT_TAG != null
when: never
- changes:
- "**/*.rb"
- Rakefile
- omnibus-software.gemspec
- Gemfile
when: on_success
trigger-agent-build:
rules:
- *skip_stable_branches
- when: never
stage: test
trigger:
project: datadog/datadog-agent
strategy: depend
variables:
OMNIBUS_SOFTWARE_VERSION: $CI_COMMIT_BRANCH
RUN_ALL_BUILDS: "true"
RUN_KITCHEN_TESTS: "true"
on_success:
rules:
- *on_success_skip_stable_branches
- when: always
stage: after-test
needs:
- job: "trigger-agent-build"
optional: true
tags: ["arch:amd64"]
image: registry.ddbuild.io/ci/datadog-agent-buildimages/deb_x64:v48815877-9bfad02c
script:
- echo success > output.pipeline
artifacts:
paths:
- output.pipeline
expire_in: 1 week
# This job is monitored on github and acts as a required check.
# A few details on the setup:
# We can't monitor a trigger job from github, it has to have a script section.
# We need the monitored job to fail if the downstream pipeline failed, and succeed if
# the downstream pipeline succeeded. If the job is skipped, it isn't taken into account
# on github.
# This is where the on_success job kicks in. It run only if the previous job completes
# and writes `success` in a file that's fetched by the `check-downstream-pipeline` job.
# This allows us to have the check-downstream-pipeline to always run while replicating
# the status of the downstream pipeline.
check-downstream-pipeline:
rules:
- *skip_stable_branches
- when: always
stage: check-downstream
tags: ["arch:amd64"]
image: registry.ddbuild.io/ci/datadog-agent-buildimages/deb_x64:v48815877-9bfad02c
script:
- cat output.pipeline
notify:
extends: .slack-notifier-base
stage: notify
dependencies: []
rules:
- *skip_stable_branches
- when: never
script: |
export MESSAGE="Your omnibus-software test pipeline completed"
/usr/local/bin/notify.sh