Git Product home page Git Product logo

Comments (41)

elgohr avatar elgohr commented on June 14, 2024 1

@mrfelton Find why it's not like this in #13
What do you think about having the tag of the snapshot as an output?

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024 1

Ok, then let's do it like that.

@turbo: sounds like an edgecase to me.
At my point of view it would be an actions-feature for running parts of an action sequentially.

from publish-docker-github-action.

Sispheor avatar Sispheor commented on June 14, 2024 1

yes. But, from my point of view, pipelines need to be well configured to prevent overriding other images.
The expected behavior of this action is to map git tag to docker tag when exists.
In most of cases, the tag is a version number like 2.0 which doesn't conflit with branch names.

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024 1
Types Tags
Tag/Release latest or {release/branch-name}
Branch {GITHUB_SHA}
Pull Request {GITHUB_SHA}

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

Hey, thank you very much.
I'm totally with you. The only concern I have is, that there might be collisions between tags, releases and branches.
When I'm thinking about releases/tags, I would like to freeze things to that moment.
A branch with the same name would override it.
In this way the tag for the only freezed state in this resource (snapshots) is autogenerated and very unlikely for a collision.
If you have a good idea for mitigating the collisions, I would be glad to hear it ☺️

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

Looks somehow like #18
Do we want to keep the discussion in there?

from publish-docker-github-action.

mrfelton avatar mrfelton commented on June 14, 2024

I'd prefer to see the image snapshots tagged using GITHUB_SHA. That way, we could reference the snapshot tag from other build jobs. As it is now, if you use the snapshot feature, there is no way to know what tag the image was assigned as so impossible to reuse the snapshot in other build jobs.

from publish-docker-github-action.

mrfelton avatar mrfelton commented on June 14, 2024

I think providing the snapshot name as an output would be pretty useful @elgohr

from publish-docker-github-action.

real34 avatar real34 commented on June 14, 2024

Thanks for this feedback. A solution could indeed be to have tag names such as tag-1.0.0-GIT_SHA (or date).

It would reduce the risk of collisions and allow to reduce the number of tags by not using the snapshot feature. Also users could easily find the image tag associated to a specific release.

from publish-docker-github-action.

mrfelton avatar mrfelton commented on June 14, 2024

A solution could indeed be to have tag names such as tag-1.0.0-GIT_SHA (or date).

That sounds like a possibility for tag builds, but what about branch based builds?

from publish-docker-github-action.

mrfelton avatar mrfelton commented on June 14, 2024

Perhaps you could use something like this:

git describe --abbrev=40 --dirty

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

So what do you think about doing it like this:

Types Tags
Tag latest, {GITHUB_SHA}
Release latest, {GITHUB_SHA}
Branch {GITHUB_SHA}
Pull Request {GITHUB_SHA}

