mirror of
https://github.com/spritsail/alpine.git
synced 2025-06-14 15:11:12 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
6d1a483ead
|
|||
67d0500768
|
|||
2a2b9c265d
|
|||
754ef911d5
|
105
.drone.star
105
.drone.star
@ -1,47 +1,27 @@
|
|||||||
repo = "spritsail/alpine"
|
|
||||||
archs = ["amd64", "arm64"]
|
|
||||||
versions = ["edge", "3.14", "3.15", "3.16"]
|
|
||||||
branches = ["master"]
|
|
||||||
|
|
||||||
def main(ctx):
|
def main(ctx):
|
||||||
builds = []
|
versions = [
|
||||||
|
["3.9",[]],
|
||||||
|
["3.10",[]],
|
||||||
|
["3.11", ["latest"]],
|
||||||
|
["edge", []],
|
||||||
|
["chrislane", ["😍"]],
|
||||||
|
]
|
||||||
|
return [step(v[0], v[1]) for v in versions] + [notify(["build-%s" % v for v, _ in versions])]
|
||||||
|
|
||||||
for ver in versions:
|
def step(alpinever,tags=[]):
|
||||||
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": key,
|
"name": "build-%s" % alpinever,
|
||||||
"platform": {
|
|
||||||
"os": "linux",
|
|
||||||
"arch": arch,
|
|
||||||
},
|
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"name": "build",
|
"name": "build",
|
||||||
"image": "spritsail/docker-build",
|
"image": "spritsail/docker-build",
|
||||||
"pull": "always",
|
"pull": "always",
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"repo": "alpine-dev-%s" % alpinever,
|
||||||
"build_args": [
|
"build_args": [
|
||||||
"ALPINE_TAG=%s" % ver,
|
"ALPINE_TAG=%s" % alpinever,
|
||||||
],
|
],
|
||||||
"repo": tmprepo,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -49,8 +29,8 @@ def step(ver, arch, key, tmprepo):
|
|||||||
"image": "spritsail/docker-test",
|
"image": "spritsail/docker-test",
|
||||||
"pull": "always",
|
"pull": "always",
|
||||||
"settings": {
|
"settings": {
|
||||||
"run": vertest + "su-exec nobody apk --version",
|
"repo": "spritsail/alpine",
|
||||||
"repo": tmprepo,
|
"run": "su-exec nobody apk --version",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -58,49 +38,46 @@ def step(ver, arch, key, tmprepo):
|
|||||||
"image": "spritsail/docker-publish",
|
"image": "spritsail/docker-publish",
|
||||||
"pull": "always",
|
"pull": "always",
|
||||||
"settings": {
|
"settings": {
|
||||||
"from": tmprepo,
|
"from": "alpine-dev-%s" % alpinever,
|
||||||
"repo": tmprepo,
|
"repo": "spritsail/alpine",
|
||||||
"registry": {"from_secret": "registry_url"},
|
"tags": [alpinever] + tags,
|
||||||
"username": {"from_secret": "registry_username"},
|
},
|
||||||
"password": {"from_secret": "registry_password"},
|
"environment": {
|
||||||
|
"DOCKER_USERNAME": {
|
||||||
|
"from_secret": "docker_username",
|
||||||
|
},
|
||||||
|
"DOCKER_PASSWORD": {
|
||||||
|
"from_secret": "docker_password",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"when": {
|
"when": {
|
||||||
"branch": branches,
|
"branch": ["master"],
|
||||||
"event": ["push"],
|
"event": ["push"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
def publish(ver, srctpl, depends, tags=[]):
|
def notify(versions):
|
||||||
return {
|
return {
|
||||||
"kind": "pipeline",
|
"kind": "pipeline",
|
||||||
"name": "publish-%s" % ver,
|
"name": "notify",
|
||||||
"depends_on": depends,
|
"depends_on": versions,
|
||||||
"platform": {
|
"when": {
|
||||||
"os": "linux",
|
"status": [ "success", "failure" ],
|
||||||
},
|
},
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"name": "publish",
|
"name": "notify",
|
||||||
"image": "spritsail/docker-multiarch-publish",
|
"image": "spritsail/notify",
|
||||||
"pull": "always",
|
"environment": {
|
||||||
"settings": {
|
"WEBHOOK_URL": {
|
||||||
"src_template": srctpl,
|
"from_secret": "webhook_url",
|
||||||
"src_registry": {"from_secret": "registry_url"},
|
},
|
||||||
"src_username": {"from_secret": "registry_username"},
|
"NOTIFY_TOKEN": {
|
||||||
"src_password": {"from_secret": "registry_password"},
|
"from_secret": "notify_token",
|
||||||
"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
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ARG ALPINE_TAG=3.16
|
ARG ALPINE_TAG=3.11
|
||||||
|
|
||||||
FROM alpine:$ALPINE_TAG
|
FROM alpine:$ALPINE_TAG
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ COPY skel/ /
|
|||||||
ADD https://alpine.spritsail.io/spritsail-alpine.rsa.pub /etc/apk/keys
|
ADD https://alpine.spritsail.io/spritsail-alpine.rsa.pub /etc/apk/keys
|
||||||
|
|
||||||
ENV ENV="/etc/profile"
|
ENV ENV="/etc/profile"
|
||||||
RUN sed -i '1ihttps://alpine.spritsail.io/spritsail' /etc/apk/repositories \
|
RUN sed -i '1ihttp://alpine.spritsail.io/spritsail' /etc/apk/repositories \
|
||||||
&& apk --no-cache add \
|
&& apk --no-cache add \
|
||||||
su-exec \
|
su-exec \
|
||||||
tini
|
tini
|
||||||
|
Reference in New Issue
Block a user