hello,
is there a way to pass docker's image between the steps of a pipeline?
something to this extent:
steps:
- step: &Build
name: Build an image
services:
- docker
script:
- export IMAGE=$BITBUCKET_REPO_SLUG_BLAH
- export DOCKER_FILE="dockerfile"
- docker builder build -t $IMAGE -f $DOCKER_FILE .
artifacts:
- $IMAGE
- step: &Deploy
name: Deploy Docker image
deployment: Test
services:
- docker
clone:
enabled: false
script:
- docker login -u $SERVICE_ACCOUNT -p $SERVICE_ACCOUNT_TOKEN
- docker push $IMAGE
pipelines:
custom:
Build:
- step: *Build_And_Scan
- step: *Deploy
Hi @AZZ,
Thank you for reaching out to the community.
To save the built Docker image and access it in the next step, you can use Caching.
caches: - docker
Using Docker cache, we create the cache from the layers generated by your build.
This way, you can access the Docker image in any step within 1 week.
However, please kindly note that we don't automatically refresh Caches. We do have an existing feature request for it that can be located through this link. - https://jira.atlassian.com/browse/BCLOUD-16314
You can upvote and watch it for now so that you'll be notified of any updates from our team when the feature becomes available on Bitbucket Cloud.
As a workaround, if you'd like to refresh the Docker cache, you will need to clear it first using the Pipes script (atlassian/bitbucket-clear-cache).
Here's a blog post on how to use the Pipes script. - Automatically refresh caches when build dependencies are updated
Hope it helps and do let me know if you have further questions.
Regards,
Mark C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @AZZ
You don't need to use artifacts as Caches is available for any steps for 1 week.
You can also use a repository variable for your Docker image name and that will be available on your steps.
Regards,
Mark C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.