Skip to content
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

Proposal to add an input to allow fail on warnings #200

Open
CAMOBAP opened this issue May 3, 2022 · 4 comments
Open

Proposal to add an input to allow fail on warnings #200

CAMOBAP opened this issue May 3, 2022 · 4 comments

Comments

@CAMOBAP
Copy link

CAMOBAP commented May 3, 2022

Behaviour

Steps to reproduce this issue

  1. pass version which is a not valid semver.org version
  2. the action will warn you will message like Warning: v1.5.15pre1 is not a valid semver. More info: https://semver.org/

Expected behavior

It will be nice to add some strict input to treat all warnings as errors. And if the version is invalid the docker/metadata-action step will fails

Actual behaviour

I suppose current behavior is right


This ticket just to understand if this feature is useful for someone else

@crazy-max
Copy link
Member

@CAMOBAP You have this warning because you're using type=semver: https://github.com/metanorma/metanorma-docker/blob/abc2919a7793838262a48697931b4e267c3a56f0/.github/workflows/build-push.yml#L78-L84

        tags: |
          type=edge,branch=main
          type=ref,event=branch
          type=ref,event=pr
          type=semver,pattern={{version}}
          type=semver,pattern={{major}}.{{minor}}
          type=semver,pattern={{major}}

If your tag doesn't support semver and you just want the tag, then just replace type=semver with:

        tags: |
          type=edge,branch=main
          type=ref,event=branch
          type=ref,event=pr
          type=ref,event=tag

@CAMOBAP
Copy link
Author

CAMOBAP commented May 4, 2022

@crazy-max thanks for the suggestion. The problem is solved actually, my point is that this warning is silent, you can find it only if other steps fail. Isn't it better if the step will fail instead of the warning message?

@crazy-max
Copy link
Member

Isn't it better if the step will fail instead of the warning message?

Yes maybe we could add a strict mode to the action for semver and maybe also for invalid chars in image name and tags. Not sure if it should be global or per entries:

        tags: |
          type=edge,branch=main
          type=ref,event=branch
          type=ref,event=pr
          type=semver,pattern={{version}},strict=true
          type=semver,pattern={{major}}.{{minor}},strict=true
          type=semver,pattern={{major}},strict=true

Or through flavor?:

flavor: |
  strict=semver,image,tag

Need to think about it. Open to suggestions.

@CAMOBAP
Copy link
Author

CAMOBAP commented May 4, 2022

If you ask me (as a user) it will be nice to just extra input strict which handles all such situations (wrong/bad input). Some advance use cases like via flavor also can be useful, but for me strict: true will be enough

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

No branches or pull requests

2 participants