scripts: rebase before pushing patch and CVE metrics

There's a chance that run-cvecheck and run-patchmetrics fail to push
because the remote repository has changed. Try to resolve this by pulling
and rebasing immediately before the push, and failing if we can't rebase.

[ YOCTO #15529 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton 2024-07-12 12:17:51 +01:00 committed by Richard Purdie
parent 0e304514dd
commit 60e2011f34
2 changed files with 8 additions and 0 deletions

View File

@ -90,6 +90,10 @@ if [ -e tmp/log/cve/cve-summary.json ]; then
git -C $METRICSDIR add cve-check/$BRANCH/$TIMESTAMP.json git -C $METRICSDIR add cve-check/$BRANCH/$TIMESTAMP.json
git -C $METRICSDIR commit -asm "Autobuilder adding new CVE data for branch $BRANCH" || true git -C $METRICSDIR commit -asm "Autobuilder adding new CVE data for branch $BRANCH" || true
if [ "$PUSH" = "1" ]; then if [ "$PUSH" = "1" ]; then
if ! git -C $METRICSDIR pull --rebase; then
echo "Aborting push, metrics repo has updated and cannot rebase cleanly"
exit 1
fi
git -C $METRICSDIR push git -C $METRICSDIR push
fi fi
$OURDIR/cve-report.py tmp/log/cve/cve-summary.json > $RESULTSDIR/cve-status-$BRANCH.txt $OURDIR/cve-report.py tmp/log/cve/cve-summary.json > $RESULTSDIR/cve-status-$BRANCH.txt

View File

@ -105,6 +105,10 @@ set +x
git -C $METRICSDIR commit -asm "Autobuilder adding new patch stats" || true git -C $METRICSDIR commit -asm "Autobuilder adding new patch stats" || true
if [ "$PUSH" = "1" ]; then if [ "$PUSH" = "1" ]; then
if ! git -C $METRICSDIR pull --rebase; then
echo "Aborting push, metrics repo has updated and cannot rebase cleanly"
exit 1
fi
git -C $METRICSDIR push git -C $METRICSDIR push
fi fi