You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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
thank you for the reply.
Does it mean that i do not have to use "artifacts" to pass docker image?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
and the additional question:
is there a way to reuse var IMAGE without redefining it in the "deploy" step?
I look at the "stage", but, it seems, i can only define static values for variables there. e.g. I can't have an expression of shell call in there.
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.