Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Use Git Tags as additional Docker Image Tags #12

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

kellervater
Copy link

I added the functionality to implicitly use Git Tags as additional Docker Tags. Means: If you commit a new Git Tag, an appropriate additional Docker Tag with the same name is going to be created as well.
I fixed a few typos and introduced a Github Workflow to get this action tested.

I already did an integration test by using this functionality here:
https://github.com/saubermacherag/docker-ansible-alpine

The big advantage I see is that you can comfortably draft a realease on Github which implicitly creates a GIT tag which will also become the docker tag.

Due to issue https://github.community/t5/GitHub-Actions/docker-pull-from-public-GitHub-Package-Registry-fail-with-quot/m-p/32782
which basically says, that Github Actions cannot rely on Docker Images on Github's Package Registry without authentication

I also added the DOCKERHUB_REPOSITORY option which allow to push the image to dockerhub instead of GPR.

creekorful and others added 7 commits October 15, 2019 20:36
Docker tags.

introduce CI

simplified identification, introduced ci and fixed metadata

non interactive docker login

assuming the right context

simplification is difficult

simplification is difficult 2

do it the complicated way

test image_tag function

publish 2nd version

echoing tags pointing to current commit

build tag string

fixed a few typos

fixed another typo

create additional tags based on GIT Tags pointing to the current commit

added feature which adds GIT tags pointing to the current commit as docker tags
@kellervater kellervater marked this pull request as ready for review November 25, 2019 09:51
@kellervater
Copy link
Author

btw. this was originally a fork of a fork and I somehow wasn't able to sync this PR with your repo. And I'm not able to resolve the conflicts here on Github.

@kellervater
Copy link
Author

resolved conflicts. Tests for dockerhub integratoin pending...

@kellervater
Copy link
Author

Dockerhub Pushes work now.

supply github token for test

dockerhub specific settings

try to make tests "fork agnostic"

try to make tests "fork agnostic". still don't know if this works

action names cannot be fork agnostic

fixed typo
TAG: 'my-optional-tag-name'
DOCKERFILE_PATH: '.github/docker/Dockerfile'
BUILD_CONTEXT: '.'
DOCKERHUB_REPOSITORY: 'pinkrobin/gpr-docker-publish-example'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this repo has authorization to push to this repo

Suggested change
DOCKERHUB_REPOSITORY: 'pinkrobin/gpr-docker-publish-example'
DOCKERHUB_REPOSITORY: 'hamelsmu/gpr-docker-publish-example'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's true. This is just intended for testing purposes.

@@ -80,12 +95,15 @@ jobs:

1. `cache`: if value is `true`, attempts to use the last pushed image as a cache. Default value is `false`.
2. `tag`: a custom tag you wish to assign to the image.
3. `DOCKERHUB_REPOSITORY`: if value is set, you don't need to set `IMAGE_NAME`. It will push the image to the given dockerhub repository instead of using GPR.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this is the best variable name. A Registry is different than an Image Name. Its also confusing to have both of these inputs which makes me wonder if we should rethink the api.

@hamelsmu
Copy link
Contributor

hamelsmu commented Dec 5, 2019

I'm not sure about expanding the scope of this action to include pushing to other registries? There are other Actions for that. The purpose of this Action was to make it easy to push to GPR since there are some nuances for that you don't need to worry about this Action.

What do you think?

@kellervater
Copy link
Author

Thanks for your review :-D

My point of including Dockerhub is this issue here:
https://github.community/t5/GitHub-Actions/docker-pull-from-public-GitHub-Package-Registry-fail-with-quot/td-p/32782

The tl;dr version is: At the moment it is not possible to pull from public github package registries without providing credentials, which makes this whole Package Registry thing almost unusable.
Therefore I added the Dockerhub Repo option.

But I do understand your point and if this option is a nogo and we just shall wait for the fix from github side, please just close this PR ;-)

@eyal0
Copy link

eyal0 commented Dec 19, 2019

I'd like to see this PR go in, too!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants