-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2 #50
Conversation
Codecov Report
@@ Coverage Diff @@
## master #50 +/- ##
==========================================
- Coverage 75.42% 74.04% -1.39%
==========================================
Files 3 5 +2
Lines 118 339 +221
Branches 24 98 +74
==========================================
+ Hits 89 251 +162
+ Misses 7 5 -2
- Partials 22 83 +61
Continue to review full report at Codecov.
|
bcd884f
to
ff51a34
Compare
Still too tightly tied to explicit events. Decouple the events from the payload and things become even simpler, and far more versatile. This is too narrow of a use case. What if I'm tagging the image based on the version of the software inside of it, and not the version of the image itself? What If i'm building an image based on events in another repo? This is way more complex than it needs to be. Look at my current implementation.
It does all that, just by simply allowing the user to input the ref instead of trying to determine what ref to use based on the event type. It's great how much this is thought through, but in the end, I think it's too over-engineered to be useful outside of a specific use-case, and that's what my proposal was about. |
That's the purpose of this action, handle metadata through events triggered by the workflow.
I think it's relative to your use case. Very few users that I know of use events with custom payloads but anyway it's still possible with v2: -
id: buildxy
run: echo '::set-output name=buildxy::${{ (github.event.action == 'deploy'|| github.event.action == 'released') && github.event.client_payload.tag_name == steps.stable-octoprint.outputs.release }}'
-
name: Tagging Strategy
id: tagging
uses: HackerHappyHour/tagging-strategy@v3
with:
image_name: octoprint/octoprint
tags: |
%X%::${{ steps.buildxy.outputs.buildxy }}
%X.Y%::${{ steps.buildxy.outputs.buildxy }}
%X.Y.Z%
extra_tags: |
latest::${{ steps.stable-octoprint.outputs.release == github.event.client_payload.tag_name }}
edge::${{ github.event.action == 'prereleased' || github.event.client_payload.tag_name == steps.latest-octoprint.outputs.release }}
canary::${{ github.event.action == 'canary' }}
bleeding::${{ github.event.action == 'bleeding' }} could be used like this with v2: -
id: buildxy
run: echo '::set-output name=buildxy::${{ (github.event.action == 'deploy'|| github.event.action == 'released') && github.event.client_payload.tag_name == steps.stable-octoprint.outputs.release }}'
-
name: Meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: octoprint/octoprint
tag_name: ${{ github.event.client_payload.tag_name }}
tags: |
${{ github.event.client_payload.tag_name }}
type=semver,pattern={{major}},enable=${{ steps.buildxy.outputs.buildxy }}
type=semver,pattern={{major}}.{{minor}},enable=${{ steps.buildxy.outputs.buildxy }}
type=semver,pattern={{version}}
type=raw,value=edge,enable=${{ github.event.action == 'prereleased' || github.event.client_payload.tag_name == steps.latest-octoprint.outputs.release }}
type=raw,value=canary,enable=${{ github.event.action == 'canary' }}
type=raw,value=bleeding,enable=${{ github.event.action == 'bleeding' }}
flavor: |
latest=${{ steps.stable-octoprint.outputs.release == github.event.client_payload.tag_name }}
I rather think that your workflow in the above example is too complex and does not reflect a nominal case where a user simply wants to release his Docker image following a standard GitFlow (push, tag). But again you can do that with v2 if you want. If you have a use case where v2 would not be effective I would be happy to review its structure. Thanks again for your feedback! |
Your example doesn't work. The first entry in tags is just a raw tag, and isn't parsed at all. The other entries presume there is a corresponding ref, which the workflow wouldn't have, and thus would fail. let's say i get a I can't do this with the v1 implementation of your action, or the v2 implementation as its currently written.
I can tell you've been in this business as long as I have, and undoubtedly have learned by now that this is a trap. 😏 Use cases where you'd want to use external payloads:
I think it would be very simple to maintain this behavior as the default, and implement the ability to parse I also still wonder if |
No it will be parsed as a tags: |
type=raw,value=mytag1
# or
type=raw,mytag1
# or
mytag1
Agree about this one, semver will not be processed because it's not a tag event. I will improve this behavior.
I'm fine with that, I'm going to make some changes in that direction. |
Based on your latest comments, I believe my primary concerns are resolved at least for the moment, and I agree with this direction. At this point I'm going with 👍 based on the docs. While not a full replacement yet, it does give me a path to deprecate my own action as those improvements you mentioned are rolled out, and I'd be happy to contribute those features and join you as a maintainer for this project if you want that. |
Sure we can bring enhancements in folllow up PRs. Just want with v2 a solid foundation to build on.
Ofc with pleasure! |
@LongLiveCHIEF Ok now you can use a custom value for semver and match type. |
Maybe I am to stupid, but I am not able to use the branch name as tag and on the default branch PS: Am I able to tell the flavor to do latest only on a tag and use edge in the default branch? - name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: |
${{ env.IMAGE_NAME }}
ghcr.io/${{ env.IMAGE_NAME }}
tags: |
type=edge
type=ref,event=pr
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
flavor: |
prefix=${{ matrix.jvm-impl }}
latest=${{ matrix.jvm-impl == 'hotspot' }} |
@MarcelCoding Can you create a new issue please? I would need logs and link to your repo/pipeline. Thanks. |
Fixes #30
Fixes #41
Fixes #13
Fixes #27
Fixes #25
Closes #47
Closes #15
v2 introduces a new way to handle metadata for your Docker image as part of the proposal in #30.
Documentation: https://github.com/crazy-max/ghaction-docker-meta/tree/v2#readme
cc. @LongLiveCHIEF @hugopeixoto @mblaschke @felipecrs @kereis @slimcdk @whyman @CharlieC3 @lpil