GitLab CICD cache is not working with local includes - Stack Overflow

admin2025-04-26  0

I am trying to setup a monorepo with GitLab CI/CD. I want to define the jobs for each sub project under that project and not on the root gitlab-ci.yml file. So right now I have:

cache:
  key: $CI_COMMIT_REF_SLUG
  paths:
    - infrastructure/node_modules/
    - infrastructure/dist/
    - frontend/node_modules/
    - frontend/dist/

include:
  - local: '/infrastructure/infrastructure.gitlab-ci.yml'
    rules:
      - changes:
        - 'infrastructure/*'
  - local: '/frontend/frontend.gitlab-ci.yml'
    rules:
      - changes:
        - 'frontend/*'

Originally the cache was also moved to each folder, but I was also trying with moving just the cache to the root gitlab-ci.yml.

The problem that I'm facing right now is that if only 1 sub-pipeline runs, everything works properly, but if both running together, because I have changes in both folders, only the frontend pipelines are running properly, however the infrastructure caching is not working.

When only infra pipeline is running, it works fine, so I have the node_modules shared between the jobs.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745643126a311717.html

最新回复(0)