(this table doesn't contain snapshot builds, which would stay like they are)

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

Snapshot as outputs is here https://github.com/elgohr/Publish-Docker-Github-Action#outputs

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

No discussion within the last 12 days. I guess it's not that urgent. Can we close this?

from publish-docker-github-action.

turbo avatar turbo commented on June 14, 2024

I too am looking for this functionality, what's the current state of this?

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

#24 (comment) would be the proposal. Waiting for feedback

from publish-docker-github-action.

real34 avatar real34 commented on June 14, 2024

#24 (comment) would be the proposal. Waiting for feedback

Hi! It would be a good compromise indeed.
Then running docker tag my-image:GITHUB_SHA my-image:1.1.0 could be done manually with human control to prevent collisions.

Thanks for this solution, and sorry for not responding before.

from publish-docker-github-action.

turbo avatar turbo commented on June 14, 2024

I don't know if I agree on explicitely tagging latest, though I may have misread something. What if two actions on two (say) releases are triggered and the first one finishes later? The release tags on the image will be correct, but now an older image is being tagged as latest?

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

@real34 just rethought a bit.
Couldn't you do the same, when you have snapshots enabled?
In the case of a Release/Tag this would be a push to master + a snapshoted tag.

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

@turbo please have a look at https://github.community/t5/GitHub-Actions/Prevent-parallel-workflows/m-p/32914/highlight/true#M1305

from publish-docker-github-action.

turbo avatar turbo commented on June 14, 2024

@elgohr The root problem behind the scenario I've described is that your action would create the latest tag, not that Actions run concurrently. It's the reason other CI's docker actions (e.g. Azure DevOps) have a config option for "also tag latest". A release is a tag already, so I see no reason to automatically include the latest tag. If you do introduce this feature, it'd be nice if you made the latest tag an option. But don't let me hold you up from actually implementing this! After all, I can make my changes in a fork. :)

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

At the moment it doesn't look like this action needs any change, as you could get everything by configuration already.

from publish-docker-github-action.

nicolas-marcq avatar nicolas-marcq commented on June 14, 2024

Would it be possible to add a flag that allow us to choose the tag.
In our pipeline, we would like to always tag the dev branch 0.0.

from publish-docker-github-action.

Sispheor avatar Sispheor commented on June 14, 2024

@elgohr so what kind of config should we use to have a tag that map the release number?

from publish-docker-github-action.

Sispheor avatar Sispheor commented on June 14, 2024

This doesn't work:

with:
  name: image-name:${{ GITHUB_REF }}

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

@Sispheor sorry, this isn't possible as the action would need to handle collisions, which is way to complex.

from publish-docker-github-action.

Sispheor avatar Sispheor commented on June 14, 2024

Where is the colision if we are sure to create a new tag?
Why we cannot use this?

elif isGitTag; then
    TAG=$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g")

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

Sorry, I don't get what you're trying to do.
Could you please explain a little more?

from publish-docker-github-action.

Sispheor avatar Sispheor commented on June 14, 2024

I think I want to do what is described in this issue.
When I git tag a version, this tag name is also used as docker tag when I build my image.

In the current code, if a git tag is detected like refs/tags/5.0, we don't tag with 5.0 but latest.
So I replaced the line 67 by the code I shown you and I have the expected behavior.

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

The point is, that branches with the same name as a release will override the release image and there would be no way to restore it. From a git standpoint I wouldn't see this as the most expected behavior, but on the other hand it prevents to believe in a promise (fix unchangeable image), which isn't fulfilled.

If you want to fix a point in time safely, feel free to use snapshots.

from publish-docker-github-action.

turbo avatar turbo commented on June 14, 2024

The point is, that branches with the same name as a release will override the release image

Not if the build is triggered on releaes, which is what would actually happen in production. Pushes to branches which happen to have the same name (e.g. from release management) fire separate events.

from publish-docker-github-action.

Sispheor avatar Sispheor commented on June 14, 2024

a tag is seen with a ref that contains the word tags, isn't it? Like refs/tags/5.0.
Which is different from the ref we receive if it's a branch, right? The ref for a branch is like /refs/head/branch_name.

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

And all go into a registry, which doesn't care which job wrote what.

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

@turbo how would you ensure that a job, triggering on push, wouldn't override an image, which was pushed by a job that triggered on release?

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

Sorry, that's your expectation.

At the moment we don't have the problem that people need to care for. And I don't think it's worth introducing, unless there is a usecase that couldn't be covered by using the current implementation.

from publish-docker-github-action.

turbo avatar turbo commented on June 14, 2024

I wouldn't run any publish actions on push. Maybe run some tests, collect coverage etc. But for me at least, I want pretty much only tags to be "released". latest doesn't mean latest release, otherwise docker registry would attach it automatically to new pushes. It's meaning differs from project to project, sometimes it's a release, sometimes a beta and sometimes not used at all.

I think the best way to do this would be to:

  • enable git tags as docker tags (explicit opt-in)
  • state in the docs that for this use-case, the user has to make sure not to create conflicting triggers
  • make "also tag latest" on option for the action, regardless of tags, triggers or anything else (just like other CIs offer)

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

Sounds good to me. I would prefer to either use latest on default and use release_name when turned on.

from publish-docker-github-action.

turbo avatar turbo commented on June 14, 2024

Sounds good to me. I would prefer to either use latest on default and use release_name when turned on.

Sound good, though I might be misinterpreting it. Could you please draw up a small table with examples?

from publish-docker-github-action.

turbo avatar turbo commented on June 14, 2024

That looks perfect. Whether there should be a way to (optionally) enable both for the "Tag/Release" case, I don't have a strong opinion on, but it might be important to other people's workflow.

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

Please see https://github.com/elgohr/Publish-Docker-Github-Action#tag_names
https://github.com/elgohr/Publish-Docker-Github-Action/releases/tag/2.7

from publish-docker-github-action.

elgohr avatar elgohr commented on June 14, 2024

Can we close this?

from publish-docker-github-action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.