Skip to contentSkip to conversation

scripts: pull before updating metrics

PATCH New [email protected] 1 participant 1 message Nov 3, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: pull before updating metrics

From: Ross Burton <[email protected]>

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.

---
 scripts/run-cvecheck     | 6 ++++++
 scripts/run-patchmetrics | 6 ++++++
 2 files changed, 12 insertions(+)
scripts/run-cvecheck +6 -0
index 711bec2..e0d52df 100755
@@ -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
scripts/run-patchmetrics +6 -0
index a75cf52..a3f6d8f 100755
@@ -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
 #
Signature · 1 line
2.34.1