Forums

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

How to cache packages installed from apt-get in bitbucket pipelines?

Drew Gallagher January 12, 2023 edited

I need help caching packages in my bitbucket pipeline that were installed via apt-get. 

For non-apt-get installed packages you can find the path where packages are installed online. However, I'm not sure what directorie(s) to cache for apt-get installed packages.

For example I have the following command in my pipeline script: 

 - apt-get update && apt-get install -y curl unzip git

I defined a cache directory in definitions like so: 

caches: 
      apt-cache: /var/cache/apt

However, it's only caching 164 bytes and I don't think it's caching all of the packages that are actually installed. 

Is there a way to find where these packages are installed so I can cache them?

1 answer

1 accepted

1 vote
Answer accepted
Drew Gallagher January 12, 2023 edited

Found another answer on the community here https://community.atlassian.com/t5/Bitbucket-questions/Any-way-to-cache-apt-get-install-y-zip-in-bitbucket-pipelines/qaq-p/622876, thanks @Chase Han

Basically you use the following command in your pipeline script or a local docker image that matches the image you have in the pipeline.

which <package-name-here>

e.g

which git

Then it will output a path where it exists. 

e.g. 

/usr/bin/git

Then you just need to include the path in your cache definitions that contains that package. 

e.g.

caches:

      #/usr/bin located packages like git, curl, etc

      usr-bin: /usr/bin

And then you can use that cache definition in your steps

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events