Skip to content

Commit c71fa89

Browse files
authored
[buildomat] Package all global zone tarballs into single tarball (#2475)
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.
1 parent 21d501f commit c71fa89

File tree

1 file changed

+62
-3
lines changed

1 file changed

+62
-3
lines changed

.github/buildomat/jobs/package.sh

100644100755
Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
#: rust_toolchain = "1.66.1"
77
#: output_rules = [
88
#: "=/work/package.tar.gz",
9+
#: "=/work/global-zone-packages.tar.gz",
910
#: "=/work/zones/*.tar.gz",
1011
#: ]
1112
#:
13+
#: [[publish]]
14+
#: series = "image"
15+
#: name = "global-zone-packages"
16+
#: from_output = "/out/global-zone-packages.tar.gz"
1217

1318
set -o errexit
1419
set -o pipefail
@@ -17,10 +22,15 @@ set -o xtrace
1722
cargo --version
1823
rustc --version
1924

25+
# Build
2026
ptime -m ./tools/install_builder_prerequisites.sh -yp
21-
ptime -m ./tools/create_self_signed_cert.sh -yp
27+
ptime -m cargo run --locked --release --bin omicron-package -- -t 'image_type=standard switch_variant=asic' package
28+
ptime -m cargo run --locked --release --bin omicron-package -- -t 'image_type=standard switch_variant=stub' package
2229

23-
ptime -m cargo run --locked --release --bin omicron-package -- package
30+
tarball_src_dir="$(pwd)/out"
31+
32+
# Assemble some utilities into a tarball that can be used by deployment
33+
# phases of buildomat.
2434

2535
files=(
2636
out/*.tar
@@ -29,6 +39,55 @@ files=(
2939
target/release/omicron-package
3040
tools/create_virtual_hardware.sh
3141
)
42+
3243
ptime -m tar cvzf /work/package.tar.gz "${files[@]}"
44+
45+
# Assemble global zone files in a temporary directory.
46+
if ! tmp=$(mktemp -d); then
47+
exit 1
48+
fi
49+
trap 'cd /; rm -rf "$tmp"' EXIT
50+
51+
# Header file, identifying this is intended to be layered in the global zone.
52+
# Within the ramdisk, this means that all files under "root/foo" should appear
53+
# in the global zone as "/foo".
54+
echo '{"v":"1","t":"layer"}' > "$tmp/oxide.json"
55+
56+
# Extract the sled-agent tarball for re-packaging into the layered GZ archive.
57+
pkg_dir="$tmp/root/opt/oxide/sled-agent"
58+
mkdir -p "$pkg_dir"
59+
cd "$pkg_dir"
60+
tar -xvfz "$tarball_src_dir/omicron-sled-agent.tar"
61+
# Ensure that the manifest for the sled agent exists in a location where it may
62+
# be automatically initialized.
63+
mkdir -p "$tmp/root/lib/svc/manifest/site/"
64+
mv pkg/manifest.xml "$tmp/root/lib/svc/manifest/site/sled-agent.xml"
65+
cd -
66+
67+
# Extract the mg-ddm tarball for re-packaging into the layered GZ archive.
68+
pkg_dir="$tmp/root/opt/oxide/mg-ddm"
69+
mkdir -p "$pkg_dir"
70+
cd "$pkg_dir"
71+
tar -xvfz "$tarball_src_dir/maghemite.tar"
72+
cd -
73+
74+
mkdir -p /work
75+
cd "$tmp" && tar cvfz /work/global-zone-packages.tar.gz oxide.json root
76+
cd -
77+
78+
# Assemble Zone Images into their respective output locations.
3379
mkdir -p /work/zones
34-
mv out/*.tar.gz /work/zones/
80+
zones=(
81+
out/clickhouse.tar.gz
82+
out/cockroachdb.tar.gz
83+
out/crucible-pantry.tar.gz
84+
out/crucible.tar.gz
85+
out/external-dns.tar.gz
86+
out/internal-dns.tar.gz
87+
out/omicron-nexus.tar.gz
88+
out/oximeter-collector.tar.gz
89+
out/propolis-server.tar.gz
90+
out/switch-asic.tar.gz
91+
out/switch-stub.tar.gz
92+
)
93+
cp "${zones[@]}" /work/zones/

0 commit comments

Comments
 (0)