diff mbox series

[yocto-autobuilder-helper] scripts: rebase before pushing patch and CVE metrics

Message ID 20240712111751.3696492-1-ross.burton@arm.com
State New
Headers show
Series [yocto-autobuilder-helper] scripts: rebase before pushing patch and CVE metrics | expand

Commit Message

Ross Burton July 12, 2024, 11:17 a.m. UTC
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>
---
 scripts/run-cvecheck     | 4 ++++
 scripts/run-patchmetrics | 4 ++++
 2 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/scripts/run-cvecheck b/scripts/run-cvecheck
index d22dc825..c6b00660 100755
--- a/scripts/run-cvecheck
+++ b/scripts/run-cvecheck
@@ -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 commit -asm "Autobuilder adding new CVE data for branch $BRANCH" || true
     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
     fi
     $OURDIR/cve-report.py tmp/log/cve/cve-summary.json > $RESULTSDIR/cve-status-$BRANCH.txt
diff --git a/scripts/run-patchmetrics b/scripts/run-patchmetrics
index fc2e23b3..3842f1a9 100755
--- a/scripts/run-patchmetrics
+++ b/scripts/run-patchmetrics
@@ -105,6 +105,10 @@  set +x
 git -C $METRICSDIR commit -asm "Autobuilder adding new patch stats" || true
 
 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
 fi