diff mbox series

[yocto-autobuilder-helper] scripts: pull before updating metrics

Message ID 20231103124519.2072402-1-ross.burton@arm.com
State New
Headers show
Series [yocto-autobuilder-helper] scripts: pull before updating metrics | expand

Commit Message

Ross Burton Nov. 3, 2023, 12:45 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

Do another git-pull in the metrics repository before updating the
metrics, in case other metrics jobs running in parallel have updated the
repositories since they were cloned.  There will always be possibility
of racing metrics jobs, but this should reduce the chance of it
happening.

An alternative would be to commit and then rebase before pushing, but I
fear that a git-merge could produce invalid JSON and we'd have to
manually fix up the repository.  In my opinion, a wasted metrics run is
preferable to potentially corrupted repositories.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/run-cvecheck     | 6 ++++++
 scripts/run-patchmetrics | 6 ++++++
 2 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/scripts/run-cvecheck b/scripts/run-cvecheck
index 711bec2..e0d52df 100755
--- a/scripts/run-cvecheck
+++ b/scripts/run-cvecheck
@@ -71,6 +71,12 @@  if [ ! -d $RESULTSDIR ]; then
     mkdir $RESULTSDIR
 fi
 
+# Do another pull to make sure we're as up to date as possible.  This is
+# preferable to committing and rebasing before pushing as it would be better to
+# waste some time repeating work than commit potentially corrupted files from a
+# git merge gone wrong.
+git -C $METRICSDIR pull
+
 cd ..
 set +u
 . oe-init-build-env build
diff --git a/scripts/run-patchmetrics b/scripts/run-patchmetrics
index a75cf52..a3f6d8f 100755
--- a/scripts/run-patchmetrics
+++ b/scripts/run-patchmetrics
@@ -87,6 +87,12 @@  if [ "$BRANCH" != "master" ]; then
     exit 0
 fi
 
+# Do another pull to make sure we're as up to date as possible.  This is
+# preferable to committing and rebasing before pushing as it would be better to
+# waste some time repeating work than commit potentially corrupted files from a
+# git merge gone wrong.
+git -C $METRICSDIR pull
+
 #
 # Patch Metrics
 #