From 5733f1abea6b12b603f3b5f474130ef60fe48d3e Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Mon, 18 Jul 2022 15:11:27 +0200 Subject: [PATCH] add drone.star Signed-off-by: Christian Richter --- .drone.star | 185 ++++++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 3 +- 2 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 .drone.star diff --git a/.drone.star b/.drone.star new file mode 100644 index 0000000..860de45 --- /dev/null +++ b/.drone.star @@ -0,0 +1,185 @@ +def main(ctx): + return [ + stepPR("amd64", "weirdradio"), + stepPR("arm64", "weirdradio"), + stepMergeMaster("amd64", "weirdradio"), + stepMergeMaster("arm64", "weirdradio"), + stepBuildWeekly("amd64", "weirdradio"), + stepBuildWeekly("arm64", "weirdradio"), + + notify(ctx), + ] + +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": [ + "docker-build-motsognir-amd64", + "docker-build-motsognir-arm64", + "docker-build-webtest-amd64", + "docker-build-webtest-arm64", + "docker-build-unbound-amd64", + "docker-build-unbound-arm64", + + "docker-publish-motsognir-amd64", + "docker-publish-motsognir-arm64", + "docker-publish-webtest-amd64", + "docker-publish-webtest-arm64", + "docker-publish-unbound-amd64", + "docker-publish-unbound-arm64", + + "docker-publish-weekly-motsognir-amd64", + "docker-publish-weekly-motsognir-arm64", + "docker-publish-weekly-webtest-amd64", + "docker-publish-weekly-webtest-arm64", + "docker-publish-weekly-unbound-amd64", + "docker-publish-weekly-unbound-arm64", + ], + "trigger": { + "ref": [ + "refs/heads/master", + "refs/heads/release*", + "refs/tags/**", + "refs/pull/**", + ], + "status": [ + "failure", + "success", + ], + }, + } + +def stepPR(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": "Dockerfile", + "repo": "dragonchaser/%s" % (path), + "dry_run": "true", + "tag": "latest-%s" % (arch), + } + }, + ], + "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": "Dockerfile", + "repo": "dragonchaser/%s" % (path), + "dry_run": "false", + "tag": "latest-%s" % (arch), + "username": { + "from_secret": "dockerhub-user" + }, + "password": { + "from_secret": "dockerhub-password" + } + } + }, + ], + "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": "Dockerfile", + "repo": "dragonchaser/%s" % (path), + "dry_run": "false", + "tag": "latest-%s" % (arch), + "username": { + "from_secret": "dockerhub-user" + }, + "password": { + "from_secret": "dockerhub-password" + } + } + }, + ], + "trigger": { + "ref": [ + "refs/heads/master", + ], + "event": [ + "cron" + ], + "cron": [ + "weekly" + ] + }, + } \ No newline at end of file diff --git a/.gitignore b/.gitignore index b83fd20..930b811 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ **/*.json -node_modules \ No newline at end of file +node_modules +.drone.yml \ No newline at end of file