-
New Feature
-
Resolution: Won't Fix
-
Minor
-
None
-
Jenkins 2.330
Docker commons: 1.18
Issue independently for any other components.
Deal all,
I would like to ask a small improvement on Docker image name validation. The current situation Docker is allow more combination of the name, that the current Regex are validating.
Cite from docker side:
"A tag name must be valid ASCII and may contain lowercase and uppercase letters, 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."
Source: https://docs.docker.com/engine/reference/commandline/tag/#extended-description
- The issue:
The current image name validation fit with these pattern: ^[a-zA-Z0-9]((
.||_|-)[a-zA-Z0-9]+)*$
Source code: https://github.com/jenkinsci/docker-commons-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/commons/credentials/ImageNameValidator.java#L188
In this case only allowed just one special character in the image name like "foo", "foo2", "foo1-1", "foo2-bar2" etc.
So it is a bit more restricted than it was provided in the Guide.
- The suggested solution from my side:
The name validation can be extend like this pattern: ^[a-zA-Z0-9]((\.||_|-)[a-zA-Z0-9]+){1,}
In this case it will be allowed another naming as well like "foo-bar-foo1" or "foo_bar-foo2-bar3" etc.
Optionally is it possible to add the limit to the pattern as well to restrict the max. lenth of the string.
The pattern with length limitation: ^([a-zA-Z0-9]((\.||_|-)[a-zA-Z0-9]+){1,}){1,128}
I hope this change can be implemented, because this improvement will be very good for every other users, who are using "Docker commons" plugin in Jenkins.
Many thanks and have a great day.
Best regards,
Csaba