The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cache not found - single step Pipeline build

sid6mathur
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 15, 2023

Hi folks, 

My pipeline build is unable to persist the $HOME/.cache directory across builds, hence running very slowly. Can someone find any errors in the caching setup below? 

Log message in the "Build setup" phase: 

 

Cache "mytool-cache-dir: $HOME/.cache": Downloading
Cache "mytool-cache-dir: $HOME/.cache": Not found
My Pipeline YAML simply downloads a CLI tool off the web, and runs it for a while. The network downloads fetched by the tool live in $CWD/.cache of the tool run, and should be persisted across repeat runs of the build.
image: atlassian/default-image:4

pipelines:

default:

- step:

name: 'geofeed-finder wtf'

size: 2x

caches:

- mytool-cache-dir

script:

- $HOME/bin/mytool-linux-x64 -v

- echo "Starting mytool"

- $HOME/bin/mytool-linux-x64 -c 1 -g 1 --keep-non-iso --keep-invalid-subdivisions --download-timeout 10 -o $HOME/latest.csv

- echo "Finished mytool"

- wc -l $HOME/latest.csv

artifacts: # defining the artifacts to be passed to each future step.

- $HOME/latest.csv

definitions:

caches:

mytool-cache-dir: $HOME/.cache

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
sid6mathur
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 15, 2023

I realized after posting this that the $PWD is not $HOME, which is my assumption in the above script. So I remove $HOME relative paths and let them be either relative to $(pwd) (present working directory) or better still the $BITBUCKET_CLONE_DIR variable. 

 

So now both the cache works and the artefacts are found correctly after the build is done. Yay!

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events