-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't
pull-local
over 9p during rpm-ostree compose
Instead of having rpm-ostree effectively doing a `pull-local` under the hood over 9p, change things so we compose in a local repo, export the commit to an archive and only copy *that* over 9p. This should greatly help with pipelines hitting ENOMEM due to transferring many small files over 9p: openshift/os#594 An initial approach exported to OCI archive instead, but encapsulating and unencapsulating are more expensive operations. Unfortunately, we still need to unpack into `tmp/repo` given that many follow-up commands expect the commit to be available in `tmp/repo`. If we can drop that assumption (and get rid of `tmp/repo` entirely), we could refactor things further so that `compose.sh` creates the final chunked OCI artifact upfront. In local testing, this adds about 30s to `cosa build`. We still compress just once, and we get hardlinks pulling out of the tarball. (cherry picked from commit 269aa38)
- Loading branch information
Showing
4 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
output_tarball=$1; shift | ||
output_composejson=$1; shift | ||
|
||
tarball=cache/output.tar | ||
composejson=cache/compose.json | ||
|
||
repo=cache/repo | ||
rm -rf "${repo}" "${composejson}" | ||
ostree init --repo="${repo}" --mode=archive-z2 | ||
|
||
# we do need to pull at least the overlay bits over 9p, but it shouldn't be that | ||
# many files | ||
ostree refs --repo tmp/repo overlay --list | \ | ||
xargs -r ostree pull-local --repo "${repo}" tmp/repo | ||
# And import commit metadata for all refs; this will bring in the previous | ||
# build if there is one. Ideally, we'd import the SELinux policy too to take | ||
# advantage of https://github.com/coreos/rpm-ostree/pull/1704 but that's yet | ||
# more files over 9p and our pipelines don't have cache anyway (and devs likely | ||
# use the privileged path). | ||
ostree refs --repo tmp/repo | \ | ||
xargs -r ostree pull-local --commit-metadata-only --repo "${repo}" tmp/repo | ||
|
||
# run rpm-ostree | ||
"$@" --repo "${repo}" --write-composejson-to "${composejson}" | ||
|
||
if [ ! -f "${composejson}" ]; then | ||
# no commit was produced; we're done | ||
exit 0 | ||
fi | ||
|
||
tar -f "${tarball}" -C "${repo}" -c . | ||
|
||
# this is key bit where we move the OSTree content over 9p | ||
mv "${tarball}" "${output_tarball}" | ||
mv "${composejson}" "${output_composejson}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,5 @@ gdisk xfsprogs e2fsprogs dosfstools btrfs-progs | |
|
||
# needed for basic CA support | ||
ca-certificates | ||
|
||
tar |