Reputation: 3
When trying to trigger a local job which has a parameter type of Maven Repository Artifact the job fails to trigger due to the workflow support not correctly mapping to the VersionParameterValue class. Looking at the code in the repository-connector class its trying to instantiate from a colon separated string.
[VersionParameterValue@[name=deploy_number, groupid=com/****/database, artifactid=DB_xya, propertyName=deploy_number, version=1.2.3]]
[Pipeline] build (Building jobname)
Scheduling project: jobname
The parameter 'deploy_number' did not have the type expected by jobname. Converting to Maven Repository Artifact.
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.ArrayIndexOutOfBoundsException: 1
at org.jvnet.hudson.plugins.repositoryconnector.VersionParameterDefinition.createValue(VersionParameterDefinition.java:140)
at org.jenkinsci.plugins.workflow.support.steps.build.BuildTriggerStepExecution.completeDefaultParameters(BuildTriggerStepExecution.java:193)
at org.jenkinsci.plugins.workflow.support.steps.build.BuildTriggerStepExecution.start(BuildTriggerStepExecution.java:101)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:286)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:179)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.run(WorkflowScript:22)
We are using the jenkins 2.222.3 and build step 2.13, all required dependencies met. Running the job on its own works without issue. Looking for clues/workarounds
Which shows us from source in [git hub][1]
@Override
public ParameterValue createValue(String input) {
final String[] tokens = input.split(":");
return new VersionParameterValue(tokens[0], tokens[1], tokens[2], tokens[3]);
}
[1]: https://github.com/jenkinsci/repository-connector-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/repositoryconnector/VersionParameterDefinition.java
Upvotes: 0
Views: 926
Reputation: 56
Yes, ran into the same issue and resolved in pipeline build job by constructing following
string(name:'ARTIFACT_PARAM_ID', value: "<groupId>:<artifactId>:ARTIFACT_PARAM_ID:${pomVersion}")
In the above
ARTIFACT_PARAM_ID
- is the name of the parameter in the job we are trying to trigger${pomVersion}
is the environment variable we set earlier in pipeline, you can replace this with the version you want to pass a parameter<groupId>
replace this with group id of the artifact (we chose it to be same as what's in the parameter in the job we are trying to trigger)<artifactId>
- replace this with artifact id (we chose it to be same as what's in the parameter in the job we are trying to trigger)Upvotes: 3