job-dsl-core jar版本更新为1.44& githubPullRequest关闭不起作用 [英] job-dsl-core jar version updated to 1.44 & githubPullRequest closure is not working

查看:100
本文介绍了job-dsl-core jar版本更新为1.44& githubPullRequest关闭不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们计划将job-dsl-core版本从1.42更新到1.44,但在最新版本中,不推荐使用pullRequest {}闭包,并使用githubPullRequest {}闭包代替,如迁移文档中所述 https://github.com/jenkinsci/job -dsl-plugin/wiki/Migration#github-pull-request-builder .当我尝试使用上述建议更新我们的代码时,出现以下错误:

We are planning to update job-dsl-core version to 1.44 from 1.42, but in the latest version pullRequest{} closure is deprecated and replaced with githubPullRequest{} closure as detailed in the migration document here https://github.com/jenkinsci/job-dsl-plugin/wiki/Migration#github-pull-request-builder. When I try to update our code with the above recommendation, I am getting following error:

No signature of method: javaposse.jobdsl.dsl.helpers.triggers.TriggerContext.githubpullRequest() is applicable for argument types: (com.xxx.dva.pipeline.generator.utils.JobUtil$_addGithubPullRequestBuilderConfig_closure2_closure22) values: [com.xxx.dva.pipeline.generator.utils.JobUtil$_addGithubPullRequestBuilderConfig_closure2_closure22@7e3918d6]
at sun.reflect.GeneratedConstructorAccessor17.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:198)
at javaposse.jobdsl.dsl.AbstractExtensibleContext.methodMissing(AbstractExtensibleContext.groovy:20)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:830)
at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1128)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1081)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:723)

代码更改为:

1.42版

job.triggers {
        pullRequest {
            admin(JobConstants.GITHUB_PR_ADMIN)
            orgWhitelist(JobConstants.ORG_WHITE_LIST)
            cron('* * * * *')
            permitAll()
            allowMembersOfWhitelistedOrgsAsAdmin()
            triggerPhrase(phrase)
            onlyTriggerPhrase(useTriggerPhrase)
            extensions {
                commitStatus {
                    context('Pull Request Pipeline')
                    triggeredStatus('Build Triggered!')
                    startedStatus('Build Started!')
                    completedStatus('SUCCESS', 'Went green! Go ahead and merge ${ghprbSourceBranch} into ${ghprbTargetBranch}.')
                    completedStatus('FAILURE', 'Something went wrong. Click details!')
                    completedStatus('ERROR', 'Something went really wrong. Click details!')
                }
            }
        }
    }

版本1.44

 job.triggers {
        githubPullRequest {
            admin(JobConstants.GITHUB_PR_ADMIN)
            orgWhitelist(JobConstants.ORG_WHITE_LIST)
            cron('* * * * *')
            permitAll()
            allowMembersOfWhitelistedOrgsAsAdmin()
            triggerPhrase(phrase)
            onlyTriggerPhrase(useTriggerPhrase)
            extensions {
                commitStatus {
                    context('Pull Request Pipeline')
                    triggeredStatus('Build Triggered!')
                    startedStatus('Build Started!')
                    completedStatus('SUCCESS', 'Went green! Go ahead and merge ${ghprbSourceBranch} into ${ghprbTargetBranch}.')
                    completedStatus('FAILURE', 'Something went wrong. Click details!')
                    completedStatus('ERROR', 'Something went really wrong. Click details!')
                }
            }
        }
    }

如何解决此问题?

推荐答案

Job DSL 1.43中已弃用了对GitHub Pull Request Builder插件的内置支持. GitHub Pull Request Builder插件的版本1.29.7或更高版本通过扩展提供了新语法.因此,您需要将GitHub Pull Request Builder插件更新为1.29.7或更高版本.

The built-in support for the GitHub Pull Request Builder plugin has been deprecated in Job DSL 1.43. The new syntax is provided by the version 1.29.7 or later of the GitHub Pull Request Builder plugin through an extension. So you need to update the GitHub Pull Request Builder plugin to 1.29.7 or later.

这篇关于job-dsl-core jar版本更新为1.44& githubPullRequest关闭不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