commit e6e4fac6c7a71d40ae32dc5ed43acfaea63f954f Author: James Brumond Date: Sat Dec 3 14:20:30 2022 -0800 first commit diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..05e3373 --- /dev/null +++ b/build.yaml @@ -0,0 +1,21 @@ +--- +kind: pipeline +type: kubernetes +name: build-{{ .input.os }}-{{ .input.arch }} + +trigger: + event: [ push ] + branch: [ master ] + +steps: +- name: build + image: plugins/docker + settings: + registry: https://gitea.internal.example.com + username: drone + password: + from_secret: gitea-internal-password + repo: gitea.internal.example.com/{{ .input.repo }}-{{ .input.os }}-{{ .input.arch }} + cache_from: gitea.internal.example.com/{{ .input.repo }}-{{ .input.os }}-{{ .input.arch }}:ci + tags: + - "ci" diff --git a/multiarch.yaml b/multiarch.yaml new file mode 100644 index 0000000..055e80c --- /dev/null +++ b/multiarch.yaml @@ -0,0 +1,28 @@ +--- +kind: pipeline +type: kubernetes +name: publish-multiarch-manifest + +trigger: + event: [ promote ] + target: [ publish ] + +steps: +- name: publish-manifest + image: plugins/manifest + settings: + registry: https://gitea.internal.example.com + username: drone + password: + from_secret: gitea-internal-password + target: gitea.internal.example.com/{{ .input.repo }} + template: gitea.internal.example.com/{{ .input.repo }}-OS-ARCH + platforms: + {{ range .input.platforms }} + - {{ .os }}/{{ .arch }} + {{ end }} + +depends_on: +{{ range .input.platforms }} +- publish-{{ .os }}-{{ .arch }} +{{ range .input.platforms }} diff --git a/publish.yaml b/publish.yaml new file mode 100644 index 0000000..7b147cc --- /dev/null +++ b/publish.yaml @@ -0,0 +1,21 @@ +--- +kind: pipeline +type: kubernetes +name: publish-{{ .input.os }}-{{ .input.arch }} + +trigger: + event: [ promote ] + target: [ "publish-{{ .input.os }}-{{ .input.arch }}" ] + +steps: +- name: build-and-publish + image: plugins/docker + settings: + registry: https://gitea.internal.example.com + username: drone + password: + from_secret: gitea-internal-password + repo: gitea.internal.example.com/{{ .input.repo }}-{{ .input.os }}-{{ .input.arch }} + cache_from: gitea.internal.example.com/{{ .input.repo }}-{{ .input.os }}-{{ .input.arch }}:ci + tags: + - "latest" diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..749d9ab --- /dev/null +++ b/readme.md @@ -0,0 +1,35 @@ + +## Drone CI Pipeline Templates for Multi-Arch Builds + +See https://blog.jbrumond.me/post/raspberry-pi-cluster-part-4:-gitea-and-drone for more info + + + +### Usage + +```yaml +--- +kind: template +load: build.yaml +data: + repo: examples/docker + os: linux + arch: arm64 + +--- +kind: template +load: publish.yaml +data: + repo: examples/docker + os: linux + arch: arm64 + +--- +kind: template +load: multiarch.yaml +data: + repo: examples/docker + platforms: + - os: linux + arch: arm64 +```