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

When using Jenkins DSL, global defaults don't work

    XMLWordPrintable

Details

    Description

      Hi folks,

      not sure, whether I'm at the right place to report this, but let's see.

      We're using the Jenkins DSL to create jobs via .groovy files. We have configured the RocketChat user/password/serverURL/and so on globally in Jenkins settings.

      Yet when I try to create just a test:

      [...]
               publishers {
                   rocketChatNotifier {
                      title('Moin, ich bin lpp-frontend-infrastructure')
                      text('huhu')
                      channel('#jenkins')
                      customMessage('Moin, ich bin lpp-frontend-infrastructure')
                   }
               }
      [...]
      

      I get the following error:

      Processing DSL script PROJECTNAME.groovy

      ERROR: (PROJECTNAME, line 199) the following options are required and must be specified: rocketServerUrl, trustSSL, username, password, buildServerUrl, startNotification, notifyAborted, notifyFailure, notifyNotBuilt, notifySuccess, notifyUnstable, notifyBackToNormal, notifyRepeatedFailure, includeTestSummary, commitInfoChoice, includeCustomMessage

      Finished: FAILURE

      Is this something the plugin is able to solve?

      Cheers
      Thomas

      Attachments

        Activity

          twizzydizzy TwizzyDizzy TwizzyDizzy created issue -
          twizzydizzy TwizzyDizzy TwizzyDizzy added a comment - Goes in the direction of: https://github.com/jenkinsci/slack-plugin/issues/232
          mreinhardt Martin Reinhardt made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          mreinhardt Martin Reinhardt added a comment - you can try the hpi from here:  https://martinreinhardt-online.de/jenkins/job/rocketchatnotifier-plugin/job/feature-feature%252F48486_defaults_dsl/lastSuccessfulBuild/artifact/target/

          Hi mreinhardt,

          tried your build... jenkins user/password/server have been configured globally.

          Jenkins DSL used

              publishers {
                  rocketChatNotifier {
                      channel('#jenkins')
                      includeTestSummary(false)
                      notifyAborted(true)
                      notifyBackToNormal(true)
                      notifyFailure(true)
                      notifyNotBuilt(true)
                      notifyRepeatedFailure(true)
                      notifySuccess(true)
                      notifyUnstable(true)
                      startNotification(true)
                  }
              }
          

          The build of the job from the groovy file now works, yet after sending

          deploy PROJECT to dev - #19 Success after 19 sec

          to the #jenkins channel, there is a Null pointer exception:

          ERROR: Build step failed with exception
          java.lang.NullPointerException
          	at jenkins.plugins.rocketchatnotifier.ActiveNotifier.completed(ActiveNotifier.java:107)
          	at jenkins.plugins.rocketchatnotifier.RocketChatNotifier.perform(RocketChatNotifier.java:289)
          	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
          	at hudson.model.Build$BuildExecution.post2(Build.java:186)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
          	at hudson.model.Run.execute(Run.java:1753)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          	at hudson.model.ResourceController.execute(ResourceController.java:98)
          	at hudson.model.Executor.run(Executor.java:405)
          Build step 'RocketChat Notifications' marked build as failure
          Finished: FAILURE
          

          Cheers
          Thomas

          twizzydizzy TwizzyDizzy TwizzyDizzy added a comment - Hi mreinhardt , tried your build... jenkins user/password/server have been configured globally. Jenkins DSL used publishers { rocketChatNotifier { channel( '#jenkins' ) includeTestSummary( false ) notifyAborted( true ) notifyBackToNormal( true ) notifyFailure( true ) notifyNotBuilt( true ) notifyRepeatedFailure( true ) notifySuccess( true ) notifyUnstable( true ) startNotification( true ) } } The build of the job from the groovy file now works, yet after sending deploy PROJECT to dev - #19 Success after 19 sec to the #jenkins channel, there is a Null pointer exception: ERROR: Build step failed with exception java.lang.NullPointerException at jenkins.plugins.rocketchatnotifier.ActiveNotifier.completed(ActiveNotifier.java:107) at jenkins.plugins.rocketchatnotifier.RocketChatNotifier.perform(RocketChatNotifier.java:289) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720) at hudson.model.Build$BuildExecution.post2(Build.java:186) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665) at hudson.model.Run.execute(Run.java:1753) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) Build step 'RocketChat Notifications' marked build as failure Finished: FAILURE Cheers Thomas
          thaipham Thai Pham added a comment -

          I'm also experiencing the same problem. Is there any plan to fix it?

          Thanks,

          Thai

          thaipham Thai Pham added a comment - I'm also experiencing the same problem. Is there any plan to fix it? Thanks, Thai

          which plugin version you're using?

          mreinhardt Martin Reinhardt added a comment - which plugin version you're using?
          thaipham Thai Pham added a comment -

          mreinhardt, I'm using 1.1.1.

          thaipham Thai Pham added a comment - mreinhardt , I'm using 1.1.1.
          thaipham Thai Pham added a comment -

          I used the same code as twizzydizzy was using:

              publishers {
                  rocketChatNotifier {
                      channel '#jenkins'
                      includeTestSummary false
                      notifyAborted true
                      notifyBackToNormal true
                      notifyFailure true
                      notifyNotBuilt true
                      notifyRepeatedFailure true
                      notifySuccess true
                      notifyUnstable true
                      startNotification true
                  }
              }
          

          and got a similar error message:

          ERROR: (ci.groovy, line 103) the following options are required and must be specified: rocketServerUrl, trustSSL, username, password, buildServerUrl, includeTestSummary, commitInfoChoice, includeCustomMessage, customMessage, webhookToken, tokenCredentialId
          
          thaipham Thai Pham added a comment - I used the same code as twizzydizzy was using: publishers { rocketChatNotifier { channel '#jenkins' includeTestSummary false notifyAborted true notifyBackToNormal true notifyFailure true notifyNotBuilt true notifyRepeatedFailure true notifySuccess true notifyUnstable true startNotification true } } and got a similar error message: ERROR: (ci.groovy, line 103) the following options are required and must be specified: rocketServerUrl, trustSSL, username, password, buildServerUrl, includeTestSummary, commitInfoChoice, includeCustomMessage, customMessage, webhookToken, tokenCredentialId
          mreinhardt Martin Reinhardt made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]

          Erm. So do we do anything wrong, mreinhardt, or what is the reason for closing this issue? An explanation would be a nice thing

          Cheers
          Thomas

          twizzydizzy TwizzyDizzy TwizzyDizzy added a comment - Erm. So do we do anything wrong, mreinhardt , or what is the reason for closing this issue? An explanation would be a nice thing Cheers Thomas

          People

            mreinhardt Martin Reinhardt
            twizzydizzy TwizzyDizzy TwizzyDizzy
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: