docker / metadata-action

GitHub Action to extract metadata (tags, labels) from Git reference and GitHub events for Docker
https://github.com/marketplace/actions/docker-metadata-action
Apache License 2.0
892 stars 115 forks source link

Adding helpers for semver usage #385

Open Murazaki opened 6 months ago

Murazaki commented 6 months ago

Attempt to fix https://github.com/docker/metadata-action/issues/384

I kinda fail at getting why IsRawStatement exists, and also why {{major}}.{{minor}} (in tag13 test) is supposed to give {{version}} ?

Hopefully this works properly and helps users get the best from the tags.

Murazaki commented 6 months ago

Seems like we might be having an issue here in terms of semver compliance of docker tags :

After the image name, the optional TAG is a custom, human-readable manifest identifier that's typically a specific version or variant of an image. The tag must be valid ASCII and can contain lowercase and uppercase letters, digits, underscores, periods, and hyphens. It can't start with a period or hyphen and must be no longer than 128 characters. If you don't specify a tag, the command uses latest by default.

https://docs.docker.com/engine/reference/commandline/image_tag/

crazy-max commented 6 months ago

Seems like we might be having an issue here in terms of semver compliance of docker tags :

After the image name, the optional TAG is a custom, human-readable manifest identifier that's typically a specific version or variant of an image. The tag must be valid ASCII and can contain lowercase and uppercase letters, digits, underscores, periods, and hyphens. It can't start with a period or hyphen and must be no longer than 128 characters. If you don't specify a tag, the command uses latest by default.

https://docs.docker.com/engine/reference/commandline/image_tag/

Ah completely forgot about this limitation :disappointed:

Murazaki commented 6 months ago

Ok, so until we get any news from those, we can use this but with a hyphen instead of a plus ? kinda breaks readability of semver but what can we do ? Use another letter/keyword ? An underscore maybe ?

https://github.com/docker/cli/issues/4877 https://github.com/distribution/distribution/issues/1201 https://github.com/opencontainers/distribution-spec/issues/154

crazy-max commented 6 months ago

but with a hyphen instead of a plus ? kinda breaks readability of semver but what can we do ?

Don't think we have much choice atm than waiting. Hyphens are specially treated by semver spec to handle prerelease. That would break versioning. Feel free to put this PR in draft or close it in the meantime but we can keep the issue opened for tracking.