Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Docker Image Artifact unavailable on Following Steps Edited

Hi,

I am trying to build a docker image in one step, and then deploy it to a container registry in another step. I am following the example laid out in Bitbucket pipeline Validator. My steps look like this:

- step: &build-docker-image
name: Build Docker Image
caches:
- maven
- docker
- node

script:
- ./mvnw verify -Pprod -DskipTests
- WARFILE=( "target"/*.war )
- echo $WARFILE
- cp $WARFILE src/main/docker/app.war
- docker build -t foobar -f src/main/docker/Dockerfile src/main/docker
- docker save foobar --output foobar-dockerimg.tar
services:
- docker
artifacts:
- foobar-dockerimg.tar
...

This step runs successfully, and the output indicates that it has successfully stored the artifact (the artifact is also available for download in the Artifacts tab for the Step):

Searching for files matching artifact pattern foobar-dockerimg.tarArtifact pattern foobar-dockerimg.tar matched 1 files with a total size of 205 MiBCompressed files matching artifact pattern foobar-dockerimg.tar to 167 MiB in 9 secondsUploading artifact of 167 MiBSuccessfully uploaded artifact in 9 seconds

This is the second task that needs to use the artifact to publish:


- step: &publish-docker-img-prodcr
name: Publish Artifacts -> Prod CR
caches:
- maven
- docker
- node
script:
- echo "*** Publishing Application Version:${CVC_APP_VERSION} to ${AZ_CR_SERVER_PROD}"
- ls -lah
- pwd
- docker login $AZ_CR_SERVER_PROD -u "$AZ_CR_USER_PROD" -p "$AZ_CR_PASSWORD_PROD"
- docker load --input ./foobar-dockerimg.tar
- ... publishing stuff...
services:
- docker
artifacts:
- foobar-dockerimg.tar

When the step executes, the "Build setup" output indicates that it has successfully downloaded my artifact:


Artifact "foobar-dockerimg.tar": DownloadingArtifact "foobar-dockerimg.tar": Downloaded 167 MiB in 5 secondsArtifact "foobar-dockerimg.tar": ExtractingArtifact "foobar-dockerimg.tar": Extracted in 1 seconds

Unfortunately, the `docker load --input ./foobar-dockerimg.tar` command in the second step always fails with the message:


+ docker load --input ./foobar-dockerimg.tar

open ./foobar-dockerimg.tar: no such file or directory

 

The `ls -lah` command in the step confirms that the foobar-dockerimg.tar artifact is not available in the build directory (i.e. this doesn't appear to be an issue with the `docker load` command. 

Is there something I am missing with respect to how artifacts work? Am i doing anything obviously wrong here?

1 answer

On a related note, I tried replacing the docker image .tar file with a vanilla text file (so, in Step #1 the artifact is created via `touch foobar.txt` and I add some data via `echo "some data" >> foobar.txt`. This foobar.txt file artifact is successfully delivered to my build workspace on Step #2.

The fact that the foobar.txt file is being delivered properly on Step #2 suggests that my general approach to publishing and consuming artifacts between steps is valid. I suspect one of two things is going on:

  1. The docker image .tar file is too large, or some other system constraint is preventing a successful download. In any case, the Bitbucket logging doesn't indicate any constraint violation.
  2. There is a bug in pipelines, where the artifact isn't downloaded successfully to the workspace, or, the build steps are kicked off before the artifact is downloaded successfully.

Of course, I could also be missing something obvious. But my approach here is based on the Docker example provided by Bitbucket, so I'm not sure what I could be doing wrong.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

525 views 6 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you