How to checkout from PTC Integrity in Jenkins Pipeline SCM Step Plugin

941 Views Asked by At

I want to add a process step in my pipeline, that checks out a project from PTC Integrity. There is a example in the Snippet Generator for a checkin but it is not built correctly, so I can not take this for orientation.

As PTC Integrity is not properly documented for the use with SCM Step Plugin (although supported according to their compability list) I have no idea how to do this.

My first step was to Find out what if there is a Integrity SCM class with this pipeline script:

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

This throws as expected an 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)

From this I can conclude which arguments can be given for the checkout command. Now my question is, how can I build the checkout command in the pipeline script?

I saw an example on the github page of the scm step plugin but for mercurial which does it like this:

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

But I can't apply this to Integrity. E.g. I don't know how to tell the command the path of the project I want to checkout.

1

There are 1 best solutions below

0
On

The pipeline snippet generator tool can be used to generate a pipeline syntax for any SCM classes supported by Pipeline. You can take a look here: https://jenkins.io/blog/2016/05/31/pipeline-snippetizer/

A sample pipeline snippet is something like this:

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])