hello,
as per suggestion here, i added the pipe.
Code:
steps:
- step: &Build
name: Build
services:
- docker
caches:
- docker
script:
- echo $BITBUCKET_USERNAME
- pipe: atlassian/bitbucket-clear-cache:3.1.1
variables:
BITBUCKET_USERNAME: $BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_USER_APP_TOKEN
- branch=$( echo "${BITBUCKET_BRANCH////_}" | tr '[:upper:]' '[:lower:]' )
- export IMAGE=$BITBUCKET_REPO_SLUG_$branch
- echo "export IMAGE=$IMAGE" > image.var
- export DOCKER_FILE="dockerfile"
- docker images
- docker builder build -t $IMAGE -f $DOCKER_FILE .
- docker images
artifacts:
- image.var
- step: &Deploy
name: Deploy Docker image
deployment: Test
services:
- docker
clone:
enabled: false
caches:
- docker
script:
- source image.var
- echo "Image - $IMAGE "
- docker images
- docker login -u $SERVICE_ACCOUNT -p $SERVICE_ACCOUNT_TOKEN
- docker push $IMAGE
on the first run, the "docker images" has no images, and after the "docker builder build" I do see :
<span>+ docker images</span>
<span>REPOSITORY TAG IMAGE ID CREATED SIZE</span>
<span>feature_smsms-44 latest bb3a0db7c4e6 About a minute ago 82.7MB</span>
which is expected.
on the second run:
Build setup
...
<span>Cache "docker": Downloaded 71.4 MiB in 4 seconds</span>
<span>Cache "docker": Extracting</span>
<span>Cache "docker": Extracted in 1 seconds</span>
...<span>Cache "docker": Downloading</span>
pipe: atlassian/bitbucket-clear-cache:3.1.1
<span>+ docker container run \<br></span>...<span><br>bitbucketpipelines/bitbucket-clear-cache:3.1.1<br></span><span>INFO: Executing the pipe...<br></span><span>✔ Retrieved 1 caches<br></span><span>✔ Successfully cleared cache docker<br></span><span>✔ Finished clearing caches<br>...<br></span>docker images
<span>+ docker images</span>
<span>REPOSITORY TAG IMAGE ID CREATED SIZE</span>
<span>feature_smsms-44 latest bb3a0db7c4e6 About a minute ago 82.7MB</span>
<span>node 10-alpine aa67ba258e18 19 months ago 82.7MB</span>
<span>bitbucketpipelines/bitbucket-clear-cache 3.1.1 7634a1db29b8 23 months ago 128MB</span>
<span>Skipping assembly of docker cache as one is already present</span>
<span>Searching for files matching artifact pattern .bitbucket/pipelines/generated/pipeline/pipes/**</span>
<span>Searching for files matching artifact pattern image.var</span>
<span>Artifact pattern image.var matched 1 files with a total size of 30 B</span>
<span>Compressed files matching artifact pattern image.var to 130 B in 0 seconds</span>
<span>Uploading artifact of 130 B</span>
<span>Successfully uploaded artifact in 0 seconds</span>
Is this pipe supposed to run in a separate step only? It kind of makes sense, but the documentation does not mention that.
And the follow-up:
documentation does not describe the variable "debug", though the code displays it. Setting the debug has no visible effect on the pipe output.