2023-07-13 12:40:40 +00:00
|
|
|
def main(ctx):
|
|
|
|
archs = ["amd64", "arm64"] ## arm
|
2024-07-03 09:30:39 +00:00
|
|
|
glpi_version = "10.0.16"
|
2023-12-13 10:39:04 +00:00
|
|
|
alpine_version = "3.19"
|
2023-07-13 12:40:40 +00:00
|
|
|
|
|
|
|
out = []
|
|
|
|
for arch in archs:
|
2023-12-13 11:02:54 +00:00
|
|
|
out += onpush(ctx, glpi_version, alpine_version, arch)
|
2023-07-13 12:40:40 +00:00
|
|
|
|
|
|
|
for arch in archs:
|
2023-12-13 10:39:04 +00:00
|
|
|
out += build_publish(ctx, glpi_version, alpine_version, arch)
|
2023-07-13 12:40:40 +00:00
|
|
|
|
|
|
|
out += manifest_publish(ctx, glpi_version, archs)
|
|
|
|
|
|
|
|
return out
|
|
|
|
|
2023-12-13 10:39:04 +00:00
|
|
|
def onpush(ctx, glpi_version, alpine_version, arch):
|
2023-07-13 12:40:40 +00:00
|
|
|
return [{
|
|
|
|
"kind": "pipeline",
|
|
|
|
"type": "docker",
|
|
|
|
"name": "build-onpush-%s-%s" % (glpi_version, arch),
|
|
|
|
"platform": {
|
|
|
|
"arch": arch,
|
|
|
|
"os": "linux",
|
|
|
|
},
|
|
|
|
"steps": [{
|
|
|
|
"name": "build_on_push",
|
|
|
|
"image": "plugins/docker:linux-%s" % (arch),
|
|
|
|
"settings": {
|
2023-12-13 10:39:04 +00:00
|
|
|
"context": "src",
|
|
|
|
"dockerfile": "src/Dockerfile",
|
2023-07-13 12:40:40 +00:00
|
|
|
"dry_run": True,
|
|
|
|
"repo": "docker.asperti.com/paspo/glpi",
|
|
|
|
"build_args": [
|
2023-12-13 10:39:04 +00:00
|
|
|
"GLPI_VERSION=%s" % (glpi_version),
|
|
|
|
"ALPINE_VERSION=%s" % (alpine_version)
|
2023-07-13 12:40:40 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
"trigger": {
|
|
|
|
"event": ['push'],
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
|
2023-12-13 11:02:54 +00:00
|
|
|
def build_publish(ctx, glpi_version, alpine_version, arch):
|
2023-07-13 12:40:40 +00:00
|
|
|
major = glpi_version.partition(".")[0];
|
|
|
|
return [{
|
|
|
|
"kind": "pipeline",
|
|
|
|
"type": "docker",
|
|
|
|
"name": "build-publish-%s-%s" % (glpi_version, arch),
|
|
|
|
"platform": {
|
|
|
|
"arch": arch,
|
|
|
|
"os": "linux",
|
|
|
|
},
|
|
|
|
"steps": [{
|
|
|
|
"name": "build_on_push",
|
|
|
|
"image": "plugins/docker:linux-%s" % (arch),
|
|
|
|
"settings": {
|
2023-12-13 11:02:54 +00:00
|
|
|
"context": "src",
|
|
|
|
"dockerfile": "src/Dockerfile",
|
2023-07-13 12:40:40 +00:00
|
|
|
"build_args": [
|
2023-12-13 11:02:54 +00:00
|
|
|
"GLPI_VERSION=%s" % (glpi_version),
|
|
|
|
"ALPINE_VERSION=%s" % (alpine_version)
|
2023-07-13 12:40:40 +00:00
|
|
|
],
|
|
|
|
"username": {
|
|
|
|
"from_secret": "docker_username",
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"from_secret": "docker_password",
|
|
|
|
},
|
|
|
|
"registry": "docker.asperti.com",
|
|
|
|
"repo": "docker.asperti.com/paspo/glpi",
|
|
|
|
"tags": [
|
|
|
|
"latest-%s" % (arch),
|
|
|
|
"%s-%s" % (major, arch),
|
|
|
|
"%s-%s" % (glpi_version, arch)
|
|
|
|
],
|
|
|
|
"auto_tag": False,
|
|
|
|
"force_tag": True,
|
|
|
|
"daemon_off": False,
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
"trigger": {
|
|
|
|
"ref": [
|
|
|
|
"refs/heads/master",
|
|
|
|
"refs/tags/**",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}]
|
|
|
|
|
|
|
|
def manifest_publish(ctx, glpi_version, archs):
|
|
|
|
major = glpi_version.partition(".")[0];
|
|
|
|
return [{
|
|
|
|
"kind": "pipeline",
|
|
|
|
"type": "docker",
|
|
|
|
"name": "manifest-%s" % (glpi_version),
|
|
|
|
"platform": {
|
|
|
|
"arch": archs[0],
|
|
|
|
"os": "linux",
|
|
|
|
},
|
|
|
|
"steps": [{
|
|
|
|
"name": "manifest",
|
|
|
|
"image": "plugins/manifest",
|
|
|
|
"settings": {
|
|
|
|
"spec": "manifest.tmpl",
|
|
|
|
"username": {
|
|
|
|
"from_secret": "docker_username",
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"from_secret": "docker_password",
|
|
|
|
},
|
|
|
|
"tags": [
|
|
|
|
"latest",
|
|
|
|
major,
|
|
|
|
glpi_version
|
|
|
|
],
|
|
|
|
"ignore_missing": True,
|
|
|
|
"force_tag": True,
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
"trigger": {
|
|
|
|
"ref": [
|
|
|
|
"refs/heads/master",
|
|
|
|
"refs/tags/**",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
"depends_on": ["build-publish-%s-%s" % (glpi_version, arch) for arch in archs]
|
|
|
|
}]
|
|
|
|
|