Use docker buildx to publish images #3127
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses an issue with the current build process not pushing the latest built image caused by #3015. For example
grafana/k6:master
image built a few days ago is the same asgrafana/k6:0.44.1
that has been pushed a month ago.The reason for this is that
docker buildx
uses a different context to build images, which means that all subsequent docker run and docker push commands work with an image that is different from what has been built at the “Build” step.The reason why this went unnoticed is the “Check” step, that “fixes” default context state by pulling the latest grafana/k6 image from DockerHub and this is the image used by all subsequent stages.
Once this applied,
build-docker
job will start usingdocker buildx --push
to publish the image frommultibuilder
context instead ofdefault
. Since we don't change any files in-between, this command always uses the cached image created during the "Build" step. To run smoke test at the "Check" stage, we're going to load it into thedefault
context by executingdocker buildx --load
before running the image.