updates and fixes

This commit is contained in:
James Brumond 2022-12-09 16:57:47 -08:00
parent 5100e7cff6
commit e9030e53ef
Signed by: james
GPG Key ID: 24BA25B8B303B023
2 changed files with 43 additions and 15 deletions

View File

@ -5,8 +5,20 @@ type: kubernetes
name: build-{{ $plat.os }}-{{ $plat.arch }} name: build-{{ $plat.os }}-{{ $plat.arch }}
trigger: trigger:
event: [ push ] event:
branch: [ {{ if $.input.build_branches -}}{{ range $.input.build_branches }}{{ . }}, {{ end }}{{ else }}master{{- end }} ] - push
branch:
{{ if $.input.build_branches -}}
{{ range $.input.build_branches }}- {{ . }}{{ end }}
{{ else }}- master{{- end }}
platform:
os: {{ $plat.os }}
arch: {{ $plat.arch }}
node_selector:
kubernetes.io/os: {{ $plat.os }}
kubernetes.io/arch: {{ $plat.arch }}
steps: steps:
- name: build - name: build
@ -33,8 +45,19 @@ type: kubernetes
name: publish-{{ $plat.os }}-{{ $plat.arch }} name: publish-{{ $plat.os }}-{{ $plat.arch }}
trigger: trigger:
event: [ promote ] event:
target: [ publish, "publish-{{ $plat.os }}-{{ $plat.arch }}" ] - promote
target:
- publish
- publish-{{ $plat.os }}-{{ $plat.arch }}
platform:
os: {{ $plat.os }}
arch: {{ $plat.arch }}
node_selector:
kubernetes.io/os: {{ $plat.os }}
kubernetes.io/arch: {{ $plat.arch }}
steps: steps:
- name: build-and-publish - name: build-and-publish
@ -53,7 +76,6 @@ steps:
- {{ . }} - {{ . }}
{{ end }} {{ end }}
tags: tags:
- latest-{{ $plat.os }}-{{ $plat.arch }}
{{ range $.input.tags }} {{ range $.input.tags }}
- {{ . }}-{{ $plat.os }}-{{ $plat.arch }} - {{ . }}-{{ $plat.os }}-{{ $plat.arch }}
{{ end }} {{ end }}
@ -65,12 +87,24 @@ type: kubernetes
name: publish-multiarch-manifest name: publish-multiarch-manifest
trigger: trigger:
event: [ promote ] event:
target: [ publish ] - promote
target:
- publish
{{ if .input.publish_multiarch_from }}
platform:
os: {{ .input.publish_multiarch_from.os }}
arch: {{ .input.publish_multiarch_from.arch }}
node_selector:
kubernetes.io/os: {{ .input.publish_multiarch_from.os }}
kubernetes.io/arch: {{ .input.publish_multiarch_from.arch }}
{{ end }}
steps: steps:
- name: deploy - name: deploy
image: gitea.internal.example.com/examples/docker:{{ if .input.docker_image_tag }}{{ .input.docker_image_tag }}{{ else }}latest{{ end }} image: gitea.internal.example.com/examples/docker:latest{{ if .input.publish_multiarch_from }}-{{ .input.publish_multiarch_from.os }}-{{ .input.publish_multiarch_from.arch }}{{ end }}
volumes: volumes:
- name: dockersock - name: dockersock
path: /var/run/ path: /var/run/
@ -81,13 +115,6 @@ steps:
from_secret: gitea-internal-password from_secret: gitea-internal-password
commands: commands:
- /bin/docker-setup - /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 }} {{ range $i, $tag := $.input.tags }}
- | - |
docker manifest create \ docker manifest create \

View File

@ -18,6 +18,7 @@ data:
build_args: build_args:
- EXAMPLE_ARG=foo - EXAMPLE_ARG=foo
tags: tags:
- latest
- "1.2.3" - "1.2.3"
- "1.2" - "1.2"
- "1" - "1"