Add once-per-execution notify step

This commit is contained in:
Joe Groocock 2020-01-05 17:38:30 +00:00
parent 754ef911d5
commit 2a2b9c265d
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86

View File

@ -1,10 +1,11 @@
def main(ctx): def main(ctx):
return [ versions = [
step("3.9"), ["3.9",[]],
step("3.10"), ["3.10",[]],
step("3.11", ["latest"]), ["3.11", ["latest"]],
step("edge"), ["edge", []],
] ]
return [step(v[0], v[1]) for v in versions] + [notify(["build-%s" % v for v, _ in versions])]
def step(alpinever,tags=[]): def step(alpinever,tags=[]):
return { return {
@ -19,8 +20,8 @@ def step(alpinever,tags=[]):
"repo": "alpine-dev-%s" % alpinever, "repo": "alpine-dev-%s" % alpinever,
"build_args": [ "build_args": [
"ALPINE_TAG=%s" % alpinever, "ALPINE_TAG=%s" % alpinever,
] ],
} },
}, },
{ {
"name": "test", "name": "test",
@ -29,7 +30,7 @@ def step(alpinever,tags=[]):
"settings": { "settings": {
"repo": "spritsail/alpine", "repo": "spritsail/alpine",
"run": "su-exec nobody apk --version", "run": "su-exec nobody apk --version",
} },
}, },
{ {
"name": "publish", "name": "publish",
@ -46,13 +47,36 @@ def step(alpinever,tags=[]):
}, },
"DOCKER_PASSWORD": { "DOCKER_PASSWORD": {
"from_secret": "docker_password", "from_secret": "docker_password",
} },
}, },
"when": { "when": {
"branch": ["master"], "branch": ["master"],
"event": ["push"], "event": ["push"],
} },
} },
] ]
} }
def notify(versions):
return {
"kind": "pipeline",
"name": "notify",
"depends_on": versions,
"steps": [
{
"name": "notify",
"image": "spritsail/notify",
"environment": {
"WEBHOOK_URL": {
"from_secret": "webhook_url",
},
"NOTIFY_TOKEN": {
"from_secret": "notify_token",
},
},
"when": {
"status": [ "success", "failure" ],
},
},
],
}