kapua
kapua copied to clipboard
FIX - Ci improvement - Added Kapua docker image caching into Action process
Brief description of the PR. This PR wants to re-introduce docker image caching in the GitHub action process. NOTE: this PR is actually in draft mode for the technical limitations of this platform, for extra info see the related issue.
Related Issue This PR fixes/closes https://github.com/eclipse/kapua/issues/3688
Description of the solution adopted As suggested in the related issue with the first post, I changed the old gitAction used to cache docker images with the forked/updated one, https://github.com/marketplace/actions/docker-layer-caching2.
I defined a brand new action that acts as a wrapper for such action and retries the caching retrieval a fixed number of times if some failure occurs. This is done because, on rare occasions, I get a 429 error on the cache retrieval step of such Action BEFORE INTRODUCING SUCH RETRY MECHANISM. I was thinking that, by retrying the Action N times, with a delay between each try, the error could be overcome and the cache retrieved correctly. This error could be related to the technical limitation discussed in the related issue but I don't think so, based on my experiments. In this regard, I think that another cause could be the fact that multiple jobs try to concurrently retrieve the cache, and this is the rationale behind the delay I inserted in the retry mechanism.
Unluckily GitHub Actions doesn't provide loops so I had to insert a fixed number of re-tries in this "hard-coded" form. Also, instead of this, I tried to use a third-party GitAction that retries Actions and allows to define a delay between tries (this one https://github.com/marketplace/actions/retry-action) BUT, at the moment of this work, it was having problems with docker-related Actions like mine, so I had to give up. I've seen a PR opened on such Acion that solves this problem so maybe in the future It can be restored here.
Any side note on the changes made As explained, possible 429 errors on cache retrieval steps