Skip to content

Adds keyword to opt-out of cache isolation

Laura Montemayor requested to merge opt-out-cache-segragation into master

What does this MR do and why?

Adds cache:unprotect to allow users to opt-out of the cache isolation via the protected ref status.

Related to #362114 (closed)

How to set up and validate locally

In the default section:

cache: &global_cache
  key: $CI_COMMIT_REF_SLUG
  paths:
    - vendor/
  policy: pull-push
  unprotect: true

jobx:
  script: ls
  cache:
    # inherit all global cache settings
    <<: *global_cache
    # override the policy
    policy: pull

Screenshot_2022-12-14_at_15.37.26

Using unprotect per job cache:

unprotected_job:
  script:
    - echo
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - binaries/
    unprotect: true

Screenshot_2022-12-14_at_15.41.39

Default:

protected_job:
  script:
    - echo
  cache:
    key: "$CI_COMMIT_BRANCH"
    paths:
      - binaries/

Screenshot_2022-12-14_at_15.41.00

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: https://gitlab.com/gitlab-org/security/gitlab/-/merge_requests/1551

Edited by Marcel Amirault

Merge request reports

Loading