Add guards for templates (#114)

This commit is contained in:
Itxaka 2023-02-14 12:40:26 +01:00 committed by GitHub
parent e54fa12131
commit 4d565617ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 12 deletions

View File

@ -1,13 +1,14 @@
{{ if eq .Values.init "systemd" }} {{ if .Values.init }}
{{ if eq .Values.init "systemd" }}
image: golang:1.18 image: golang:1.18
prelude: prelude:
- apt-get update - apt-get update
- apt-get install -y git - apt-get install -y git
{{ else }} {{ else }}
image: golang:1.18-alpine image: golang:1.18-alpine
prelude: prelude:
- apk add git - apk add git
{{ end }} {{ end }}
- git clone https://github.com/kairos-io/provider-kairos - git clone https://github.com/kairos-io/provider-kairos
- | - |
PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && \ PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && \
@ -17,3 +18,4 @@ steps:
- cd provider-kairos && go build -o agent-provider-kairos - cd provider-kairos && go build -o agent-provider-kairos
- mv provider-kairos/agent-provider-kairos /system/providers/agent-provider-kairos - mv provider-kairos/agent-provider-kairos /system/providers/agent-provider-kairos
- ln -s /system/providers/agent-provider-kairos /usr/bin/kairos - ln -s /system/providers/agent-provider-kairos /usr/bin/kairos
{{ end }}

View File

@ -7,8 +7,10 @@ steps:
{{ if .Values.distribution }} {{ if .Values.distribution }}
{{if eq .Values.distribution "opensuse" }} {{if eq .Values.distribution "opensuse" }}
- zypper in -y --no-recommends {{.Values.packages}} - zypper in -y --no-recommends {{.Values.packages}}
{{ if eq .Values.arch "arm64" }} {{ if .Values.arch }}
{{ if eq .Values.arch "arm64" }}
- zypper in -y {{.Values.packages_arm}} - zypper in -y {{.Values.packages_arm}}
{{ end }}
{{ end }} {{ end }}
- zypper cc - zypper cc
{{ if .Values.arch }} {{ if .Values.arch }}
@ -28,10 +30,12 @@ steps:
{{else if eq .Values.distribution "ubuntu" }} {{else if eq .Values.distribution "ubuntu" }}
# Note for future issues with grub: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1879558 https://github.com/rancher-sandbox/cOS-toolkit/pull/101#discussion_r621929109 # Note for future issues with grub: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1879558 https://github.com/rancher-sandbox/cOS-toolkit/pull/101#discussion_r621929109
- apt-get update - apt-get update
{{ if eq .Values.arch "arm64" }} {{ if .Values.arch }}
{{ if eq .Values.arch "arm64" }}
- DEBIAN_FRONTEND=noninteractive apt-get install -y {{.Values.packages_arm}} - DEBIAN_FRONTEND=noninteractive apt-get install -y {{.Values.packages_arm}}
{{ else }} {{ else }}
- DEBIAN_FRONTEND=noninteractive apt-get install -y {{.Values.packages}} - DEBIAN_FRONTEND=noninteractive apt-get install -y {{.Values.packages}}
{{ end }}
{{ end }} {{ end }}
- apt-get clean - apt-get clean
- | - |

View File

@ -2,15 +2,17 @@
image: {{.Values.image}} image: {{.Values.image}}
{{if eq .Values.distribution "opensuse"}} {{if eq .Values.distribution "opensuse"}}
{{ if eq .Values.arch "arm64" }} {{ if .Values.arch }}
{{ if eq .Values.arch "arm64" }}
prelude: prelude:
- zypper in -y grub2-arm64-efi grub2 - zypper in -y grub2-arm64-efi grub2
{{ else if eq .Values.arch "arm" }} {{ else if eq .Values.arch "arm" }}
{{ else }} {{ else }}
prelude: prelude:
- zypper in -y grub2-i386-pc grub2-x86_64-efi grub2 - zypper in -y grub2-i386-pc grub2-x86_64-efi grub2
{{ end }} {{ end }}
{{end}}
{{end}} {{end}}
steps: steps:

View File

@ -1,5 +1,6 @@
# This is only for amd64 # This is only for amd64
{{ if eq .Values.arch "" }} {{ if .Values.arch }}
{{ if eq .Values.arch "" }}
image: registry.opensuse.org/opensuse/leap:15.3 image: registry.opensuse.org/opensuse/leap:15.3
prelude: prelude:
@ -12,4 +13,5 @@ includes:
excludes: excludes:
# This is shipped by system/grub2-efi # This is shipped by system/grub2-efi
- usr/share/efi/.*/grub.efi - usr/share/efi/.*/grub.efi
{{end}}
{{end}} {{end}}

View File

@ -1,5 +1,6 @@
# This is only for amd64 # This is only for amd64
{{ if eq .Values.arch "" }} {{ if .Values.arch }}
{{ if eq .Values.arch "" }}
requires: requires:
- name: "toolchain-go" - name: "toolchain-go"
category: "development" category: "development"
@ -15,4 +16,5 @@ steps:
- cd go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/ && git checkout v"${PACKAGE_VERSION}" -b build && make build && mv build/* /usr/bin/ - cd go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/ && git checkout v"${PACKAGE_VERSION}" -b build && make build && mv build/* /usr/bin/
includes: includes:
- usr/bin/.*|usr/bin - usr/bin/.*|usr/bin
{{ end }}
{{ end }} {{ end }}