0

我想在我的管道中添加一个流程步骤,从PTC Integrity. Snippet Generator 中有一个用于签入的示例,但它没有正确构建,所以我不能以此为方向。

由于 PTC Integrity 没有正确记录与 SCM Step Plugin 一起使用(尽管根据他们的兼容性列表支持),我不知道如何做到这一点。

我的第一步是找出是否有带有此管道脚本的 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...]

但我不能将此应用于 Integrity。例如,我不知道如何告诉命令我要签出的项目的路径。

4

1 回答 1

0

管道片段生成器工具可用于为管道支持的任何 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])
于 2017-11-16T12:44:44.543 回答