-
Notifications
You must be signed in to change notification settings - Fork 1
/
.drone.star
92 lines (86 loc) · 2.17 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
repo = "spritsail/busybox"
architectures = ["amd64", "arm64"]
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 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": "never",
"image": "drone/${DRONE_REPO}/${DRONE_BUILD_NUMBER}:${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}",
"commands": [
"true",
"test -f /lib/libc.so.6",
"ldconfig -p",
"nslookup google.com",
"test \"$(date +%Z)\" = 'UTC'",
"test \"$(echo This is a test string | md5sum | cut -f1 -d' ' | tee /dev/stderr)\" = 'b584c39f97dfe71ebceea3fdb860ed6c'"
],
},
{
"name": "publish",
"pull": "always",
"image": "spritsail/docker-publish",
"settings": {
"registry": {"from_secret": "registry_url"},
"login": {"from_secret": "registry_login"},
},
"when": {
"branch": 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.busybox"
],
"src_registry": {"from_secret": "registry_url"},
"src_login": {"from_secret": "registry_login"},
"dest_repo": repo,
"dest_login": {"from_secret": "docker_login"},
},
"when": {
"branch": branches,
"event": ["push"],
},
},
],
}
# vim: ft=python sw=2