-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins v2.361.4
CloudBees Docker Build and Publish plugin version 1.4.0
In Jenkins job, use parameter ${SERVICE_NAME} in repository, but still got failed.
Error log from Jenkins is as below.
ERROR: Name must follow the pattern '^[a-zA-Z0-9]((\.||_|-)[a-zA-Z0-9]+)*$'
ERROR: Name must follow the pattern '^[a-zA-Z0-9]((\.||_|-)[a-zA-Z0-9]+)*$'
at hudson.util.FormValidation._errorWithMarkup(FormValidation.java:268)
at hudson.util.FormValidation.errorWithMarkup(FormValidation.java:254)
at hudson.util.FormValidation.error(FormValidation.java:145)
at hudson.util.FormValidation.error(FormValidation.java:170)
at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator.validateName(ImageNameValidator.java:289)
at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator.validateUserAndRepo(ImageNameValidator.java:115)
at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.imageName(DockerRegistryEndpoint.java:331)
at com.cloudbees.dockerpublish.DockerBuilder.getRepo(DockerBuilder.java:252)
at com.cloudbees.dockerpublish.DockerBuilder$Perform.getImageTags(DockerBuilder.java:336)
at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:305)
at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:291)
at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:262)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:816)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:164)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
at hudson.model.Run.execute(Run.java:1899)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:107)
at hudson.model.Executor.run(Executor.java:449)
Build step 'Docker Build and Publish' marked build as failure
Jenkins: Version 2.414.2
CloudBees Docker Build and Publish: Version: 1.4.0
I experience the same issue. I used to be able to enter "${SOME_ENVIRONMENT_VARIABLE}" as a value for the Repository Name field.
The environment variable would be set by injecting it from a properties file that becomes available after SCM checkout. (Build Environment -> Inject environment variables to the build process -> Properties File Path)
When I look up a failed build's recorded environment variables, this variable is listed with the correct, intended value;
When I copy & pasting that exact same value directly into the Repository Name field of the Docker Build and Publish build step, it works.
When I use either "${SOME_ENVIRONMENT_VARIABLE}", or "${env.SOME_ENVIRONMENT_VARIABLE}", it fails;
This tells me that the validation is not barfing on the value; instead appears that environment variable substitution is no longer performed before validating the field's value.
Please fix ASAP.