Use docker Github actions to tag containers #48
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.
Fixes prometheus/prometheus#16238
Rewrite of #41
This PR changes promci to use
docker/metadata-actionto generate tags for the generated docker containers. We also get nice labels pulled from the Github project metadata for free. The PR also replaces calls tomake docker,make docker-publishandmake docker-manifestwithdocker/build-push-actionwhich will build the specified Dockerfile for all specified platforms and push them with the specified tags.Please note that I'm certainly not a Github actions expert and this is just my first attempt at implementing what I understand to be best practices for building and pushing docker images using GH actions. Please review carefully!
Of particular note: using
docker/build-push-actionmay not be strictly necessary. It is likely possible to modify the Makefile in the prometheus project to accept the set of tags produced bydocker/metadata-action. It seemed that using build-push-action was a better solution though as it requires less synchronization between the two repos and that restructuring the Makefile to consume a set of tags instead of just one was going to be more trouble than it's worth, as the Makefile target is only one or twodockercommands. Keeping the changes only in thepromcirepo seemed easier and simpler.If this change is accepted, the
prometheusrepo will need a follow-up PR to update the SHA of thepromciaction and will also need to specify thegithub_tokeninput when callingpublish_mainin addition topublish_release.I had quite a bit of difficulty testing this change locally. I was able to locally verify the tags and labels generated by
metadata-actionwhen called with apushaction torefs/tags/v3.5.0usingact:I was not able to successfully test actually building and pushing the docker image though, as I wasn't able to get the full CI build and test system running without error locally. I would love some advice on how to properly test these changes using the full CI pipeline, if possible.