I have a question about my bitbucket pipeline. I have set up all the variables but I am not able to copy the built docker image to another location in the next pipeline step.
preview:
- step:
name: Build Docker image for preview branch and save as .tar
caches:
- docker
size: 2x #2x memory flag
services:
- docker
script:
- echo "Building Docker image for preview branch..."
- docker build -f ./src/API/Dockerfile -t $BITBUCKET_REPO_SLUG .
- docker save -o $BITBUCKET_REPO_SLUG.tar $BITBUCKET_REPO_SLUG
- step:
name: Upload Docker image as artifact
script:
- pipe: atlassian/bitbucket-upload-file:0.7.1
variables:
BITBUCKET_USERNAME: $BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
FILENAME: "$BITBUCKET_REPO_SLUG.tar"
DIRECTORY: "downloads"
It yields the following error:
Status: Downloaded newer image for bitbucketpipelines/bitbucket-upload-file:0.7.1
INFO: Executing the pipe...
✖ File Application.tar doesn't exist.
(docker build is successful)
How can I copy the resulted docker built .tar file to a new location?
Artifacts that should be copied from former step onto subsequent steps must be declared with the
artifactskey.With your example:
You won't be able to interpolate variables in there so you should settle for a hard name or putting all images in a subfolder (then, declare
artifacts: ["build/*.tar"]and whatnot)