scripts: rebase before pushing patch and CVE metrics
PATCH 1/1 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.
Backport of 60e2011 from master.
[ YOCTO #15686 ]
--- scripts/run-cvecheck | 4 ++++ scripts/run-patchmetrics | 5 +++++ 2 files changed, 9 insertions(+)
scripts/run-cvecheck +4 -0
@@ -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
scripts/run-patchmetrics +5 -0
@@ -24,6 +24,11 @@ if [ ! -e $PARENTDIR/yocto-metrics ]; then fi $OURDIR/patchmetrics-update --repo $PARENTDIR --patchscript $PARENTDIR/scripts/contrib/patchreview.py --metadata $TARGETDIR --json $PARENTDIR/yocto-metrics/patch-status.json git -C $PARENTDIR/yocto-metrics commit -asm "Autobuilder adding new patch stats" + +if ! git -C $PARENTDIR/yocto-metrics pull --rebase; then + echo "Aborting push, metrics repo has updated and cannot rebase cleanly" + exit 1 +fi git -C $PARENTDIR/yocto-metrics push if [ ! -d $RESULTSDIR ]; then
Signature · 1 line
2.43.0
Quoted 10 lines · Ross Burton via lists.yoctoproject.org
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.
Backport of 60e2011 from master.
[ YOCTO #15686 ]
Signed-off-by Ross Burton <[email protected]>
Thanks Ross,
I missed that when fixing
https://bugzilla.yoctoproject.org/show_bug.cgi?id=16111 (on Dunfell)
There is a now obsolete comment to remove/rephrase:
# 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.
But, this is also the case on master. I plan to send a patch someday.
---
Quoted 60 lines
scripts/run-cvecheck | 4 ++++ scripts/run-patchmetrics | 5 +++++ 2 files changed, 9 insertions(+)scripts/run-cvecheck +0
-0@@ -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 forbranch $BRANCH" || true
if [ "$PUSH" = "1" ]; thenscripts/run-cvecheck +2
-0+ if ! git -C $METRICSDIR pull --rebase; then + echo "Aborting push, metrics repo has updated and cannotrebase cleanly"
scripts/run-cvecheck +2
-0+ exit 1 + fi git -C $METRICSDIR push fi $OURDIR/cve-report.py tmp/log/cve/cve-summary.json >
$RESULTSDIR/cve-status-$BRANCH.txtscripts/run-patchmetrics +0
-0@@ -24,6 +24,11 @@ if [ ! -e $PARENTDIR/yocto-metrics ]; then fi $OURDIR/patchmetrics-update --repo $PARENTDIR --patchscript
$PARENTDIR/scripts/contrib/patchreview.py--metadata $TARGETDIR --json$PARENTDIR/yocto-metrics/patch-status.json
git -C $PARENTDIR/yocto-metrics commit -asm "Autobuilder adding new patch
stats"scripts/run-patchmetrics +3
-0+ +if ! git -C $PARENTDIR/yocto-metrics pull --rebase; then + echo "Aborting push, metrics repo has updated and cannot rebasecleanly"
scripts/run-patchmetrics +2
-1+ exit 1 +fi git -C $PARENTDIR/yocto-metrics push if [ ! -d $RESULTSDIR ]; then --2.43.0
------------
Links: You receive all messages sent to this group. View/Reply Online (#3143):
https://lists.yoctoproject.org/g/yocto-patches/message/3143
Mute This Topic: https://lists.yoctoproject.org/mt/117528934/4316185
Group Owner: [email protected] Unsubscribe:
https://lists.yoctoproject.org/g/yocto-patches/leave/13179410/4316185/929767106/xyzzy
[[email protected]]
------------
Signature · 2 lines
Yoann Congal Smile ECS
Le jeu. 29 janv. 2026 à 18:07, Yoann Congal <[email protected]> a écrit :
Quoted 21 lines
Quoted 10 lines · Ross Burton via lists.yoctoproject.org
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.
Backport of 60e2011 from master.
[ YOCTO #15686 ]
Signed-off-by Ross Burton <[email protected]>Thanks Ross,
I missed that when fixing
https://bugzilla.yoctoproject.org/show_bug.cgi?id=16111 (on Dunfell)
Quoted 7 lines
There is a now obsolete comment to remove/rephrase:
# 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.
But, this is also the case on master. I plan to send a patch someday.
Also, shouldn't we do the same for the other code path? (if "$BRANCH" = "master" to update cve-count-byday.json)
https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-cvecheck#n106
Quoted 67 lines
---
Quoted 47 lines
scripts/run-cvecheck | 4 ++++ scripts/run-patchmetrics | 5 +++++ 2 files changed, 9 insertions(+)scripts/run-cvecheck +0
-0@@ -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 forbranch $BRANCH" || true
if [ "$PUSH" = "1" ]; thenscripts/run-cvecheck +2
-0+ if ! git -C $METRICSDIR pull --rebase; then + echo "Aborting push, metrics repo has updated and cannotrebase cleanly"
scripts/run-cvecheck +2
-0+ exit 1 + fi git -C $METRICSDIR push fi $OURDIR/cve-report.py tmp/log/cve/cve-summary.json >
$RESULTSDIR/cve-status-$BRANCH.txtscripts/run-patchmetrics +0
-0@@ -24,6 +24,11 @@ if [ ! -e $PARENTDIR/yocto-metrics ]; then fi $OURDIR/patchmetrics-update --repo $PARENTDIR --patchscript
$PARENTDIR/scripts/contrib/patchreview.py--metadata $TARGETDIR --json$PARENTDIR/yocto-metrics/patch-status.json
git -C $PARENTDIR/yocto-metrics commit -asm "Autobuilder adding new
patch stats"scripts/run-patchmetrics +3
-0+ +if ! git -C $PARENTDIR/yocto-metrics pull --rebase; then + echo "Aborting push, metrics repo has updated and cannot rebasecleanly"
scripts/run-patchmetrics +2
-1+ exit 1 +fi git -C $PARENTDIR/yocto-metrics push if [ ! -d $RESULTSDIR ]; then --2.43.0
Quoted 13 lines
------------
Links: You receive all messages sent to this group. View/Reply Online (#3143):
https://lists.yoctoproject.org/g/yocto-patches/message/3143
Mute This Topic: https://lists.yoctoproject.org/mt/117528934/4316185
Group Owner: [email protected] Unsubscribe:
https://lists.yoctoproject.org/g/yocto-patches/leave/13179410/4316185/929767106/xyzzy
[[email protected]]
--------------
Yoann Congal
Smile ECS
Signature · 2 lines
Yoann Congal Smile ECS