mirror of
https://github.com/spritsail/alpine.git
synced 2024-12-20 11:34:36 +00:00
Build amd64/arm64 multiarch images
Signed-off-by: Adam Dodman <adam@adam-ant.co.uk> Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
parent
fa09f2867c
commit
80cdda202e
87
.drone.star
87
.drone.star
@ -1,15 +1,37 @@
|
|||||||
def main(ctx):
|
repo = "spritsail/alpine"
|
||||||
return [
|
archs = ["amd64", "arm64"]
|
||||||
step("3.15"),
|
versions = ["edge", "3.14", "3.15", "3.16"]
|
||||||
step("3.16",["latest"]),
|
branches = ["master"]
|
||||||
step("edge"),
|
|
||||||
]
|
|
||||||
|
|
||||||
def step(alpinever,tags=[]):
|
def main(ctx):
|
||||||
vertest = "grep -q '%s' /etc/alpine-release && " % alpinever if alpinever != "edge" else ""
|
builds = []
|
||||||
|
|
||||||
|
for ver in versions:
|
||||||
|
depends_on = []
|
||||||
|
srctpl = "drone/%s/${DRONE_BUILD_NUMBER}:%s-ARCH" % (ctx.repo.slug, ver)
|
||||||
|
for arch in archs:
|
||||||
|
key = "build-%s-%s" % (ver, arch)
|
||||||
|
tmprepo = "drone/%s/${DRONE_BUILD_NUMBER}:%s-%s" % (ctx.repo.slug, ver, arch)
|
||||||
|
builds.append(step(ver, arch, key, tmprepo))
|
||||||
|
depends_on.append(key)
|
||||||
|
|
||||||
|
if ctx.build.branch in branches:
|
||||||
|
tags = []
|
||||||
|
if ver == versions[-1]:
|
||||||
|
tags.append("latest")
|
||||||
|
builds.append(publish(ver, srctpl, depends_on, tags))
|
||||||
|
|
||||||
|
return builds
|
||||||
|
|
||||||
|
def step(ver, arch, key, tmprepo):
|
||||||
|
vertest = "grep -q '%s' /etc/alpine-release && " % ver if ver != "edge" else ""
|
||||||
return {
|
return {
|
||||||
"kind": "pipeline",
|
"kind": "pipeline",
|
||||||
"name": "build-%s" % alpinever,
|
"name": key,
|
||||||
|
"platform": {
|
||||||
|
"os": "linux",
|
||||||
|
"arch": arch,
|
||||||
|
},
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"name": "build",
|
"name": "build",
|
||||||
@ -17,8 +39,9 @@ def step(alpinever,tags=[]):
|
|||||||
"pull": "always",
|
"pull": "always",
|
||||||
"settings": {
|
"settings": {
|
||||||
"build_args": [
|
"build_args": [
|
||||||
"ALPINE_TAG=%s" % alpinever,
|
"ALPINE_TAG=%s" % ver,
|
||||||
],
|
],
|
||||||
|
"repo": tmprepo,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -27,6 +50,7 @@ def step(alpinever,tags=[]):
|
|||||||
"pull": "always",
|
"pull": "always",
|
||||||
"settings": {
|
"settings": {
|
||||||
"run": vertest + "su-exec nobody apk --version",
|
"run": vertest + "su-exec nobody apk --version",
|
||||||
|
"repo": tmprepo,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -34,16 +58,49 @@ def step(alpinever,tags=[]):
|
|||||||
"image": "spritsail/docker-publish",
|
"image": "spritsail/docker-publish",
|
||||||
"pull": "always",
|
"pull": "always",
|
||||||
"settings": {
|
"settings": {
|
||||||
"repo": "spritsail/alpine",
|
"from": tmprepo,
|
||||||
"tags": [alpinever] + tags,
|
"repo": tmprepo,
|
||||||
"username": {"from_secret": "docker_username"},
|
"registry": {"from_secret": "registry_url"},
|
||||||
"password": {"from_secret": "docker_password"},
|
"username": {"from_secret": "registry_username"},
|
||||||
|
"password": {"from_secret": "registry_password"},
|
||||||
},
|
},
|
||||||
"when": {
|
"when": {
|
||||||
"branch": ["master"],
|
"branch": branches,
|
||||||
"event": ["push"],
|
"event": ["push"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def publish(ver, srctpl, depends, tags=[]):
|
||||||
|
return {
|
||||||
|
"kind": "pipeline",
|
||||||
|
"name": "publish-%s" % ver,
|
||||||
|
"depends_on": depends,
|
||||||
|
"platform": {
|
||||||
|
"os": "linux",
|
||||||
|
},
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"name": "publish",
|
||||||
|
"image": "spritsail/docker-multiarch-publish",
|
||||||
|
"pull": "always",
|
||||||
|
"settings": {
|
||||||
|
"src_template": srctpl,
|
||||||
|
"src_registry": {"from_secret": "registry_url"},
|
||||||
|
"src_username": {"from_secret": "registry_username"},
|
||||||
|
"src_password": {"from_secret": "registry_password"},
|
||||||
|
"dest_repo": repo,
|
||||||
|
"dest_username": {"from_secret": "docker_username"},
|
||||||
|
"dest_password": {"from_secret": "docker_password"},
|
||||||
|
"tags": [ver] + tags,
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"branch": branches,
|
||||||
|
"event": ["push"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: ft=python sw=2
|
||||||
|
Loading…
Reference in New Issue
Block a user