Gitlab republishing cache with same hash?

Hello,

I’m watching a weird behaviour when using GitLab caches, and I can’t find anyone asking about this.

I have a node project, with a CI which caches the .npm/ file using as key the lock file, based on the GitLab documentation:

type-checks:
  image: CUSTOM_IMAGE
  stage: test
  before_script:
    - npm ci --cache .npm --prefer-offline
  script:
    - npm run test
  cache:
    key:
      files:
        - package-lock.json
    paths:
      - .npm/

When I re-run the pipeline, I see that the cache file is properly downloaded, but after it runs, the cache file is republished although it has the very same hash:


Is there any way to avoid republishing if it sees that the cache hash is the same? Makes no sense to me.

Created an issue as I think that is not possible currently: Do not re-store cache when nothing has changed (#37390) · Issues · GitLab.org / gitlab-runner · GitLab