-
Notifications
You must be signed in to change notification settings - Fork 1
/
.drone.star
102 lines (95 loc) · 2.26 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
92
93
94
95
96
97
98
99
100
101
102
repo = "spritsail/debian-builder"
archs = ["amd64", "arm64"]
branches = ["master"]
versions = {
"bookworm-slim": ["latest", "stable"],
"trixie-slim": ["testing"],
"sid-slim": ["unstable"],
}
def main(ctx):
builds = []
for ver, tags in versions.items():
depends_on = []
for arch in archs:
key = "build-%s-%s" % (ver, arch)
builds.append(step(ver, arch, key))
depends_on.append(key)
if ctx.build.branch in branches:
builds.append(publish(ver, depends_on, tags))
return builds
def step(ver, arch, key):
return {
"kind": "pipeline",
"name": key,
"platform": {
"os": "linux",
"arch": arch,
},
"environment": {
"DOCKER_IMAGE_TOKEN": ver,
},
"steps": [
{
"name": "build",
"image": "spritsail/docker-build",
"pull": "always",
"settings": {
"build_args": [
"DEBIAN_TAG=%s" % ver,
],
},
},
{
"name": "test",
"image": "spritsail/docker-test",
"pull": "always",
"settings": {
"run": "for b in tar xz bzip2 gawk gcc; do $b --version; done",
},
},
{
"name": "publish",
"image": "spritsail/docker-publish",
"pull": "always",
"settings": {
"registry": {"from_secret": "registry_url"},
"login": {"from_secret": "registry_login"},
},
"when": {
"branch": branches,
"event": ["push", "cron"],
},
},
]
}
def publish(ver, depends, tags=[]):
return {
"kind": "pipeline",
"name": "publish-%s" % ver,
"depends_on": depends,
"platform": {
"os": "linux",
},
"environment": {
"DOCKER_IMAGE_TOKEN": ver,
},
"steps": [
{
"name": "publish",
"image": "spritsail/docker-multiarch-publish",
"pull": "always",
"settings": {
"src_registry": {"from_secret": "registry_url"},
"src_login": {"from_secret": "registry_login"},
"dest_repo": repo,
"dest_login": {"from_secret": "docker_login"},
"tags": [ver] + tags,
},
"when": {
"branch": branches,
"event": ["push", "cron"],
},
},
]
}
# vim: ft=python sw=2