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,3 +1,4 @@
{{ if .Values.init }}
{{ if eq .Values.init "systemd" }} {{ if eq .Values.init "systemd" }}
image: golang:1.18 image: golang:1.18
prelude: prelude:
@ -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,9 +7,11 @@ 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 .Values.arch }}
{{ if eq .Values.arch "arm64" }} {{ 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 }}
{{ if eq .Values.arch "arm64" }} {{ if eq .Values.arch "arm64" }}
@ -28,11 +30,13 @@ 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 .Values.arch }}
{{ if eq .Values.arch "arm64" }} {{ 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
- | - |
kernel=$(ls /boot/vmlinuz-* | head -n1) && \ kernel=$(ls /boot/vmlinuz-* | head -n1) && \

View File

@ -2,6 +2,7 @@
image: {{.Values.image}} image: {{.Values.image}}
{{if eq .Values.distribution "opensuse"}} {{if eq .Values.distribution "opensuse"}}
{{ if .Values.arch }}
{{ if eq .Values.arch "arm64" }} {{ if eq .Values.arch "arm64" }}
prelude: prelude:
- zypper in -y grub2-arm64-efi grub2 - zypper in -y grub2-arm64-efi grub2
@ -12,6 +13,7 @@ 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:
- mkdir /grub-artifacts - mkdir /grub-artifacts

View File

@ -1,4 +1,5 @@
# This is only for amd64 # This is only for amd64
{{ if .Values.arch }}
{{ if eq .Values.arch "" }} {{ if eq .Values.arch "" }}
image: registry.opensuse.org/opensuse/leap:15.3 image: registry.opensuse.org/opensuse/leap:15.3
@ -13,3 +14,4 @@ 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,4 +1,5 @@
# This is only for amd64 # This is only for amd64
{{ if .Values.arch }}
{{ if eq .Values.arch "" }} {{ if eq .Values.arch "" }}
requires: requires:
- name: "toolchain-go" - name: "toolchain-go"
@ -16,3 +17,4 @@ steps:
includes: includes:
- usr/bin/.*|usr/bin - usr/bin/.*|usr/bin
{{ end }} {{ end }}
{{ end }}