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

the + in version is not compatible with docker tags #5

Closed
xelax opened this issue Sep 22, 2016 · 3 comments · Fixed by #91
Closed

the + in version is not compatible with docker tags #5

xelax opened this issue Sep 22, 2016 · 3 comments · Fixed by #91
Assignees

Comments

@xelax
Copy link

xelax commented Sep 22, 2016

When combining sbt-dynver with sbt-native-packager it creates versions that are not compatible with docker tag names:
"A tag name may contain lowercase and uppercase characters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters."

this is the error I am getting:

invalid argument "blah.com/real-mine:1.0.0+5-abeb6d22" for t: Error parsing reference: "blah.com/real-mine:1.0.0+5-abeb6d22" is not a valid repository/tag
@dwijnand
Copy link
Member

dwijnand commented Sep 22, 2016

Using + for me is one of the benefits over git describe as it conveys the meaning much clearly.

But I think I can structure the data that forms the version such that you can define the final version string any way you want.

@dwijnand dwijnand self-assigned this Sep 23, 2016
@dwijnand dwijnand removed their assignment Jan 13, 2017
@daddykotex
Copy link

I use sbt-docker but could solve the issue by adding this to my build:

imageNames in docker := {
  (imageNames in docker).value.map(img => img.copy(tag = img.tag.map(_.replace("+", "_"))))
}

Note that imageNames is already filled here by a internal plugin. There are two images one with the tag latest and one with the version. Here I simply override the settings with the current value but I replace any + in the tag.

There is probably a similar way to do this with sbt-native-packager.

@dwijnand dwijnand self-assigned this Feb 22, 2017
dwijnand added a commit that referenced this issue Feb 22, 2017
@dwijnand dwijnand reopened this Feb 22, 2017
dwijnand added a commit that referenced this issue Feb 22, 2017
dwijnand added a commit that referenced this issue Feb 22, 2017
@dwijnand
Copy link
Member

Hi all,

The solution, as documented in the top half of https://github.com/dwijnand/sbt-dynver#custom-version-string is to post-process, like so:

version in ThisBuild ~= (_.replace('+', '-'))
 dynver in ThisBuild ~= (_.replace('+', '-'))

See the rest of https://github.com/dwijnand/sbt-dynver#custom-version-string for guidance if you want/need a more sophisticated solution.

jroper added a commit to jroper/sbt-dynver that referenced this issue Mar 1, 2019
Fixes sbt#5

Added a `dynverSeparator` setting so that it can be overridden
for use with docker images in an easier to understand manner than is
currently possible.
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

Successfully merging a pull request may close this issue.

3 participants