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

cmdlib: consistently commit layers with same options #2703

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ prepare_build() {
export overrides_active_stamp
}

commit_ostree_layer() {
local rootfs=$1; shift
local branch=$1; shift
ostree commit --repo="${tmprepo}" --tree=dir="${rootfs}" -b "${branch}" \
--owner-uid 0 --owner-gid 0 --no-xattrs --no-bindings --parent=none \
--mode-ro-executables --timestamp "${git_timestamp}" "$@"
}

commit_overlay() {
local name path respath
name=$1
Expand All @@ -281,9 +289,7 @@ commit_overlay() {
# files, but we do.
touch "${TMPDIR}/overlay/statoverride"
echo -n "Committing ${name}: ${path} ... "
ostree commit --repo="${tmprepo}" --tree=dir="${TMPDIR}/overlay" -b "${name}" \
--owner-uid 0 --owner-gid 0 --no-xattrs --no-bindings --parent=none \
--mode-ro-executables --timestamp "${git_timestamp}" \
commit_ostree_layer "${TMPDIR}/overlay" "${name}" \
--statoverride <(sed -e '/^#/d' "${TMPDIR}/overlay/statoverride") \
--skip-list <(echo /statoverride)
}
Expand Down Expand Up @@ -431,9 +437,9 @@ EOF
# available in content_sets.yaml. The mapped repos are then available in content_manifest.json
# Feature: https://issues.redhat.com/browse/GRPA-3731
create_content_manifest "$configdir"/content_sets.yaml "${tmp_overridesdir}/contentsetrootfs/usr/share/buildinfo/content_manifest.json"

echo -n "Committing ${tmp_overridesdir}/contentsetrootfs... "
ostree commit --repo="$tmprepo" --tree=dir="${tmp_overridesdir}"/contentsetrootfs -b contentset
commit_ostree_layer "${tmp_overridesdir}/contentsetrootfs" contentset
Copy link
Member

Choose a reason for hiding this comment

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

OK, and the bug was missing --timestamp here, which is why it only applies to RHCOS.

layers="${layers} contentset"
fi

Expand All @@ -448,9 +454,7 @@ EOF
if [[ -d "${rootfs_overrides}" && -n $(ls -A "${rootfs_overrides}") ]]; then
echo -n "Committing ${rootfs_overrides}... "
touch "${overrides_active_stamp}"
ostree commit --repo="${tmprepo}" --tree=dir="${rootfs_overrides}" -b cosa-overrides-rootfs \
--owner-uid 0 --owner-gid 0 --no-xattrs --no-bindings --parent=none \
--timestamp "${git_timestamp}"
commit_ostree_layer "${rootfs_overrides}" "cosa-overrides-rootfs"
cat >> "${override_manifest}" << EOF
ostree-override-layers:
- cosa-overrides-rootfs
Expand Down