Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to configure cache on self hosted runner

Michał
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!
January 25, 2023

Doc says
https://support.atlassian.com/bitbucket-cloud/docs/set-up-runners-for-macos/

  • Be aware that we don’t restrict where your cache folder is located, so you can store the cache in any directory of the device. Be mindful about any technical implications of where your cache is defined and make sure your host machine is recoverable.

1. Where is the cache directory located by default

2. How to specify the cache directory location

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 6, 2023

Hi @Michał,

Pipelines provide pre-defined cache locations for commonly used language tools which also apply to MacOS Runners. You can view the default locations for these tools here:

If you are using a different tool or if you want to use a different location, you can check the section "Custom caches for other build tools and directories" in that link for more details.

Please feel free to let me know if you have any other questions.

Kind regards,
Theodora

Efren Jamolod
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 28, 2023

Hi @Theodora Boudale ,
Just to clarify. For the pre-define caches like "gradle", cache dir "~/.gradle/caches" is in the container that runs the step's scripts, correct? And since self-hosted runners are using "docker-in-docker", I assume the cache dir (ie. "~/.gradle/caches") is not really mounted by default to the host (ie. MacOS in this case)?

If my assumption is correct, few follow-up questions:

  • Is there away to mount the cache directories to the host of the self-hosted runner?
  • I noticed that every step in the pipeline, the caches are being dowloaded. Is there away to avoid this? For self-hosted runners in our own infra, these cache downloads are causing the build timing longer.
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 11, 2023

Hi @Efren Jamolod!

Docker containers are used for pipelines builds that run in our own infrastructure and for builds that run in Linux Docker runners. Builds that run in the other type of runners (Linux Shell, MacOS, and Windows Runners) do not use Docker, and the builds run directly in the host machine. MacOS runners use Bash to run pipeline steps on your MacOS machine (host device).

For the last three types of runners I mentioned (Linux Shell, MacOS, and Windows Runners) the cache is saved on the host machine and not in any container, as these runners don't use containers.

The cache will get downloaded for a step that has a caches definition in the bitbucket-pipelines.yml file. If a certain step does not need to use cache and you want to prevent the cache from getting downloaded, you will need to remove the caches definition from this specific step in your bitbucket-pipelines.yml file.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events