Skip to content

[FEATURE] Retry for CI Builds #18562

@lupyuen

Description

@lupyuen

Is your feature request related to a problem? Please describe.

We did a Quantitative Analysis of our Most Expensive PR (in terms of GitHub Runner Usage). We discovered that our CI Jobs are failing too often due to the Failed Downloading of Build Dependencies...

Which causes Developer Frustration and Wasted GitHub Runners. We propose to implement Retry for CI Builds, so that the Build Dependencies will be successfully downloaded when we retry a build. This means that a NuttX Target like pinephone:nsh will be rebuilt when it fails.

Describe the solution you'd like

@simbit18 Would you be able to implement this solution? It's not so urgent, but we need more time to test it thoroughly. Please lemme know thanks :-)

  • Explained here:
    Apache NuttX RTOS: Retrying a CI Build
    Apache NuttX RTOS: Testing of Retry for CI Builds
  • We retry dotest 5 times in case of failure. We could implement a new wrapper function retrytest that will retry dotest 5 times. (dotest builds a Single NuttX Target like pinephone:nsh)
  • For Simplicity: We will retry on Any Failure: Download Failed, Compile Error, ...
  • Each Retry will have a Random Exponential Backoff. Retry 1: Wait randomly 0 to 60 seconds. Retry 2: Wait randomly 0 to 120 seconds. Retry 3: Wait randomly 0 to 240 seconds. Etc
  • We will test at NuttX Mirror Repo, though I think the Download Failures don't happen so often at that repo
  • We will also test at NuttX Build Farm, which has Download Failures much more often

Retry Logic looks like this, it refers to a Single NuttX Target like pinephone:nsh:

Image

dotest is called here, which we can rename as retrytest:

nuttx/tools/testbuild.sh

Lines 582 to 597 in 76fe46a

# Perform the build test for each entry in the test list file
for line in $testlist; do
firstch=${line:0:1}
if [ "X$firstch" == "X/" ]; then
dir=`echo $line | cut -d',' -f1`
list=`find boards$dir -name defconfig | cut -d'/' -f4,6`
for i in ${list}; do
dotest $i${line/"$dir"/}
done
else
dotest $line
fi
done

Describe alternatives you've considered

We considered the alternatives explained in this video:

Verification

  • I have verified before submitting the report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions