mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 02:29:33 +08:00
CI: Notify failures in separate pipeline (#27936)
* Notify failures in separate pipeline * Include branch and event in triggers * Use snake case * Use snake case * Fix enterprise/downstream * Apply suggestions from code review Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:

committed by
GitHub

parent
1d2b839a1d
commit
c028d3047c
@ -153,6 +153,12 @@ def master_pipelines(edition):
|
||||
name='publish-master', edition=edition, trigger=trigger, steps=publish_steps,
|
||||
depends_on=['build-master', 'windows-master',], install_deps=False, version_mode=version_mode,
|
||||
))
|
||||
|
||||
notify_trigger = dict(trigger, status = ['failure'])
|
||||
pipelines.append(notify_pipeline(
|
||||
name='notify-master', slack_channel='grafana-ci-notifications', trigger=notify_trigger,
|
||||
depends_on=['build-master', 'windows-master', 'publish-master'],
|
||||
))
|
||||
if edition == 'enterprise':
|
||||
# Add downstream enterprise pipelines triggerable from OSS builds
|
||||
trigger = {
|
||||
@ -173,6 +179,12 @@ def master_pipelines(edition):
|
||||
version_mode=version_mode,
|
||||
))
|
||||
|
||||
notify_trigger = dict(trigger, status = ['failure'])
|
||||
pipelines.append(notify_pipeline(
|
||||
name='notify-master-downstream', slack_channel='grafana-enterprise-ci-notifications', trigger=notify_trigger,
|
||||
depends_on=['build-master-downstream', 'windows-master-downstream', 'publish-master-downstream'],
|
||||
))
|
||||
|
||||
return pipelines
|
||||
|
||||
def pipeline(
|
||||
@ -212,6 +224,22 @@ def pipeline(
|
||||
|
||||
return pipeline
|
||||
|
||||
def notify_pipeline(name, slack_channel, trigger, depends_on=[]):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'name': name,
|
||||
'trigger': trigger,
|
||||
'steps': [
|
||||
slack_step(slack_channel),
|
||||
],
|
||||
'depends_on': depends_on,
|
||||
}
|
||||
|
||||
def slack_step(channel):
|
||||
return {
|
||||
'name': 'slack',
|
||||
@ -223,9 +251,6 @@ def slack_step(channel):
|
||||
'channel': channel,
|
||||
'template': 'Build {{build.number}} failed: {{build.link}}',
|
||||
},
|
||||
'when': {
|
||||
'status': ['failure',],
|
||||
},
|
||||
}
|
||||
|
||||
def init_steps(edition, platform, version_mode, is_downstream=False, install_deps=True):
|
||||
@ -300,8 +325,7 @@ def init_steps(edition, platform, version_mode, is_downstream=False, install_dep
|
||||
] + common_cmds,
|
||||
},
|
||||
]
|
||||
if version_mode == 'master':
|
||||
steps.append(slack_step(channel='grafana-enterprise-ci-failures'))
|
||||
|
||||
return steps
|
||||
|
||||
steps = [
|
||||
@ -323,9 +347,6 @@ def init_steps(edition, platform, version_mode, is_downstream=False, install_dep
|
||||
},
|
||||
]
|
||||
|
||||
if version_mode == 'master':
|
||||
steps.append(slack_step(channel='grafana-ci-failures'))
|
||||
|
||||
return steps
|
||||
|
||||
def enterprise_downstream_step(edition):
|
||||
|
Reference in New Issue
Block a user