kapua icon indicating copy to clipboard operation
kapua copied to clipboard

Fix - Cache miss CI fall back

Open Agnul97 opened this issue 2 years ago • 1 comments

Brief description of the PR. This PR introduces a fall-back strategy for cache-miss cases found in the CI process.

Related Issue I've noticed some rare occasions where the jobs, while retrieving the maven artifacts cache, get stuck and did not manage to retrieve it. I found what was the problem here https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout. Basically, sometimes the platform doesn't respond and the Cache gitAction fails to retrieve the cache; to this end, a time-out has been inserted in order to prevent a too-long restore phase.

Description of the solution adopted I've inserted a new step, in the test jobs, that verifies if the previous cache restore step concluded with a cache miss (when the above-mentioned time-out is reached there is a cache miss as stated in https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout) and in that case, the step builds the maven artifacts. To insert this fall-back strategy I used the restore feature of the Cache gitAction (actions/cache/restore@v3) in order to prevent the cache saving in the post-run phase that is performed by the Cache gitAction.

Additionally, by thinking that a similar fail could happen when the build job saves the cache, I improved that job in order to insert a failing of the workflow in the (rare) case where it doesn't manage to save the cache. I decided to do so because I thought that It would be more time-efficient to re-run the workflow if this unlucky event happens, and hope that the same failure doesn't happen, instead of wasting time for the rebuild of the artifacts in each test job. I never encountered an event like this in the workflows of eclipse/kapua that I have analyzed but I think it could be possible.

Agnul97 avatar Jun 27 '23 08:06 Agnul97

Codecov Report

Merging #3799 (6e04978) into develop (1a06fb1) will increase coverage by 0.01%. The diff coverage is n/a.

:exclamation: Current head 6e04978 differs from pull request most recent head 192fe1a. Consider uploading reports for the commit 192fe1a to get more accurate results

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3799      +/-   ##
=============================================
+ Coverage      23.15%   23.16%   +0.01%     
  Complexity        26       26              
=============================================
  Files           1866     1866              
  Lines          35288    35288              
  Branches        2782     2782              
=============================================
+ Hits            8170     8175       +5     
+ Misses         26807    26801       -6     
- Partials         311      312       +1     

see 1 file with indirect coverage changes

codecov[bot] avatar Jun 27 '23 09:06 codecov[bot]