与JIRA交谈时,Jenkins Git Changelog插件抛出“无协议”错误

时间:2018-10-02 19:30:40

标签: git jenkins jenkins-plugins jira

我正在尝试弄清楚如何从Git Changelog Plugin的JIRA服务器中提取问题信息。但是我收到这样的“无协议”错误:

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

详细信息如下。有人碰巧看到我在做什么错吗?

研究:搜索StackOverflow的“ jenkins git changelog插件与jira对话无协议错误”时,搜索结果为零。我对“ jenkins git changelog插件无协议”一炮走红,但似乎并不相关。我似乎找不到在在线上任何地方通过具有JIRA集成的脚本管道调用Git Changelog插件的具体示例。

详细信息

我正在使用以下语法从Jenkins v2.144管道调用Git Changelog插件v2.11:

        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
        }

我要传递的Mustache模板使用{{title}}和{{type}}标签引用JIRA问题中的信息。 Jenkins管道“成功”,但是没有从JIRA检索到任何信息。 Jenkins主日志显示以下堆栈跟踪:

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 个答案:

答案 0 :(得分:0)

它变成了我上面用来调用Git Changelog插件的语法,并且与JIRA的接口还不错。问题是我正在无法访问公司JIRA服务器的Jenkins节点上运行该作业。 (Jenkins节点正在公共云中运行。)一旦我更新了在可以访问公司JIRA服务器(本地)的Jenkins节点上运行作业的计划,该计划就可以联系JIRA并撤消JIRA问题的属性成功。