Enable secureboot for all flavors (minus alpine) (#2140)

This commit is contained in:
Itxaka 2024-01-16 14:27:01 +01:00 committed by GitHub
parent 2e87283c83
commit dd5ea87dd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 93 additions and 10 deletions

View File

@ -48,6 +48,16 @@ jobs:
with: with:
flavor: ubuntu flavor: ubuntu
flavor_release: "23.10" flavor_release: "23.10"
secureboot: false
needs:
- core
install-secureboot:
uses: ./.github/workflows/reusable-install-test.yaml
with:
flavor: ubuntu
flavor_release: "23.10"
secureboot: true
needs: needs:
- core - core

View File

@ -94,6 +94,33 @@ jobs:
include: include:
- flavor: opensuse - flavor: opensuse
flavorRelease: leap-15.5 flavorRelease: leap-15.5
secureboot: false
install-secureboot:
uses: ./.github/workflows/reusable-install-test.yaml
with:
flavor: ${{ matrix.flavor }}
flavor_release: ${{ matrix.flavorRelease }}
secureboot: true
needs:
- core
strategy:
fail-fast: true
matrix:
include:
- flavor: "opensuse"
flavorRelease: "leap-15.5"
- flavor: "opensuse"
flavorRelease: "tumbleweed"
- flavor: "debian"
flavorRelease: "bookworm"
- flavor: "ubuntu"
flavorRelease: "20.04"
- flavor: "ubuntu"
flavorRelease: "22.04"
- flavor: "ubuntu"
flavorRelease: "23.10"
- flavor: "fedora"
flavorRelease: "38"
zfs: zfs:
uses: ./.github/workflows/reusable-zfs-test.yaml uses: ./.github/workflows/reusable-zfs-test.yaml
with: with:

View File

@ -9,6 +9,9 @@ on:
flavor_release: flavor_release:
required: true required: true
type: string type: string
secureboot:
required: false
type: boolean
jobs: jobs:
test: test:
@ -55,14 +58,17 @@ jobs:
CREATE_VM: true CREATE_VM: true
FLAVOR: ${{ inputs.flavor }} FLAVOR: ${{ inputs.flavor }}
run: | run: |
if [ "${{ inputs.secureboot }}" = "true" ]; then
export FIRMWARE=/usr/share/OVMF/OVMF_CODE.fd
fi
ls *.iso ls *.iso
export ISO=$PWD/$(ls *.iso) export ISO=$PWD/$(ls *.iso)
echo "ISO is: $ISO" echo "ISO is: $ISO"
cp tests/go.* . cp tests/go.* .
go run github.com/onsi/ginkgo/v2/ginkgo --label-filter "install-test" --fail-fast -r ./tests go run github.com/onsi/ginkgo/v2/ginkgo -v --label-filter "install-test" --fail-fast -r ./tests
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: failure() if: failure()
with: with:
name: ${{ inputs.flavor }}-vbox.logs.zip name: ${{ inputs.flavor }}.logs.zip
path: tests/**/logs/* path: tests/**/logs/*
if-no-files-found: warn if-no-files-found: warn

View File

@ -9,7 +9,7 @@ ARG LUET_VERSION=0.35.0
# renovate: datasource=docker depName=aquasec/trivy # renovate: datasource=docker depName=aquasec/trivy
ARG TRIVY_VERSION=0.48.2 ARG TRIVY_VERSION=0.48.2
# renovate: datasource=github-releases depName=kairos-io/kairos-framework # renovate: datasource=github-releases depName=kairos-io/kairos-framework
ARG KAIROS_FRAMEWORK_VERSION="v2.6.0" ARG KAIROS_FRAMEWORK_VERSION="v2.6.3"
ARG COSIGN_SKIP=".*quay.io/kairos/.*" ARG COSIGN_SKIP=".*quay.io/kairos/.*"
# TODO: rename ISO_NAME to something like ARTIFACT_NAME because there are place where we use ISO_NAME to refer to the artifact name # TODO: rename ISO_NAME to something like ARTIFACT_NAME because there are place where we use ISO_NAME to refer to the artifact name
@ -21,7 +21,7 @@ END
ARG COSIGN_EXPERIMENTAL=0 ARG COSIGN_EXPERIMENTAL=0
ARG CGO_ENABLED=0 ARG CGO_ENABLED=0
# renovate: datasource=docker depName=quay.io/kairos/osbuilder-tools versioning=semver-coerced # renovate: datasource=docker depName=quay.io/kairos/osbuilder-tools versioning=semver-coerced
ARG OSBUILDER_VERSION=v0.10.2 ARG OSBUILDER_VERSION=v0.11.1
ARG OSBUILDER_IMAGE=quay.io/kairos/osbuilder-tools:$OSBUILDER_VERSION ARG OSBUILDER_IMAGE=quay.io/kairos/osbuilder-tools:$OSBUILDER_VERSION
ARG GOLINT_VERSION=1.52.2 ARG GOLINT_VERSION=1.52.2
# renovate: datasource=docker depName=golang # renovate: datasource=docker depName=golang
@ -207,12 +207,20 @@ luet:
kairos-dockerfile: kairos-dockerfile:
ARG --required FAMILY ARG --required FAMILY
COPY ./images . COPY ./images .
RUN --no-cache cat <(echo "# This file is auto-generated with the command: earthly +kairos-dockerfile --FAMILY=${FAMILY}") \ IF [ "$FAMILY" == "all" ]
<(sed -n '/# WARNING:/!p' Dockerfile.$FAMILY) \ ARG FAMILY_LIST="alpine debian opensuse rhel ubuntu"
<(echo) \ ELSE
<(sed -n '/# WARNING:/!p' Dockerfile.kairos) \ ARG FAMILY_LIST=$FAMILY
> ./Dockerfile END
SAVE ARTIFACT Dockerfile AS LOCAL images/Dockerfile.kairos-${FAMILY} FOR F IN $FAMILY_LIST
RUN --no-cache cat <(echo "# This file is auto-generated with the command: earthly +kairos-dockerfile --FAMILY=${F}") \
<(sed -n '/# WARNING:/!p' Dockerfile.$F) \
<(echo) \
<(sed -n '/# WARNING:/!p' Dockerfile.kairos) \
> ./Dockerfile
SAVE ARTIFACT Dockerfile AS LOCAL images/Dockerfile.kairos-${F}
END
extract-framework-profile: extract-framework-profile:
ARG FRAMEWORK_VERSION ARG FRAMEWORK_VERSION
@ -286,6 +294,14 @@ base-image:
ARG _CIMG=$(cat ./IMAGE) ARG _CIMG=$(cat ./IMAGE)
COPY +git-version/GIT_VERSION VERSION COPY +git-version/GIT_VERSION VERSION
ARG KAIROS_AGENT_DEV_BRANCH
IF [ "$KAIROS_AGENT_DEV_BRANCH" != "" ]
RUN rm -rf /usr/bin/kairos-agent
COPY github.com/kairos-io/kairos-agent:$KAIROS_AGENT_DEV_BRANCH+build-kairos-agent/kairos-agent /usr/bin/kairos-agent
END
RUN --no-cache kairos-agent version
SAVE IMAGE $_CIMG SAVE IMAGE $_CIMG
SAVE ARTIFACT /IMAGE AS LOCAL build/IMAGE SAVE ARTIFACT /IMAGE AS LOCAL build/IMAGE

View File

@ -97,6 +97,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pynvim \ python3-pynvim \
rsync \ rsync \
shared-mime-info \ shared-mime-info \
shim-signed \
snapd \ snapd \
squashfs-tools \ squashfs-tools \
sudo \ sudo \

View File

@ -96,6 +96,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pynvim \ python3-pynvim \
rsync \ rsync \
shared-mime-info \ shared-mime-info \
shim-signed \
snapd \ snapd \
squashfs-tools \ squashfs-tools \
sudo \ sudo \

View File

@ -71,6 +71,7 @@ RUN zypper in --force-resolution -y \
procps \ procps \
rng-tools \ rng-tools \
rsync \ rsync \
shim \
squashfs \ squashfs \
strace \ strace \
sudo \ sudo \

View File

@ -79,6 +79,7 @@ RUN apt-get update \
openssh-server \ openssh-server \
parted \ parted \
rsync \ rsync \
shim-signed \
snapd \ snapd \
snmpd \ snmpd \
squashfs-tools \ squashfs-tools \

View File

@ -72,6 +72,7 @@ RUN zypper in --force-resolution -y \
procps \ procps \
rng-tools \ rng-tools \
rsync \ rsync \
shim \
squashfs \ squashfs \
strace \ strace \
sudo \ sudo \

View File

@ -80,6 +80,7 @@ RUN apt-get update \
openssh-server \ openssh-server \
parted \ parted \
rsync \ rsync \
shim-signed \
snapd \ snapd \
snmpd \ snmpd \
squashfs-tools \ squashfs-tools \

View File

@ -69,6 +69,9 @@ var _ = Describe("kairos install test", Label("install-test"), func() {
Context("install", func() { Context("install", func() {
It("cloud-config syntax mixed with extended syntax", func() { It("cloud-config syntax mixed with extended syntax", func() {
expectSecureBootEnabled(vm)
_ = testInstall(`#cloud-config _ = testInstall(`#cloud-config
install: install:
bind_mounts: bind_mounts:
@ -94,6 +97,8 @@ bundles:
- container://quay.io/mocaccino/extra:edgevpn-utils-0.15.0 - container://quay.io/mocaccino/extra:edgevpn-utils-0.15.0
`, vm) `, vm)
expectSecureBootEnabled(vm)
Eventually(func() string { Eventually(func() string {
out, _ := vm.Sudo("cat /etc/foo") out, _ := vm.Sudo("cat /etc/foo")
return out return out

View File

@ -304,6 +304,19 @@ func expectRebootedToActive(vm VM) {
}) })
} }
func expectSecureBootEnabled(vm VM) {
// Check for secureboot before install, based on firmware env var
// if we set, then the test suite will load the secureboot firmware
secureboot := os.Getenv("FIRMWARE")
if secureboot != "" {
By("checking that secureboot is enabled", func() {
out, _ := vm.Sudo("dmesg | grep -i secure")
Expect(out).To(ContainSubstring("Secure boot enabled"))
})
}
}
// return the PID of the swtpm (to be killed later) and the state directory // return the PID of the swtpm (to be killed later) and the state directory
func emulateTPM(stateDir string) { func emulateTPM(stateDir string) {
t := path.Join(stateDir, "tpm") t := path.Join(stateDir, "tpm")