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

Jenkins doesn't throw an error when provided with an invalid cron expression from Job DSL plugin

      Hi!

      I'm using Job DSL plugin in order to generate and maintain Jenkins jobs.

      When provided with an invalid cron expression, I would expect the following:

      Expected behaviour:

      Jenkins should fail the build and throw an error when provided with an invalid cron expression.

      Actual behaviour: 

      Jenkins doesn't throw any errors / warnings and creates the job successfully but without the build trigger.

      Example of job with an invalid trigger:

      The output when generating this job via DSL plugin when running the command :

       ./gradlew rest -Dpattern="jobs/george.groovy" -DbaseUrl="http://localhost:8080/" -Dusername=username -Dpassword=password

      And as a result, the job is created as expected but without a build trigger:

       

      Since Job DSL just generates the config.xml (AFAIUI), I supposed that Jenkins should throw an error up the chain so that it would get caught by the DSL plugin and fail the build.

       

      After all, I'm just trying to get the build to fail or at least notify via logging or something else that the cron expression is invalid, not create the job without it as if nothing happened.

       

      Any help is much appreciated!

          [JENKINS-52042] Jenkins doesn't throw an error when provided with an invalid cron expression from Job DSL plugin

          George Cimpoies created issue -
          George Cimpoies made changes -
          Environment Original: Jenkins 2.106
          Chrome
          Jdk8
          New: Jenkins 2.106
          Job DSL Plugin 1.68
          Chrome
          Jdk8
          George Cimpoies made changes -
          Description Original: Hi!

          I'm using Job DSL plugin in order to generate and maintain Jenkins jobs. When provided with an invalid cron expression, Jenkins doesn't throw any errors / warnings and creates the job successfully but without the build trigger.

          In my opinion, Jenkins should fail the build and throw an error when provided with an invalid cron expression.

          Example of job with an invalid trigger:

          !image-2018-06-19-17-54-17-701.png!

          The output when generating this job via DSL plugin is:

          !image-2018-06-19-17-55-14-601.png!

           

          And as a result, the job is created as expected but without a build trigger:

           

          !image-2018-06-19-17-56-03-529.png!

          Since Job DSL just generates the config.xml (AFAIUI), I supposed that Jenkins should throw an error up the chain so that it would get caught by the DSL plugin and fail the build.

           

          After all, I'm just trying to get the build to fail or at least notify via logging or something else that the cron expression is invalid, not create the job without it as if nothing happened.

           

          Any help is much appreciated!
          New: Hi!

          I'm using *Job DSL plugin* in order to generate and maintain Jenkins jobs.

          When provided with an invalid cron expression, I would expect the following:
          h4. *Expected behaviour:*
          h5. Jenkins should fail the build and throw an error when provided with an invalid cron expression.
          h4. Actual behaviour: 
          h5. Jenkins doesn't throw any errors / warnings and creates the job successfully but without the build trigger.

          Example of job with an invalid trigger:

          !image-2018-06-19-17-54-17-701.png!

          The output when generating this job via DSL plugin is:

          !image-2018-06-19-17-55-14-601.png!

           

          And as a result, the job is created as expected but without a build trigger:

           

          !image-2018-06-19-17-56-03-529.png!

          Since Job DSL just generates the config.xml (AFAIUI), I supposed that Jenkins should throw an error up the chain so that it would get caught by the DSL plugin and fail the build.

           

          After all, I'm just trying to get the build to fail or at least notify via logging or something else that the cron expression is invalid, not create the job without it as if nothing happened.

           

          Any help is much appreciated!
          George Cimpoies made changes -
          Description Original: Hi!

          I'm using *Job DSL plugin* in order to generate and maintain Jenkins jobs.

          When provided with an invalid cron expression, I would expect the following:
          h4. *Expected behaviour:*
          h5. Jenkins should fail the build and throw an error when provided with an invalid cron expression.
          h4. Actual behaviour: 
          h5. Jenkins doesn't throw any errors / warnings and creates the job successfully but without the build trigger.

          Example of job with an invalid trigger:

          !image-2018-06-19-17-54-17-701.png!

          The output when generating this job via DSL plugin is:

          !image-2018-06-19-17-55-14-601.png!

           

          And as a result, the job is created as expected but without a build trigger:

           

          !image-2018-06-19-17-56-03-529.png!

          Since Job DSL just generates the config.xml (AFAIUI), I supposed that Jenkins should throw an error up the chain so that it would get caught by the DSL plugin and fail the build.

           

          After all, I'm just trying to get the build to fail or at least notify via logging or something else that the cron expression is invalid, not create the job without it as if nothing happened.

           

          Any help is much appreciated!
          New: Hi!

          I'm using *Job DSL plugin* in order to generate and maintain Jenkins jobs.

          When provided with an invalid cron expression, I would expect the following:
          h4. *Expected behaviour:*
          h5. Jenkins should fail the build and throw an error when provided with an invalid cron expression.
          h4. Actual behaviour: 
          h5. Jenkins doesn't throw any errors / warnings and creates the job successfully but without the build trigger.

          Example of job with an invalid trigger:

          !image-2018-06-19-17-54-17-701.png!

          The output when generating this job via DSL plugin when running the command :

           _*./gradlew rest -Dpattern="jobs/george.groovy" -DbaseUrl="http://localhost:8080/" -Dusername=username -Dpassword=password*_

          !image-2018-06-19-17-55-14-601.png!

          And as a result, the job is created as expected but without a build trigger:

           

          !image-2018-06-19-17-56-03-529.png!

          Since Job DSL just generates the config.xml (AFAIUI), I supposed that Jenkins should throw an error up the chain so that it would get caught by the DSL plugin and fail the build.

           

          After all, I'm just trying to get the build to fail or at least notify via logging or something else that the cron expression is invalid, not create the job without it as if nothing happened.

           

          Any help is much appreciated!
          Daniel Spilker made changes -
          Assignee Original: Daniel Spilker [ daspilker ]
          Daniel Spilker made changes -
          Link New: This issue is duplicated by JENKINS-55261 [ JENKINS-55261 ]

            Unassigned Unassigned
            gcimpoies George Cimpoies
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: