Search code examples
bitbucketpipelinebitbucket-pipelines

Bitbucket pipeline custom cache definition not working


I have a project with two sub folders. Here's the structure:

src
|- api
|- ui
    |-node_modules
bitbucket-pipelines.yml

Since my node modules folder is not in the same directory as the pipeline file, I tried creating a definition and included the path. Here's where I'm trying to cache it in my pipeline:

pipelines:
  default:
      - step:
          name: "Frontend"
          image: node:14.17.1
          caches:
            - frontendnode
          script:
            - cd src/ui
            - npm install 
            - CI=false npm run build
definitions:
  caches:
    frontendnode: src/ui/node_modules

My guess is that my definition is wrong but I have tried multiple things and I'm getting the same error:

Assembling contents of new cache 'frontendnode'
Cache "frontendnode": Skipping upload for empty cache

Thanks!


Solution

  • Try to print all files of machine, call:

    apt-get install -y tree
    tree
    

    NOTE: cache will fill after successful completion of pipeline

    Or your src/ui/node_modules folder is empty