Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Two Containers Unexpectedly Pushed

m4g005 November 20, 2020

This has happened in two different projects -- one python and one nodejs

After building a container, we push to a container repo.

But sometimes, branch builds push both the branch container and another container that had been built earlier.

Here's an example of the double push:

> docker push [container_registry/repo]
1m 04s

+ docker push [container_registry/repo]
The push refers to repository [container_registry/repo]
c992ea337d7d: Preparing
...
c992ea337d7d: Pushed
[my_feature_branch]: digest: sha256:c82a1b8da6cdf4eb3d0cdee8bb547e96b35183bd169c093270adb96c249b9ff0 size: 3270
c526b4dd16ef: Preparing
...
c526b4dd16ef: Pushed
[a_different_feature_branch]: digest: sha256:f18c66379f167316609401d65ad411f7aa871c07ade7ce808682f0e542d3f886 size: 3270

The second push is then set as the most recent even though more recent versions of that feature branch have been built and pushed.

 

My hunch is that this has something to do with Docker caching (which is turned on in my pipeline), but I am not sure why it would be sending both containers. I do think that that the extra container might be the first from when the cache is refreshed.

[edit] I just removed the Docker Cache and re-ran two different branches. And the first one built (and presumably cached) is the one getting sent the second time.

Here is an abbreviated version of my pipeline.yml:

image: python:3.7
definitions:
steps:
- step: &build_step
caches:
- docker
script:
- if [ -n “$BITBUCKET_TAG” ]; then export TAG_NAME=$BITBUCKET_TAG; else export TAG_NAME=$BITBUCKET_BRANCH; fi

- export IMAGE_NAME=[container_registry/repo]:$TAG_NAME
....[build]
- docker build -t $IMAGE_NAME .
- docker login -u $QUAY_BUILD_USER -p $QUAY_BUILD_PASSWORD quay.io
- docker push [container_registry/repo]
services:
- docker


pipelines:
default:
- step:
...
branches:
‘**‘:
- step: *build_step
tags:
‘*’:
- step: *build_step

 

 

 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events