2
0
mirror of https://github.com/spritsail/alpine.git synced 2024-12-20 11:34:36 +00:00
alpine/.drone.star

105 lines
2.3 KiB
Plaintext
Raw Normal View History

repo = "spritsail/alpine"
archs = ["amd64", "arm64"]
branches = ["master"]
versions = {
"3.20": [],
"3.21": ["latest"],
"edge": [],
}
2020-01-08 19:13:53 +00:00
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))
2020-01-08 19:13:53 +00:00
return builds
def step(ver, arch, key):
vertest = "grep -q '%s' /etc/alpine-release && " % ver if ver != "edge" else ""
2020-01-08 19:13:53 +00:00
return {
"kind": "pipeline",
"name": key,
"platform": {
"os": "linux",
"arch": arch,
},
"environment": {
"DOCKER_IMAGE_TOKEN": ver,
},
2020-01-08 19:13:53 +00:00
"steps": [
{
"name": "build",
"image": "spritsail/docker-build",
"pull": "always",
"settings": {
"build_args": [
"ALPINE_TAG=%s" % ver,
],
},
2020-01-08 19:13:53 +00:00
},
{
"name": "test",
"image": "spritsail/docker-test",
"pull": "always",
"settings": {
"run": vertest + "su-exec nobody apk --version",
"verbose": "true",
2020-01-08 19:13:53 +00:00
},
},
{
"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,
2020-01-08 19:13:53 +00:00
},
"when": {
"branch": branches,
"event": ["push", "cron"],
2020-01-08 19:13:53 +00:00
},
},
]
}
# vim: ft=python sw=2