Build: Refactor cron_job_pipeline to take the cron name as a parameter (#54899)

This commit is contained in:
Shirley 2022-09-08 13:36:36 +02:00 committed by GitHub
parent 933ec4817f
commit bdd0af0645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,18 +10,18 @@ def cronjobs(edition):
scan_docker_image_pipeline(edition, 'main-ubuntu'), scan_docker_image_pipeline(edition, 'main-ubuntu'),
] ]
def cron_job_pipeline(name, steps): def cron_job_pipeline(cronName, name, steps):
return { return {
'kind': 'pipeline', 'kind': 'pipeline',
'type': 'docker', 'type': 'docker',
'platform': { 'platform': {
'os': 'linux', 'os': 'linux',
'arch': 'amd64', 'arch': 'amd64',
}, },
'name': name, 'name': name,
'trigger': { 'trigger': {
'event': 'cron', 'event': 'cron',
'cron': 'nightly', 'cron': cronName,
}, },
'clone': { 'clone': {
'retries': 3, 'retries': 3,
@ -38,6 +38,7 @@ def scan_docker_image_pipeline(edition, tag):
dockerImage='grafana/{}:{}'.format(edition, tag) dockerImage='grafana/{}:{}'.format(edition, tag)
return cron_job_pipeline( return cron_job_pipeline(
cronName='nightly',
name='scan-' + dockerImage + '-image', name='scan-' + dockerImage + '-image',
steps=[ steps=[
scan_docker_image_unkown_low_medium_vulnerabilities_step(dockerImage), scan_docker_image_unkown_low_medium_vulnerabilities_step(dockerImage),