如何从Jenkins管道SCM步骤插件中的PTC Integrity签出

时间:2017-10-10 13:36:24

标签: jenkins jenkins-plugins jenkins-pipeline mks-integrity

我想在我的管道中添加一个流程步骤,从PTC Integrity检出项目。片段生成器中有一个示例用于签入但是它没有正确构建,因此我无法将其用于定位。

由于PTC Integrity未正确记录用于SCM步骤插件(虽然根据其兼容性列表支持),但我不知道如何执行此操作。

我的第一步是找出具有此管道脚本的Integrity SCM类的内容:

node {
   checkout scm: [$class: 'IntegritySCM']
}

按预期抛出IllegalArgumentException

java.lang.IllegalStateException: cannot call getRootUrlFromRequest from outside a request handling thread
at jenkins.model.Jenkins.getRootUrlFromRequest(Jenkins.java:2366)
at hudson.scm.IntegritySCM.<init>(IntegritySCM.java:113)
Caused: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:260)
Caused: java.lang.IllegalArgumentException: Could not instantiate {serverConfig=d917f329-9826-4ffa-8bbd-de68271c4abd} 
for IntegritySCM(browser: IntegrityRepositoryBrowser{IntegrityWebUI(url: String)}, serverConfig: String, userName: String, password: String, configPath: String, includeList: String, 
excludeList: String, cleanCopy: boolean, lineTerminator: String, validCheckpoint: boolean, freezeMembers: boolean, noCheckout: boolean, 
restoreTimestamp: boolean, skipAuthorInfo: boolean, checkpointBeforeBuild: boolean, checkpointLabel: String, 
alternateWorkspace: String, fetchChangedWorkspaceFiles: boolean, deleteNonMembers: boolean, checkoutThreadPoolSize: int, configurationName: String)

由此我可以得出结论,可以为checkout命令提供哪些参数。 现在我的问题是,如何在管道脚本中构建checkout命令?

我在scm step插件的github页面上看到了一个例子,但对于像这样的mercurial:

checkout scm: [$class: 'MercurialSCM', 'source': '....', clean: true...]

但我不能将此应用于诚信。例如。我不知道如何告诉命令我想要结账的项目的路径。

1 个答案:

答案 0 :(得分:0)

管道片段生成器工具可用于为Pipeline支持的任何SCM类生成管道语法。你可以看看这里:https://jenkins.io/blog/2016/05/31/pipeline-snippetizer/

示例管道代码段如下:

checkout([$class: 'IntegritySCM', checkpointBeforeBuild: false, configPath: '\integrity project configuration path\', configurationName: '7fc7dc75-f94e-4cc7-ab57-558f611d0fb8', deleteNonMembers: false, fetchChangedWorkspaceFiles: false, localClient: true, password: '{AQAAABAAAAAQ7YBJmtuzpndmmu/eUEL3v80g/oF3g+lzpM1S1JHkk5E=}', restoreTimestamp: false, serverConfig: '836d9a67-b82d-4cf3-ba06-c4557a18306b', skipAuthorInfo: false])