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

Contribute JIRA_URL environment variable

    Details

    • Similar Issues:

      Description

      The idea is to use this environment variable to, for example, build links to issues

      We can get this information by calling getServerInfo() but we have it from configuration, so if a remote call can be avoid ...

        Attachments

          Issue Links

            Activity

            Hide
            falcon benoit guerin added a comment -

            Pull request link attached

            Show
            falcon benoit guerin added a comment - Pull request link attached
            Hide
            nrayapati Naresh Rayapati added a comment -

            benoit guerin Thank you for the PR I'm on vacation with limited internet, will be back by end of the month will definitely take a look at this. Thanks again.

            Show
            nrayapati Naresh Rayapati added a comment - benoit guerin Thank you for the PR I'm on vacation with limited internet, will be back by end of the month will definitely take a look at this. Thanks again.
            Hide
            nrayapati Naresh Rayapati added a comment -

            benoit guerin I am wondering about the real use case here, not sure if this change really is going to behave as expected especially when using multiple sites with in a single run, the environment variable would change consistently based on the site. 

            Show
            nrayapati Naresh Rayapati added a comment - benoit guerin I am wondering about the real use case here, not sure if this change really is going to behave as expected especially when using multiple sites with in a single run, the environment variable would change consistently based on the site. 
            Hide
            falcon benoit guerin added a comment -

            My use case is on the description : build links to issues, using configuration instead of a remote call to obtain the root URL of the Jira site.

            To preserve multi sites runs, we can limit this change to the case where the

            JIRA_SITE

            env var is set.

            Show
            falcon benoit guerin added a comment - My use case is on the description : build links to issues, using configuration instead of a remote call to obtain the root URL of the Jira site. To preserve multi sites runs, we can limit this change to the case where the JIRA_SITE env var is set.
            Hide
            nrayapati Naresh Rayapati added a comment - - edited

            benoit guerin If that is the case, I would use the script to get the site url from the config. You would need to approve some signatures (script security) to use the below methods, and fine tune it a bit as it can throw null pointer exception when site not not available for given name. Let me know if you still need it as an environment variable.

            import org.thoughtslive.jenkins.plugins.jira.Config;
            import org.thoughtslive.jenkins.plugins.jira.Site;
            
            println getJIRASiteURL("Test")
            
            def getJIRASiteURL(siteName) {
                Site[] sites = Config.DESCRIPTOR.getSites()
                return sites.find { it.name == siteName }.url.toString()
            }
            
            Show
            nrayapati Naresh Rayapati added a comment - - edited benoit guerin If that is the case, I would use the script to get the site url from the config. You would need to approve some signatures (script security) to use the below methods, and fine tune it a bit as it can throw null pointer exception when site not not available for given name. Let me know if you still need it as an environment variable. import org.thoughtslive.jenkins.plugins.jira.Config; import org.thoughtslive.jenkins.plugins.jira.Site; println getJIRASiteURL( "Test" ) def getJIRASiteURL(siteName) { Site[] sites = Config.DESCRIPTOR.getSites() return sites.find { it.name == siteName }.url.toString() }
            Hide
            falcon benoit guerin added a comment -

            Thanks Naresh Rayapati, your script works for me, I did not think about this way to go

            Feel free to cancel this issue and reject the joined pull request if you think it is not a good thing for your plugin

            Show
            falcon benoit guerin added a comment - Thanks Naresh Rayapati , your script works for me, I did not think about this way to go Feel free to cancel this issue and reject the joined pull request if you think it is not a good thing for your plugin
            Hide
            nrayapati Naresh Rayapati added a comment -

            Sure benoit guerin, Thanks again for logging this request.

            Show
            nrayapati Naresh Rayapati added a comment - Sure benoit guerin , Thanks again for logging this request.

              People

              • Assignee:
                nrayapati Naresh Rayapati
                Reporter:
                falcon benoit guerin
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: