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

job not created when name ends with whitespace but no exception

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core, job-dsl-plugin
    • None
    • jenkins: 2.44
      job-dsl-plugin: 1.57
      os: windows 10

      Hi.

      I encountered this issue by accident and can see in jira that whitespaces have been an issue before.

      When providing a simple dsl such as:

      job('test ')

      It executes without and exceptions but yet doesn't create the job.
      I'd expect that checkGoodName would catch it and throw and exception.
      Thanks in advance!

      Processing provided DSL script
      Added items:
      GeneratedJob

      Unknown macro: {name='test '}

      Unreferenced items:
      GeneratedJob

      Unknown macro: {name='test'}

      Finished: SUCCESS

          [JENKINS-41670] job not created when name ends with whitespace but no exception

          I can not reproduce the problem. The job has been generated, it's URL is http://localhost:8080/job/test%20/.

          Processing provided DSL script
          Added items:
              GeneratedJob{name='test '}
          Finished: SUCCESS
          

          Daniel Spilker added a comment - I can not reproduce the problem. The job has been generated, it's URL is http://localhost:8080/job/test%20/ . Processing provided DSL script Added items: GeneratedJob{name= 'test ' } Finished: SUCCESS

          Sorry for the late reply!
          I verified what I escalated previously and it works perfectly fine under linux. It only seems to be reproducible under windows.

          Stefan Drzazga added a comment - Sorry for the late reply! I verified what I escalated previously and it works perfectly fine under linux. It only seems to be reproducible under windows.

          Job DSL considers every name a good name that passes checkGoodName. Then Job DSL passes the name to core APIs to create or update jobs.

          IMHO this should be fixed in core, e.g. by not allowing names that start or end with whitespace.

          Daniel Spilker added a comment - Job DSL considers every name a good name that passes checkGoodName . Then Job DSL passes the name to core APIs to create or update jobs. IMHO this should be fixed in core, e.g. by not allowing names that start or end with whitespace.

            Unassigned Unassigned
            sdrzazga Stefan Drzazga
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: