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

Contribute JIRA_URL environment variable

    XMLWordPrintable

Details

    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

            falcon benoit guerin added a comment -

            Pull request link attached

            falcon benoit guerin added a comment - Pull request link attached

            falcon 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.

            nrayapati Naresh Rayapati added a comment - falcon 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.

            falcon 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. 

            nrayapati Naresh Rayapati added a comment - falcon 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. 
            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.

            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.
            nrayapati Naresh Rayapati added a comment - - edited

            falcon 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()
            }
            
            nrayapati Naresh Rayapati added a comment - - edited falcon 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() }
            falcon benoit guerin added a comment -

            Thanks nrayapati, 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

            falcon benoit guerin added a comment - Thanks nrayapati , 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

            Sure falcon, Thanks again for logging this request.

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

            People

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

              Dates

                Created:
                Updated:
                Resolved: