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

PROJECT_URL variable not correctly set when email is sent by Promoted Build Plugin

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • promoted-builds-plugin
    • None
    • Hudson 1.365, Java 1.6

      The email-ext plugin makes the PROJECT_URL environment variable available to be sent via emails. It seems to work fine for standard projects. However if the email-ext plugin is used in coordination with Promoted Builds, the actual URL value constructed by the email-ext plugin in the hudson.plugins.emailext.plugins.content.ProjectURLContent is not correct. Not sure if this is caused by the email-ext plugin or if the build number of the project is not passwed down to the email-ext correctly. The PROJECT_URL seems to be missing the actual build number in it. For example :

      Good URL : http://myhost.com/hudson/job/MY_JOB_NAME/promotion/BUILDNUM/PROMOTION_PROCESSNAME/

      Bad URL being generated : http://myhost.com/hudson/job/MY_JOB_NAME/promotion//PROMOTION_PROCESSNAME/

      Note the actual build number represented by "BUILDNUM" is missing so that 2 slashes are used instead.

          [JENKINS-6922] PROJECT_URL variable not correctly set when email is sent by Promoted Build Plugin

          Peter Hayes added a comment -

          I verified that this still exists in the plugin. I'll take a look at fixing this.

          Peter Hayes added a comment - I verified that this still exists in the plugin. I'll take a look at fixing this.

          Peter Hayes added a comment -

          There really is no project url for a promotion. The closest is the promotion status url at http://myhost.com/hudson/job/MY_JOB_NAME/promotion. That will show all promotions. The promotion UI would have to be significantly rearranged to follow the url pattern that top level jobs have.

          Any thoughts?

          Peter Hayes added a comment - There really is no project url for a promotion. The closest is the promotion status url at http://myhost.com/hudson/job/MY_JOB_NAME/promotion . That will show all promotions. The promotion UI would have to be significantly rearranged to follow the url pattern that top level jobs have. Any thoughts?

          Alex Earl added a comment -

          If you made something available via the token-macro plugin, email-ext could use it, but other than that I don't have any ideas.

          Alex Earl added a comment - If you made something available via the token-macro plugin, email-ext could use it, but other than that I don't have any ideas.

          Alex Earl added a comment -

          The other idea (and I said I didn't have any other ideas!) would be to use a Groovy script to get at the data you want and present that in the email.

          Alex Earl added a comment - The other idea (and I said I didn't have any other ideas!) would be to use a Groovy script to get at the data you want and present that in the email.

          The same problem occurs with the build number. This could be fixed by using PROMOTED_NUMBER and PROMOTED_SVN_REVISION env variable, from what is shown here: https://github.com/jenkinsci/promoted-builds-plugin/blob/master/src/main/java/hudson/plugins/promoted_builds/Promotion.java you can use the PROMOTED_URL for the URL part.

          Beside this, it would be nice to allow to trigger a mail when a promition occurs (not sure if this is possible) so you not need to wrap the mail configuration in a a promotion directly.

          Christoph Läubrich added a comment - The same problem occurs with the build number. This could be fixed by using PROMOTED_NUMBER and PROMOTED_SVN_REVISION env variable, from what is shown here: https://github.com/jenkinsci/promoted-builds-plugin/blob/master/src/main/java/hudson/plugins/promoted_builds/Promotion.java you can use the PROMOTED_URL for the URL part. Beside this, it would be nice to allow to trigger a mail when a promition occurs (not sure if this is possible) so you not need to wrap the mail configuration in a a promotion directly.

          Alex Earl added a comment -

          I am adding the ability for other plugins to trigger emails (making EmailTrigger an extension point). This could solve the issue if the promotion plugin created its own trigger.

          Alex Earl added a comment - I am adding the ability for other plugins to trigger emails (making EmailTrigger an extension point). This could solve the issue if the promotion plugin created its own trigger.

          Alex Earl added a comment -

          Would BUILD_URL work? From looking at the code, it should give you what you need.

          Alex Earl added a comment - Would BUILD_URL work? From looking at the code, it should give you what you need.

          Alex Earl added a comment -

          I don't think this has implications on email-ext anymore.

          Alex Earl added a comment - I don't think this has implications on email-ext anymore.

            petehayes Peter Hayes
            adammyatt adammyatt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: