This is a step in my pipeline:
- step:
name: 'Upload APK to Downloads folder'
script:
- pipe: atlassian/bitbucket-upload-file:0.7.2
variables:
BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
FILENAME: "app/build/outputs/apk/release/*.apk"
The build step for this step takes much longer than I would expect, mainly because it has to pull atlassian/bitbucket-upload-file:0.7.2 each time. I am wondering whether this can be cached or if there are any other ways to speed up this process.
This is the image that I am using:
image: mingc/android-build-box:1.28.0
Hi @sandesh and welcome to the community!
A pipe starts a new Docker container and yes, it is possible to cache the pipe's Docker image. You just need to adjust the definition of your step as follows:
- step:
name: 'Upload APK to Downloads folder'
script:
- pipe: atlassian/bitbucket-upload-file:0.7.2
variables:
BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
FILENAME: "app/build/outputs/apk/release/*.apk"
services:
- docker
caches:
- docker
Please note that this will work only if you're not using the pre-defined Docker cache elsewhere in your yml. If you are building a Docker image in a different step of your yml and you want to use cache for that as well, you will need to adjust the cache definition for that different step.
An example of that is the following (feel free to ignore this example if you are not building a Docker image in a different step that you want to cache):
- step:
name: Build Docker image
script:
- docker load -i docker-cache/* || echo "No cache"
- docker build .
- mkdir -p docker-cache && docker save $(docker images -aq) -o docker-cache/cache.tar
- docker image ls -aq
caches:
- my-docker-cache
services:
- docker
And you would need a definitions section in your yml file as follows (this is using a smart cache, that gets updated when you change the Dockerfile):
definitions:
caches:
my-docker-cache:
key:
files:
- Dockerfile
path: docker-cache
Please feel free to reach out if you have any questions!
Kind regards,
Theodora
Thank you for help @Theodora Boudale ! This helped speed up the pipeline
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are very welcome, @sandesh! Please feel free to reach out if you ever need anything else!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.