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

Job URL passed to webhook is incorrect (null base url) for manually triggered builds without SCM

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: mattermost-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.144
      Plugin: mattermost: 2.5.2
      Mattermost: 5.3.1
    • Similar Issues:

      Description

      Problem

      Job status notifications sent to Jenkins have the following link back url:

      http://nulljob/test-mattermost/8/ 

      While "Test" button notifications (from Global Configuration or from Job Config) have the correct Jenkins base URL:

      Mattermost/Jenkins plugin: you're all set! (parameters: endpoint='https://MATTERMOST/hooks/xxxxxxxxxxxx', room='test', icon='', buildServerUrl='http://JENKINS:8080/')

      Configuration 

      My global configuration has a Jenkins URL correctly set. 

      I've tried both setting and not setting the Build Server URL in the Mattermost config section (to the same value), same result.

      It doesn't matter if I specify the mattermost endpoint URL/channel in the job or in global, or both.

      Jenkins log:

      Oct 12, 2018 9:34:21 AM INFO jenkins.plugins.mattermost.MattermostNotifier prebuild
      Invoking Started...
      Oct 12, 2018 9:34:21 AM INFO jenkins.plugins.mattermost.StandardMattermostService publish
      Posting: to test@https://MATTERMOST/hooks/xxxxxx: test-mattermost - #9 Started by user XXXX [Open](nulljob/test-mattermost/9/) (good)
      Oct 12, 2018 9:34:21 AM INFO jenkins.plugins.mattermost.StandardMattermostService publish
      Posting succeeded
      
      

       

        Attachments

          Activity

          Hide
          akom Alexander Komarov added a comment -

          After glancing at the code I determined that builds started by SCM polling notify with correct build URL (both in start and completed notification). 

          The problem only affects manually triggered builds.

          It gets worse:

          Once the job has had SCM/polling configuration and successfully notified Mattermost, it will continue to work correctly even after removing SCM/polling configuration.  In other words, problem only exists for new jobs that were created without SCM info.

          Show
          akom Alexander Komarov added a comment - After glancing at the code I determined that builds started by SCM polling notify with correct build URL (both in start and completed notification).  The problem only affects manually triggered builds. It gets worse: Once the job has had SCM/polling configuration and successfully notified Mattermost, it will continue to work correctly even after removing SCM/polling configuration.  In other words, problem only exists for new jobs that were created without SCM info.
          Hide
          furai Furai added a comment - - edited

          Hey,

          I've started getting this issue today. Due to recent change in core (https://github.com/jenkinsci/stash-pullrequest-builder-plugin/pull/26) this notification plugin doesn't fetch the jenkins url correctly.

          Could this get fixed? If the reported above issue is different I'm happy to open a new one.

          Ewelina Wilkosz Jo Vandeginste - tagging latest committers for awareness.

          Show
          furai Furai added a comment - - edited Hey, I've started getting this issue today. Due to recent change in core ( https://github.com/jenkinsci/stash-pullrequest-builder-plugin/pull/26 ) this notification plugin doesn't fetch the jenkins url correctly. Could this get fixed? If the reported above issue is different I'm happy to open a new one. Ewelina Wilkosz Jo Vandeginste - tagging latest committers for awareness.
          Hide
          kjanssen Kay-Uwe Janssen added a comment -

          Yesterday we have updated jenkins to 2.150.1 (from 2.138.x iirc) and now we have the same issue. But it looks like for us it is both scm triggerd as well as manually and cron triggered builds (read: for all builds)

           

          is there any fix in the work ?

           

           

          Mattermost-Version: 5.4.0

          Jenkins ver. 2.150.1

          Mattermost Notification Plugin 2.6.1

          Show
          kjanssen Kay-Uwe Janssen added a comment - Yesterday we have updated jenkins to 2.150.1 (from 2.138.x iirc) and now we have the same issue. But it looks like for us it is both scm triggerd as well as manually and cron triggered builds (read: for all builds)   is there any fix in the work ?     Mattermost-Version: 5.4.0 Jenkins ver. 2.150.1 Mattermost Notification Plugin 2.6.1
          Hide
          kjanssen Kay-Uwe Janssen added a comment -

          I just have opened a PR inspired by the changes proposed in https://github.com/jenkinsci/stash-pullrequest-builder-plugin/pull/26

          Here is the PR Link; https://github.com/jenkinsci/mattermost-plugin/pull/9

           

          I build the plugin from the PR branch and it works.

          Show
          kjanssen Kay-Uwe Janssen added a comment - I just have opened a PR inspired by the changes proposed in https://github.com/jenkinsci/stash-pullrequest-builder-plugin/pull/26 Here is the PR Link; https://github.com/jenkinsci/mattermost-plugin/pull/9   I build the plugin from the PR branch and it works.
          Hide
          jovandeginste Jo Vandeginste added a comment -

          New release containing this PR

          Show
          jovandeginste Jo Vandeginste added a comment - New release containing this PR
          Hide
          jovandeginste Jo Vandeginste added a comment -

          Also, thank you Kay-Uwe Janssen

          Show
          jovandeginste Jo Vandeginste added a comment - Also, thank you Kay-Uwe Janssen

            People

            Assignee:
            jovandeginste Jo Vandeginste
            Reporter:
            akom Alexander Komarov
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: