2

I am trying to create a nodeJS project pipeline and introduce caching layer so that the node_modules are not built always . I am using GITLAB pipelines and have the below stage for installing dependencies :-

Install Dependencies:

stage: install_dependencies
script:
  - yarn install
cache: 
  key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
  paths:
    - node_modules/
    - .yarn
only:
  changes:
    - package-lock.json
    - yarn.lock
  refs:
    - merge_requests
    - master
    - ^(feature|hotfix)\/(.*)+$
tags:
  - docker

The problem is, the pipeline isn't checking for the "changes" part and is always running the stage.

As per Gitlab's documentation :-

With only, individual keys are logically joined by an AND:

(any of refs) AND (any of variables) AND (any of changes) AND (if Kubernetes is active)
RobC
  • 22,977
  • 20
  • 73
  • 80
Shinto K A
  • 21
  • 1

0 Answers0