Skip to content

Commit

Permalink
Combine host and trampoline OS images into one CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus-it committed Oct 12, 2023
1 parent 7e88bdf commit 705f706
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 81 deletions.
43 changes: 37 additions & 6 deletions .github/buildomat/jobs/host-image.sh
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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"

54 changes: 0 additions & 54 deletions .github/buildomat/jobs/trampoline-image.sh

This file was deleted.

7 changes: 2 additions & 5 deletions .github/buildomat/jobs/tuf-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down
16 changes: 0 additions & 16 deletions tools/build-host-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 705f706

Please sign in to comment.