def main(ctx): return [ stepPR(ctx, "amd64", "motsognir"), stepPR(ctx, "arm64", "motsognir"), stepMergeMaster("amd64", "motsognir"), stepMergeMaster("arm64", "motsognir"), stepBuildWeekly("amd64", "motsognir"), stepBuildWeekly("arm64", "motsognir"), stepPR(ctx, "amd64", "webtest"), stepPR(ctx, "arm64", "webtest"), stepMergeMaster("amd64", "webtest"), stepMergeMaster("arm64", "webtest"), stepBuildWeekly("amd64", "webtest"), stepBuildWeekly("arm64", "webtest"), notify(ctx), ] def getPipelineNames(pipelines = []): names = [] for pipeline in pipelines: names.append(pipeline["name"]) return names def notify(ctx): return { "kind": "pipeline", "type": "docker", "name": "matrix-notifications", "clone": { "disable": True, }, "steps": [ { "name": "notify", "image": "plugins/matrix", "settings": { "homeserver": { "from_secret": "matrix-homeserver" }, "roomid": { "from_secret": "matrix-room" }, "username": { "from_secret": "matrix-user" }, "password": { "from_secret": "matrix-password" } } }, ], "depends_on": [], "trigger": { "ref": [ "refs/heads/master", "refs/heads/release*", "refs/tags/**", ], "status": [ "failure", "success", "failure", ], }, } def stepPR(ctx, arch, path): return { "kind": "pipeline", "type": "docker", "name": "docker-build-%s-%s" % (path, arch), "platform": { "os": "linux", "arch": arch, }, "steps": [ { "name": "build-image-%s-%s" % (path, arch), "image": "plugins/docker", "settings": { "dockerfile": "%s/Dockerfile" % (path), "repo": "dragonchaser/%s" % (path), "dry_run": "true", "tag": "latest-%s" % (arch), } }, ], "depends_on": getPipelineNames([notify(ctx)]), "trigger": { "ref": [ "refs/pull/**", ], "status": [ "success", "failure" ] }, } def stepMergeMaster(arch, path): return { "kind": "pipeline", "type": "docker", "name": "docker-publish-%s-%s" % (path, arch), "platform": { "os": "linux", "arch": arch, }, "steps": [ { "name": "build-and-publish-image-%s-%s" % (path, arch), "image": "plugins/docker", "settings": { "dockerfile": "%s/Dockerfile" % (path), "repo": "dragonchaser/%s" % (path), "dry_run": "false", "tag": "latest-%s" % (arch), "username": { "from_secret": "dockerhub-user" }, "password": { "from_secret": "dockerhub-password" } } }, ], #"depends_on": [ "matrix-notifications" ], "trigger": { "ref": [ "refs/heads/master", ], "status": [ "success", "failure" ] } } def stepBuildWeekly(arch, path): return { "kind": "pipeline", "type": "docker", "name": "docker-publish-weekly-%s-%s" % (path, arch), "platform": { "os": "linux", "arch": arch, }, "steps": [ { "name": "build-and-publish-image-%s-%s" % (path, arch), "image": "plugins/docker", "settings": { "dockerfile": "%s/Dockerfile" % (path), "repo": "dragonchaser/%s" % (path), "dry_run": "false", "tag": "latest-%s" % (arch), "username": { "from_secret": "dockerhub-user" }, "password": { "from_secret": "dockerhub-password" } } }, ], #"depends_on": [ "matrix-notifications" ], "trigger": { "ref": [ "refs/heads/master", ], "event": [ "cron" ], "cron": [ "weekly" ] }, }