Skip to content

Commit

Permalink
[buildomat] Package all global zone tarballs into single tarball (#2475)
Browse files Browse the repository at this point in the history
My expectation is that we'll:

1. Download `global-zone-packages.tar.gz` in the `helios` repo
2. Unpack the contents into a staging directory
3. Use [image builder to copy the contents of these services into the
host OS image](illumos/image-builder#4)

Additionally, I made the list of artifacts a bit more explicit.
*Eventually* we could parse the package manifest to access this info,
but for now, I don't want to include any "intermediate" artifacts that
shouldn't be installed on a system.
  • Loading branch information
smklein authored Mar 7, 2023
1 parent 21d501f commit c71fa89
Showing 1 changed file with 62 additions and 3 deletions.
65 changes: 62 additions & 3 deletions .github/buildomat/jobs/package.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
#: rust_toolchain = "1.66.1"
#: output_rules = [
#: "=/work/package.tar.gz",
#: "=/work/global-zone-packages.tar.gz",
#: "=/work/zones/*.tar.gz",
#: ]
#:
#: [[publish]]
#: series = "image"
#: name = "global-zone-packages"
#: from_output = "/out/global-zone-packages.tar.gz"

set -o errexit
set -o pipefail
Expand All @@ -17,10 +22,15 @@ set -o xtrace
cargo --version
rustc --version

# Build
ptime -m ./tools/install_builder_prerequisites.sh -yp
ptime -m ./tools/create_self_signed_cert.sh -yp
ptime -m cargo run --locked --release --bin omicron-package -- -t 'image_type=standard switch_variant=asic' package
ptime -m cargo run --locked --release --bin omicron-package -- -t 'image_type=standard switch_variant=stub' package

ptime -m cargo run --locked --release --bin omicron-package -- package
tarball_src_dir="$(pwd)/out"

# Assemble some utilities into a tarball that can be used by deployment
# phases of buildomat.

files=(
out/*.tar
Expand All @@ -29,6 +39,55 @@ files=(
target/release/omicron-package
tools/create_virtual_hardware.sh
)

ptime -m tar cvzf /work/package.tar.gz "${files[@]}"

# Assemble global zone files in a temporary directory.
if ! tmp=$(mktemp -d); then
exit 1
fi
trap 'cd /; rm -rf "$tmp"' EXIT

# Header file, identifying this is intended to be layered in the global zone.
# Within the ramdisk, this means that all files under "root/foo" should appear
# in the global zone as "/foo".
echo '{"v":"1","t":"layer"}' > "$tmp/oxide.json"

# Extract the sled-agent tarball for re-packaging into the layered GZ archive.
pkg_dir="$tmp/root/opt/oxide/sled-agent"
mkdir -p "$pkg_dir"
cd "$pkg_dir"
tar -xvfz "$tarball_src_dir/omicron-sled-agent.tar"
# Ensure that the manifest for the sled agent exists in a location where it may
# be automatically initialized.
mkdir -p "$tmp/root/lib/svc/manifest/site/"
mv pkg/manifest.xml "$tmp/root/lib/svc/manifest/site/sled-agent.xml"
cd -

# Extract the mg-ddm tarball for re-packaging into the layered GZ archive.
pkg_dir="$tmp/root/opt/oxide/mg-ddm"
mkdir -p "$pkg_dir"
cd "$pkg_dir"
tar -xvfz "$tarball_src_dir/maghemite.tar"
cd -

mkdir -p /work
cd "$tmp" && tar cvfz /work/global-zone-packages.tar.gz oxide.json root
cd -

# Assemble Zone Images into their respective output locations.
mkdir -p /work/zones
mv out/*.tar.gz /work/zones/
zones=(
out/clickhouse.tar.gz
out/cockroachdb.tar.gz
out/crucible-pantry.tar.gz
out/crucible.tar.gz
out/external-dns.tar.gz
out/internal-dns.tar.gz
out/omicron-nexus.tar.gz
out/oximeter-collector.tar.gz
out/propolis-server.tar.gz
out/switch-asic.tar.gz
out/switch-stub.tar.gz
)
cp "${zones[@]}" /work/zones/

0 comments on commit c71fa89

Please sign in to comment.