From 705f7062bac5b78409f662803aa68e382c632164 Mon Sep 17 00:00:00 2001 From: Andy Fiddaman Date: Thu, 12 Oct 2023 23:37:12 +0100 Subject: [PATCH] Combine host and trampoline OS images into one CI job --- .github/buildomat/jobs/host-image.sh | 43 ++++++++++++++--- .github/buildomat/jobs/trampoline-image.sh | 54 ---------------------- .github/buildomat/jobs/tuf-repo.sh | 7 +-- tools/build-host-image.sh | 16 ------- 4 files changed, 39 insertions(+), 81 deletions(-) delete mode 100755 .github/buildomat/jobs/trampoline-image.sh diff --git a/.github/buildomat/jobs/host-image.sh b/.github/buildomat/jobs/host-image.sh index ba0b4e1ac3c..3c2623f390b 100755 --- a/.github/buildomat/jobs/host-image.sh +++ b/.github/buildomat/jobs/host-image.sh @@ -1,11 +1,12 @@ #!/bin/bash #: -#: name = "helios / build OS image" +#: name = "helios / build OS images" #: variety = "basic" #: target = "helios-2.0" #: rust_toolchain = "1.72.1" #: output_rules = [ -#: "=/work/helios/image/output/os.tar.gz", +#: "=/work/helios/upload/os-host.tar.gz", +#: "=/work/helios/upload/os-trampoline.tar.gz", #: ] #: access_repos = [ #: "oxidecomputer/amd-apcb", @@ -44,14 +45,44 @@ TOP=$PWD source "$TOP/tools/include/force-git-over-https.sh" -# Checkout helios at a pinned commit into /work/helios -git clone https://github.com/oxidecomputer/helios.git /work/helios -cd /work/helios +# Check out helios into /work/helios +HELIOSDIR=/work/helios +git clone https://github.com/oxidecomputer/helios.git "$HELIOSDIR" +cd "$HELIOSDIR" +gmake setup + +# Commands that "helios-build" would ask us to run (either explicitly or +# implicitly, to avoid an error). +rc=0 +pfexec pkg install -q /system/zones/brand/omicron1/tools || rc=$? +case $rc in + # `man pkg` notes that exit code 4 means no changes were made because + # there is nothing to do; that's fine. Any other exit code is an error. + 0 | 4) ;; + *) exit $rc ;; +esac + +pfexec zfs create -p "rpool/images/$USER" + # TODO: Consider importing zones here too? cd "$TOP" +mkdir "$HELIOSDIR/upload" + +banner OS ./tools/build-host-image.sh -B \ -S /input/package/work/zones/switch-asic.tar.gz \ - /work/helios \ + "$HELIOSDIR" \ /input/package/work/global-zone-packages.tar.gz + +mv "$HELIOSDIR/image/output/os.tar.gz" "$HELIOSDIR/upload/os-host.tar.gz" + +banner Trampoline + +./tools/build-host-image.sh -R \ + "$HELIOSDIR" \ + /input/package/work/trampoline-global-zone-packages.tar.gz + +mv "$HELIOSDIR/image/output/os.tar.gz" "$HELIOSDIR/upload/os-trampoline.tar.gz" + diff --git a/.github/buildomat/jobs/trampoline-image.sh b/.github/buildomat/jobs/trampoline-image.sh deleted file mode 100755 index 6014d7dca02..00000000000 --- a/.github/buildomat/jobs/trampoline-image.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -#: -#: name = "helios / build trampoline OS image" -#: variety = "basic" -#: target = "helios-2.0" -#: rust_toolchain = "1.72.1" -#: output_rules = [ -#: "=/work/helios/image/output/os.tar.gz", -#: ] -#: access_repos = [ -#: "oxidecomputer/amd-apcb", -#: "oxidecomputer/amd-efs", -#: "oxidecomputer/amd-firmware", -#: "oxidecomputer/amd-flash", -#: "oxidecomputer/amd-host-image-builder", -#: "oxidecomputer/boot-image-tools", -#: "oxidecomputer/chelsio-t6-roms", -#: "oxidecomputer/compliance-pilot", -#: "oxidecomputer/facade", -#: "oxidecomputer/helios", -#: "oxidecomputer/helios-omicron-brand", -#: "oxidecomputer/helios-omnios-build", -#: "oxidecomputer/helios-omnios-extra", -#: "oxidecomputer/nanobl-rs", -#: ] -#: -#: [dependencies.package] -#: job = "helios / package" -#: -#: [[publish]] -#: series = "image" -#: name = "os-trampoline.tar.gz" -#: from_output = "/work/helios/image/output/os.tar.gz" -#: - -set -o errexit -set -o pipefail -set -o xtrace - -cargo --version -rustc --version - -TOP=$PWD - -source "$TOP/tools/include/force-git-over-https.sh" - -# Checkout helios at a pinned commit into /work/helios -git clone https://github.com/oxidecomputer/helios.git /work/helios -cd /work/helios - -cd "$TOP" -./tools/build-host-image.sh -R \ - /work/helios \ - /input/package/work/trampoline-global-zone-packages.tar.gz diff --git a/.github/buildomat/jobs/tuf-repo.sh b/.github/buildomat/jobs/tuf-repo.sh index e169bebff64..229f715f4c3 100644 --- a/.github/buildomat/jobs/tuf-repo.sh +++ b/.github/buildomat/jobs/tuf-repo.sh @@ -19,10 +19,7 @@ #: job = "helios / package" #: #: [dependencies.host] -#: job = "helios / build OS image" -#: -#: [dependencies.trampoline] -#: job = "helios / build trampoline OS image" +#: job = "helios / build OS images" #: #: [[publish]] #: series = "rot-prod-rel" @@ -124,7 +121,7 @@ name = "$kind" version = "$VERSION" [artifact.$kind.source] kind = "file" -path = "/input/$kind/work/helios/image/output/os.tar.gz" +path = "/input/host/work/helios/upload/os-$kind.tar.gz" EOF done diff --git a/tools/build-host-image.sh b/tools/build-host-image.sh index d492e84b816..c194edb603e 100755 --- a/tools/build-host-image.sh +++ b/tools/build-host-image.sh @@ -92,22 +92,6 @@ function main # Move to the helios checkout cd "$HELIOS_PATH" - # Create the "./helios-build" command, which lets us build images - gmake setup - - # Commands that "./helios-build" would ask us to run (either explicitly - # or implicitly, to avoid an error). - rc=0 - pfexec pkg install -q /system/zones/brand/omicron1/tools || rc=$? - case $rc in - # `man pkg` notes that exit code 4 means no changes were made because - # there is nothing to do; that's fine. Any other exit code is an error. - 0 | 4) ;; - *) exit $rc ;; - esac - - pfexec zfs create -p rpool/images/"$USER" - HELIOS_REPO=https://pkg.oxide.computer/helios/2/dev/ # Build an image name that includes the omicron and host OS hashes