This repository has been archived by the owner on Jan 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.star
91 lines (84 loc) · 1.98 KB
/
.drone.star
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
repo = "spritsail/nzbhydra"
architectures = ["amd64", "arm64"]
publish_branches = ["master"]
def main(ctx):
builds = []
depends_on = []
for arch in architectures:
key = "build-%s" % arch
builds.append(step(arch, key))
depends_on.append(key)
if ctx.build.branch in publish_branches:
builds.append(publish(depends_on))
return builds
def step(arch, key):
return {
"kind": "pipeline",
"name": key,
"platform": {
"os": "linux",
"arch": arch,
},
"steps": [
{
"name": "build",
"pull": "always",
"image": "spritsail/docker-build",
},
{
"name": "test",
"pull": "always",
"image": "spritsail/docker-test",
"settings": {
"curl": ":5076",
"delay": 15,
"retry": 10,
"run_args": "-e SUID=0"
},
},
{
"name": "publish",
"pull": "always",
"image": "spritsail/docker-publish",
"settings": {
"registry": {"from_secret": "registry_url"},
"login": {"from_secret": "registry_login"},
},
"when": {
"branch": publish_branches,
"event": ["push"],
},
},
],
}
def publish(depends_on):
return {
"kind": "pipeline",
"name": "publish-manifest",
"depends_on": depends_on,
"platform": {
"os": "linux",
},
"steps": [
{
"name": "publish",
"image": "spritsail/docker-multiarch-publish",
"pull": "always",
"settings": {
"tags": [
"latest",
"%label io.spritsail.version.nzbhydra | %auto"
],
"src_registry": {"from_secret": "registry_url"},
"src_login": {"from_secret": "registry_login"},
"dest_repo": repo,
"dest_login": {"from_secret": "docker_login"},
},
"when": {
"branch": publish_branches,
"event": ["push"],
},
},
],
}
# vim: ft=python sw=2