1
votes

I am trying to figure out how to get the Git Changelog Plugin to pull issue information from our JIRA server. But I'm getting "no protocol" errors like this:

java.net.MalformedURLException: no protocol: /rest/api/2/issue/JIRA-1234?fields=parent,summary,issuetype,labels,description

Details follow. Does anyone happen to see what I'm doing wrong here?

Research: I got zero hits searching StackOverflow for "jenkins git changelog plugin throwing no protocol error talking to jira". I got one hit for "jenkins git changelog plugin no protocol" but it does not appear relevant. I cannot seem to find specific examples of invoking the Git Changelog Plugin from a scripted pipeline, with JIRA integration, anywhere online.

DETAILS

I'm using the following syntax to invoke the Git Changelog Plugin v2.11 from a Jenkins v2.144 pipeline:

        withCredentials([[
            $class: 'UsernamePasswordMultiBinding',
            credentialsId: 'JiraUserCredentials',
            usernameVariable: 'jiraUserName',
            passwordVariable: 'jiraUserPw'
        ]]) {
            changelogString = gitChangelog returnType: 'STRING',
                from: [type: 'COMMIT', value: startCommitHash],
                to: [type: 'COMMIT', value: endCommitHash],
                jira: [
                    issuePattern: '\\b[A-Z]([A-Z]+)-([0-9]+)\\b',
                    password: '$jiraUserPw',
                    server: 'https://my.jira.server/jira/',
                    username: '$jiraUserName'
                    ],
                template: template
        }

The Mustache template I am passing in refers to information from JIRA issues using the {{title}} and {{type}} tags. The Jenkins pipeline "succeeds" but no information is retrieved from JIRA. The master Jenkins log shows the following stack trace:

GET:
/rest/api/2/issue/JIRA-1234?fields=parent,summary,issuetype,labels,description
Oct 01, 2018 11:42:05 AM SEVERE se.bjurr.gitchangelog.internal.integrations.rest.RestClient doGet
Got:
null
java.net.MalformedURLException: no protocol: /rest/api/2/issue/JIRA-1234?fields=parent,summary,issuetype,labels,description
                at java.net.URL.<init>(URL.java:593)
                at java.net.URL.<init>(URL.java:490)
                at java.net.URL.<init>(URL.java:439)
                at se.bjurr.gitchangelog.internal.integrations.rest.RestClient.doGet(RestClient.java:63)
                at se.bjurr.gitchangelog.internal.integrations.rest.RestClient.access$000(RestClient.java:21)
                at se.bjurr.gitchangelog.internal.integrations.rest.RestClient$1.load(RestClient.java:35)
                at se.bjurr.gitchangelog.internal.integrations.rest.RestClient$1.load(RestClient.java:32)
                at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3568)
                at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2350)
                at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2313)
                at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2228)
                at com.google.common.cache.LocalCache.get(LocalCache.java:3965)
                at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3969)
                at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4829)
                at se.bjurr.gitchangelog.internal.integrations.rest.RestClient.get(RestClient.java:52)
                at se.bjurr.gitchangelog.internal.integrations.jira.DefaultJiraClient.getIssue(DefaultJiraClient.java:29)
                at se.bjurr.gitchangelog.internal.issues.IssueParser.createParsedIssue(IssueParser.java:200)
                at se.bjurr.gitchangelog.internal.issues.IssueParser.parseForIssues(IssueParser.java:82)
                at se.bjurr.gitchangelog.api.GitChangelogApi.getChangelog(GitChangelogApi.java:456)
                at se.bjurr.gitchangelog.api.GitChangelogApi.getChangelog(GitChangelogApi.java:77)
                at se.bjurr.gitchangelog.api.GitChangelogApi.render(GitChangelogApi.java:99)
                at se.bjurr.gitchangelog.api.GitChangelogApi.render(GitChangelogApi.java:123)
                at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep.perform(GitChangelogStep.java:404)
                at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep.access$000(GitChangelogStep.java:44)
                at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep$1$1.call(GitChangelogStep.java:322)
                at hudson.FilePath.act(FilePath.java:1163)
                at org.jenkinsci.plugins.gitchangelog.steps.GitChangelogStep$1.run(GitChangelogStep.java:326)
                at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:50)
                at hudson.security.ACL.impersonate(ACL.java:290)
                at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:47)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at java.lang.Thread.run(Thread.java:748)
1
Or, does anybody happen to have an example, or a pointer to an example, of invoking the Git Changelog Plugin with nonempty values for the four "jira" properties -- one that actually works to pull down issue attributes from a JIRA server?newatlantis

1 Answers

0
votes

It turns the syntax I'm using above to invoke the Git Changelog Plugin and interface with JIRA is fine. The problem was that I was running the job on a Jenkins node that did not have access to the company's JIRA server. (The Jenkins node was running in the public cloud.) Once I updated the plan to run the job on a Jenkins node that did have access to the company's JIRA server (on-prem), the plan was able to contact JIRA and pull down attributes of JIRA issues successfully.