Pull only the last commit from ostree repos

There is a bug in ostree pull-local in which, if repo #1 has multiple
commits, then a repo #2 is populated from repo #1 via pull-local with
depth 0, which pulls only the last commit, the repo will have info about
the existence of the old commits, but not their content. So when you try
to populate a repo #3 using depth -1, which pulls all commits,
the operation fails saying a commit could not be found [1].

As a consequence of this, the feed ostree repo in /var/www/pages/feed/
will be empty depending on how the ISO was built.

The repo is used for booting secondary nodes, so an ISO with this defect
can't be used to deploy an AIO-DX for example. It's also used to check
the current ostree commit when applying patches, so no patches can be
applied.

[1] https://github.com/ostreedev/ostree/issues/3209

Test Plan:
In `/var/www/pages/feed/rel-<SW_VERSION>/ostree_repo`
run `ostree log starlingx --repo=.` to check repo status

PASS - AIO-SX
PASS - Storage (2 Controllers + 2 Storages + 1 Worker)

Closes-Bug: 2056492

Change-Id: I9c765e467aaa26acb66b6d7f2a91d98c736e5fc8
Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com>
This commit is contained in:
Leonardo Fagundes Luz Serrano 2024-03-07 19:19:03 -03:00
parent 33a4be37bc
commit 3fb6851f06
1 changed files with 3 additions and 3 deletions

View File

@ -2012,8 +2012,8 @@ else
ostree --repo=${repo} remote add ${instbr} ${insturl}
fi
ilog "Executing: ostree --repo=${repo} pull --depth=-1 --mirror ${instbr}:${instbr}"
ostree --repo=${repo} pull --depth=-1 --mirror ${instbr}:${instbr}
ilog "Executing: ostree --repo=${repo} pull --depth=0 --mirror ${instbr}:${instbr}"
ostree --repo=${repo} pull --depth=0 --mirror ${instbr}:${instbr}
rc=$?
if [ $rc -ne 0 ]; then
report_failure_with_msg "ostree pull failed, rc=$rc"
@ -2976,7 +2976,7 @@ sw_release="xxxPLATFORM_RELEASExxx" # updated by the build
if [ "${controller}" = true ] ; then
# -1 is all commits, positive number is that number of last commits
commits="--depth=-1"
commits="--depth=0"
pull_options="${commits} --mirror"
pxeboot="${IMAGE_ROOTFS}/var/pxeboot"
feed="${IMAGE_ROOTFS}/var/www/pages/feed/rel-${sw_release}"