Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[buildomat] Package all global zone tarballs into single tarball #2475

Merged
merged 17 commits into from
Mar 7, 2023

Conversation

smklein
Copy link
Collaborator

@smklein smklein commented Mar 3, 2023

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

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.

@smklein smklein requested review from iliana and jclulow and removed request for iliana March 3, 2023 17:50
#: "=/work/zones/*.tar.gz",
#: ]
#:
#: [[publish]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See: https://github.com/oxidecomputer/buildomat#configuration , under publish specifically

I think this'll be necessary for the helios repo to be able to "pick up these output artifacts" by a particular commit of Omicron

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm doing that work in oxidecomputer/helios#56

@jclulow
Copy link
Collaborator

jclulow commented Mar 6, 2023

I think the artefact we want to produce here actually looks a lot more like a layer archive for a zone image; i.e., it would contain an oxide.json metadata file and then a set of files and directories under root/ that should be unpacked as-is into the OS ramdisk image:

$ tar tfz omicron-gz.tar.gz
oxide.json
root/
root/opt/
root/opt/oxide/
root/opt/oxide/sled-agent/
root/opt/oxide/sled-agent/pkg/
root/opt/oxide/sled-agent/pkg/config-rss.toml
root/opt/oxide/sled-agent/pkg/config.toml
root/opt/oxide/sled-agent/sled-agent
root/opt/oxide/mg-ddm/
root/opt/oxide/mg-ddm/pkg/
root/opt/oxide/mg-ddm/pkg/ddm/
root/opt/oxide/mg-ddm/pkg/ddm/manifest.xml
root/opt/oxide/mg-ddm/pkg/ddm_method_script.sh
root/opt/oxide/mg-ddm/ddmd
root/opt/oxide/mg-ddm/ddmadm
root/lib/
root/lib/svc/
root/lib/svc/manifest/
root/lib/svc/manifest/site/
root/lib/svc/manifest/site/sled-agent.xml

I used this script to produce the archive above, based on CI bits from the latest omicron at time of writing:

#!/bin/bash

set -o errexit
set -o pipefail
set -o xtrace

out="$PWD/omicron-gz.tar.gz"

#
# Create a temporary directory in which to work:
#
if ! dir=$(mktemp -d); then
        exit 1
fi
trap 'cd /; rm -rf "$dir"' EXIT

#
# Grab package.tar.gz from a "helios / package" buildomat job in the omicron
# repository:
#
url='https://buildomat.eng.oxide.computer/wg/0/artefact'
url+='/01GTMSQ3YXVEERT7507JD5JHMR'
url+='/PC4GK7nwpbMpBW38aIYmpuxGZyGzLismlZVfoDYO5gt8FdTq'
url+='/01GTMSQFKEV7RCX1GJPR4TKFFW'
url+='/01GTMV6X38PK4DFWDKVMMAJCAS'
url+='/package.tar.gz'
curl -Lo "$dir/package.tar.gz" "$url"

#
# Unpack the archive so that we can pick out the bits we need:
#
mkdir -p "$dir/extract"
cd "$dir/extract"
tar xvfz "$dir/package.tar.gz"

mkdir -p "$dir/root/opt/oxide/sled-agent"
cd "$dir/root/opt/oxide/sled-agent"
tar xvfz "$dir/extract/out/omicron-sled-agent.tar"
mkdir -p "$dir/root/lib/svc/manifest/site"
mv pkg/manifest.xml "$dir/root/lib/svc/manifest/site/sled-agent.xml"

mkdir -p "$dir/root/opt/oxide/mg-ddm"
cd "$dir/root/opt/oxide/mg-ddm"
tar xvfz "$dir/extract/out/maghemite.tar"

echo '{"v":"1","t":"layer"}' > "$dir/oxide.json"
cd "$dir" && tar cvfz "$out" oxide.json root

Then helios.git can just unpack this one published artefact into a proto directory and we can layer it on as the final step in packing up the ramdisk image without needing to move things around, etc.

@smklein
Copy link
Collaborator Author

smklein commented Mar 6, 2023

I think the artefact we want to produce here actually looks a lot more like a layer archive for a zone image; i.e., it would contain an oxide.json metadata file and then a set of files and directories under root/ that should be unpacked as-is into the OS ramdisk image:

Sure thing, updated package.sh to use this approach.

@smklein smklein merged commit c71fa89 into main Mar 7, 2023
@smklein smklein deleted the publish-gz branch March 7, 2023 00:00
smklein added a commit that referenced this pull request Mar 10, 2023
- Depends on #2475
- Ingests global zone packages, and places them in the ramdisk
- Output of job: Helios image, which should be bootable on a Gimlet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants