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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

22,318 views 26 12
Join discussion

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