Can't cache Node nor Composer in Pipelines (& Deployment)

Hello everyone,

I have been trying to get Pipelines to work with caching, but I have not succeeded yet.

The cache is supposed to be built after a succesful pipelines, but it does not do that.
And everytime I run the pipelines again (with or without a new commit), it says:
Cache "composer": DownloadingCache
"composer": Not found
Cache "node": DownloadingCache
"node": Not found

And I can't seem to figure out what I am doing wrong here.

This is my configuration:

image: awhalen/docker-php-composer-node

pipelines:
   custom:
      Deploy to Acceptance:
         - step:
            deployment: staging
            script:
              - cd ..
              - rsync -vIauz --filter="merge build/filter.txt" build/ $ACC_USER@$ACC_HOST:$ACC_PATH
      Build & Deploy to Acceptance:
         - step:
            caches:
              - composer
              - node
            deployment: staging
            script:
              - cd pattern_lab
              - composer install
              - npm install
              - npm run build
              - cd ../..
              - rsync -vIauz --filter="merge build/filter.txt" build/ $ACC_USER@$ACC_HOST:$ACC_PATH

 Can anyone tell me what I am doing wrong here? I've ran the pipeline more than 10 times and the cache ceases to excist

2 answers

1 accepted

0 votes
Accepted answer

The problem was that the node_modules weren't in the root directory. So the standard cache definition of Pipelines couldn't find it.

Assigning a custom path solved the problem

1 vote

Hi Arjan,

Is there anything in the "Build teardown" section of your log file?

Caches are limited to 1GB in size and if your artifacts exceed that the cache will not be created.

Another possibility if that your build is not configured to output to the default composer location: ~/.composer/cache

Can you please list the contents of this directory at the end of your build to assist in debugging?

Which directory do you want the content from?

This is in the "Build teardown" section:
Cache "composer": Skipping upload for empty cacheCache "node": Skipping upload for empty cacheSearching for test report files in directories named [test-results, failsafe-reports, test-reports, surefire-reports] down to a depth of 4Finished scanning for test reports. Found 0 test report files.

The "composer" cache is a default cache that is configured to cache everything in the ~/.composer/cache directory.

The log message you posted from the teardown section indicates that there are no files in that directory: Cache "composer": Skipping upload for empty cache

You can verify this by listing the contents of the ~/.composer/cache directory at the end of your build. If this is not the location where your dependencies are located then you can either configure your build to output to that location or define a custom cache for a different location. Please see https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html for details.

I found out what the problems were:
Composer: In my dockerimage there was a composer home
Node: The node_modules weren't in the root

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

426 views 6 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you