Skip to content

ci: Simplify the caching strategy and always check the hash-sum

What does this MR do and why?

This simplifies the assets-compilation task by using a single task for both the "legacy" strategy and the new one (introduced in !96297 (merged)).

The problem we had in #375703 (closed), is that when the new cache package doesn't exist but the "legacy" master cache is present, we use the latter without checking its version.

This MR fixes it so that in both strategies, we always check the cache version to decide if we can reuse the cache or not.

Test matrix

{
    "fields" : [
        {"key": "a", "label": "Legacy cache"},
        {"key": "b", "label": "New strategy"},
        {"key": "c", "label": "Assets package"},
        {"key": "d", "label": "`compile-test-assets` job"},
        {"key": "e", "label": "Duration", "sortable": true}
    ],
    "items" : [
      {"a": "Empty", "b": "Disabled", "c": "N/A", "d": "https://gitlab.com/gitlab-org/gitlab/-/jobs/3107217321", "e": "7m 18s"},
      {"a": "Empty", "b": "Enabled", "c": "Absent", "d": "https://gitlab.com/gitlab-org/gitlab/-/jobs/3107233164", "e": "7m 1s"},
      {"a": "Empty", "b": "Enabled", "c": "Present (caching job: https://gitlab.com/gitlab-org/gitlab/-/jobs/3107258430)", "d": "https://gitlab.com/gitlab-org/gitlab/-/jobs/3107293878", "e": "2m 30s"},
      {"a": "Fresh (caching job: https://gitlab.com/gitlab-org/gitlab/-/jobs/3107253929)", "b": "Disabled", "c": "N/A", "d": "https://gitlab.com/gitlab-org/gitlab/-/jobs/3107283073", "e": "2m 42s"},
      {"a": "Fresh", "b": "Enabled", "c": "Absent", "d": "https://gitlab.com/gitlab-org/gitlab/-/jobs/3107269038", "e": "2m 44s"},
      {"a": "Fresh", "b": "Enabled", "c": "Present (caching job: https://gitlab.com/gitlab-org/gitlab/-/jobs/3107258430)", "d": "https://gitlab.com/gitlab-org/gitlab/-/jobs/3107303589", "e": "2m 38s"}
    ]
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #375703 (closed)

Edited by Rémy Coutable

Merge request reports

Loading