Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-67572

Error on docker image name: Name must follow the pattern

    • 1.19

      Since updating my jenkins plugins to latest versions today, i get the folloging error

      ERROR: Name must follow the pattern '^[a-zA-Z0-9]+((\.|_|__|-+)[a-zA-Z0-9]+)*$'
      	at hudson.util.FormValidation._errorWithMarkup(FormValidation.java:266)
      	at hudson.util.FormValidation.errorWithMarkup(FormValidation.java:252)
      	at hudson.util.FormValidation.error(FormValidation.java:143)
      	at hudson.util.FormValidation.error(FormValidation.java:168)
      	at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator.validateName(ImageNameValidator.java:209)
      	at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator.validateUserAndRepo(ImageNameValidator.java:105)
      	at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator.checkUserAndRepo(ImageNameValidator.java:126)
      	at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator$checkUserAndRepo.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
      	at org.jenkinsci.plugins.docker.workflow.Docker.check(Docker.groovy:97)
      

      Part of pipeline.

                          agent {
                              docker {
                                  label 'docker && linux'
                                  image 'ghcr.visualon.de/visualon/builder:1.0.21@sha256:56930391cf0e1be83108422bbef43001650cfb75f64b3429928f0c5986fdb750'
                              }
                          }
                          steps {
                              sh 'yarn install --frozen-lockfile'
                          }
      

      It seems that digest pinning is no longer allowd

          [JENKINS-67572] Error on docker image name: Name must follow the pattern

          Ramesh Audireddy added a comment - - edited

          viceice,

           

          I am still getting the same issue in my environment even after upgrading the docker-commons plugin.

          Installed Jenkins Version: Jenkins 2.328

           

          TAG FORMAT: <aftifact-version>-<BUILD_NUMBER>-SNAPSHOT (Ex: 4.0.0-119-SNAPSHOT)

           

          ERROR: Tag must follow the pattern &#039;^:[a-zA-Z0-9_]([a-zA-Z0-9_.-]){0,127}&#039; 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)
          

           

          Thanks and Regards,

          Ramesh

           

          Ramesh Audireddy added a comment - - edited viceice ,   I am still getting the same issue in my environment even after upgrading the docker-commons plugin. Installed Jenkins Version:  Jenkins 2.328   TAG FORMAT: <aftifact-version>-<BUILD_NUMBER>-SNAPSHOT (Ex: 4.0.0-119-SNAPSHOT)   ERROR: Tag must follow the pattern &#039;^:[a-zA-Z0-9_]([a-zA-Z0-9_.-]){0,127}&#039; 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)   Thanks and Regards, Ramesh  

          Paul "TBBle" Hampson added a comment - - edited

          Are you sure 4.0.0-119-SNAPSHOT is being passed through correctly? According to https://www.regextester.com/, that's a match for

          ^:[a-zA-Z0-9_]([a-zA-Z0-9_.-]){0,127}
          

          once you add : to the front (which is now included in the string passed to the validation).

          I suspect, similar to https://issues.jenkins.io/browse/JENKINS-67633?focusedCommentId=421313&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-421313 and https://github.com/jenkinsci/docker-commons-plugin/pull/93#issuecomment-1028331791, your variable-substitution string is being passed through unmodified, as it's no longer interpolated by the shell (due to SECURITY-1878), and so it's trying to apply a tag like ${ARTIFACT_VERSION}-${BUILD_NUMBER}-SNAPSHOT literally.

          viceice: It might be a useful enhancement for the error message to include the actual tag being checked, to help identify when users have depended on the now-removed shell interpolation behaviour.

          Paul "TBBle" Hampson added a comment - - edited Are you sure 4.0.0-119-SNAPSHOT is being passed through correctly? According to https://www.regextester.com/,  that's a match for ^:[a-zA-Z0-9_]([a-zA-Z0-9_.-]){0,127} once you add : to the front (which is now included in the string passed to the validation). I suspect, similar to https://issues.jenkins.io/browse/JENKINS-67633?focusedCommentId=421313&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-421313  and  https://github.com/jenkinsci/docker-commons-plugin/pull/93#issuecomment-1028331791 , your variable-substitution string is being passed through unmodified, as it's no longer interpolated by the shell (due to SECURITY-1878 ), and so it's trying to apply a tag like ${ARTIFACT_VERSION}-${BUILD_NUMBER}-SNAPSHOT literally. viceice : It might be a useful enhancement for the error message to include the actual tag being checked, to help identify when users have depended on the now-removed shell interpolation behaviour.

          p_hampson, Yes, it is passing correctly.

           

           
          ERROR: Tag must follow the pattern '^:[a-zA-Z0-9_]([a-zA-Z0-9_.-]){0,127}'
           
          09:26:41 ❻ root@5bf0d346a451:> Push Docker Image to DTR - https://<image-registry>:4.1.2-9-SNAPSHOT
           

          Thanks and Regards,

          Ramesh

          Ramesh Audireddy added a comment - p_hampson , Yes, it is passing correctly.     ERROR: Tag must follow the pattern '^: [a-zA-Z0-9_] ( [a-zA-Z0-9_.-] ){0,127}'   09:26:41 ❻ root@5bf0d346a451:> Push Docker Image to DTR - https://<image-registry>:4.1.2-9-SNAPSHOT   Thanks and Regards, Ramesh

          Paul "TBBle" Hampson added a comment - - edited

          I suggest raising this as a new bug, since it's no longer "image name validation regexp is too restrictive", and now is "For some reason, a regexp-valid name is being rejected or misprocessed".

          That way it'll have more visibility, since this issue is marked Resolved already.

          Side-note: Do you have https:// in your image name? That might be the issue, as I'm not sure if the code that breaks the image name up into components (registry, repository, tag, digest) takes into account that possibility. (I think it's technically invalid syntax by the spec, but works with the Docker CLI and probably most CLIs by compatibility)

          Paul "TBBle" Hampson added a comment - - edited I suggest raising this as a new bug, since it's no longer "image name validation regexp is too restrictive", and now is "For some reason, a regexp-valid name is being rejected or misprocessed". That way it'll have more visibility, since this issue is marked Resolved already. Side-note: Do you have https:// in your image name? That might be the issue, as I'm not sure if the code that breaks the image name up into components (registry, repository, tag, digest) takes into account that possibility. (I think it's technically invalid syntax by the spec, but works with the Docker CLI and probably most CLIs by compatibility)

          Hi p_hampson,

          Seems the https:// is not causing the issue as the tag is parsing if I remove the BUILD_NUMBER from the tag.

           

          Thanks and Regards,

          Ramesh

          Ramesh Audireddy added a comment - Hi p_hampson , Seems the https:// is not causing the issue as the tag is parsing if I remove the BUILD_NUMBER from the tag.   Thanks and Regards, Ramesh

          Well, I'm flummoxed. Open a new ticket, I suspect it's going to need a lot of logs to work out what's going on there, and probably parts of your Jenkinsfile (or a minimal reproduction) with the issue to allow further investigation.

          Paul "TBBle" Hampson added a comment - Well, I'm flummoxed. Open a new ticket, I suspect it's going to need a lot of logs to work out what's going on there, and probably parts of your Jenkinsfile (or a minimal reproduction) with the issue to allow further investigation.

          Thank you p_hampson.

          Have opened a new ticket for this.

          https://issues.jenkins.io/browse/JENKINS-67749

          Ramesh Audireddy added a comment - Thank you p_hampson . Have opened a new ticket for this. https://issues.jenkins.io/browse/JENKINS-67749

          I would be able to extend the error message, but not sure when i will have time for it. Should be pretty simple to do.

          I'm not a maintainer, i'm only a jenkins user and fixed a bug.

          Michael Kriese added a comment - I would be able to extend the error message, but not sure when i will have time for it. Should be pretty simple to do. I'm not a maintainer, i'm only a jenkins user and fixed a bug.

          Paul "TBBle" Hampson added a comment - - edited

          Ah, my mistake, I had tagged you only because I thought you were a maintainer. I should have checked first. (I didn't realise tickets here could be assigned to non-maintainers.)

          Paul "TBBle" Hampson added a comment - - edited Ah, my mistake, I had tagged you only because I thought you were a maintainer. I should have checked first. (I didn't realise tickets here could be assigned to non-maintainers.)

          Don't worry. You can nearly do anything here.

          Michael Kriese added a comment - Don't worry. You can nearly do anything here.

            viceice Michael Kriese
            viceice Michael Kriese
            Votes:
            6 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: