updates to use new multi-arch template
This commit is contained in:
parent
e6e4fac6c7
commit
bec51c0a22
21
build.yaml
21
build.yaml
@ -1,21 +0,0 @@
|
||||
---
|
||||
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"
|
109
multiarch-container.yaml
Normal file
109
multiarch-container.yaml
Normal file
@ -0,0 +1,109 @@
|
||||
{{- range $i, $plat := .input.platforms -}}
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: build-{{ $plat.os }}-{{ $plat.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 }}
|
||||
cache_from: gitea.internal.example.com/{{ $.input.repo }}:ci-{{ $plat.os }}-{{ $plat.arch }}
|
||||
build_args:
|
||||
- OS={{ $plat.os }}
|
||||
- ARCH={{ $plat.arch }}
|
||||
{{ range $.input.build_args }}
|
||||
- {{ . }}
|
||||
{{ end }}
|
||||
tags:
|
||||
- ci-{{ $plat.os }}-{{ $plat.arch }}
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: publish-{{ $plat.os }}-{{ $plat.arch }}
|
||||
|
||||
trigger:
|
||||
event: [ promote ]
|
||||
target: [ publish, "publish-{{ $plat.os }}-{{ $plat.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 }}
|
||||
cache_from: gitea.internal.example.com/{{ $.input.repo }}:ci-{{ $plat.os }}-{{ $plat.arch }}
|
||||
build_args:
|
||||
- OS={{ $plat.os }}
|
||||
- ARCH={{ $plat.arch }}
|
||||
{{ range $.input.build_args }}
|
||||
- {{ . }}
|
||||
{{ end }}
|
||||
tags:
|
||||
- latest-{{ $plat.os }}-{{ $plat.arch }}
|
||||
{{ range $.input.tags }}
|
||||
- {{ . }}-{{ $plat.os }}-{{ $plat.arch }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: publish-multiarch-manifest
|
||||
|
||||
trigger:
|
||||
event: [ promote ]
|
||||
target: [ publish ]
|
||||
|
||||
steps:
|
||||
- name: deploy
|
||||
image: gitea.internal.example.com/images/docker:{{ if .input.docker_image_tag }}{{ .input.docker_image_tag }}{{ else }}latest{{ end }}
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/
|
||||
environment:
|
||||
DOCKER_REGISTRY: https://gitea.internal.example.com
|
||||
DOCKER_USER: drone
|
||||
DOCKER_PASS:
|
||||
from_secret: gitea-internal-password
|
||||
commands:
|
||||
- /bin/docker-setup
|
||||
- |
|
||||
docker manifest create \
|
||||
gitea.internal.example.com/{{ .input.repo }}:latest \
|
||||
{{ range .input.platforms -}}
|
||||
--amend gitea.internal.example.com/{{ $.input.repo }}:latest-{{ .os }}-{{ .arch }} \
|
||||
{{- end }}
|
||||
- docker manifest push gitea.internal.example.com/{{ .input.repo }}:latest
|
||||
{{ range $i, $tag := $.input.tags }}
|
||||
- |
|
||||
docker manifest create \
|
||||
gitea.internal.example.com/{{ $.input.repo }}:{{ $tag }} \
|
||||
{{ range $.input.platforms -}}
|
||||
gitea.internal.example.com/{{ $.input.repo }}:{{ $tag }}-{{ .os }}-{{ .arch }} \
|
||||
{{- end }}
|
||||
- docker manifest push gitea.internal.example.com/{{ $.input.repo }}:{{ $tag }}
|
||||
{{ end }}
|
||||
|
||||
volumes:
|
||||
- name: dockersock
|
||||
host:
|
||||
path: /var/run/
|
||||
|
||||
depends_on:
|
||||
{{ range .input.platforms }}
|
||||
- publish-{{ .os }}-{{ .arch }}
|
||||
{{ end }}
|
@ -1,28 +0,0 @@
|
||||
---
|
||||
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 }}
|
21
publish.yaml
21
publish.yaml
@ -1,21 +0,0 @@
|
||||
---
|
||||
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"
|
26
readme.md
26
readme.md
@ -10,26 +10,16 @@ See https://blog.jbrumond.me/post/raspberry-pi-cluster-part-4:-gitea-and-drone f
|
||||
```yaml
|
||||
---
|
||||
kind: template
|
||||
load: build.yaml
|
||||
load: multiarch-container.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
|
||||
repo: images/example-image-name
|
||||
tags:
|
||||
- "1.2.3"
|
||||
- "1.2"
|
||||
- "1"
|
||||
platforms:
|
||||
- os: linux
|
||||
arch: arm64
|
||||
- os: linux
|
||||
arch: amd64
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user