Cannot run Job Generator from Freestyle Project when passing multiple parameters

101 views
Skip to first unread message

Ranando King

unread,
Dec 17, 2015, 1:09:28 PM12/17/15
to Jenkins Users
I've tried creating a Freestyle Project with multiple parameters. That works fine.
I've tried creating a Job Generator with multiple generator parameters. That works fine.
I've tried calling the Job Generator from the Freestyle Project passing a single pre-defined parameter (key=value). That works fine.
I've tried calling the Job Generator from the Freestyle Project passing multiple pre-defined parameters. That fails with

Started by upstream project "ADMIN_CreateMobileProjectWorkingBranch" build number 28
originally caused by:
 Started by user Ranando King
[EnvInject] - Loading node environment variables.
[EnvInject] - Preparing an environment for the build.
[EnvInject] - Keeping Jenkins system variables.
[EnvInject] - Keeping Jenkins build variables.
[EnvInject] - Injecting contributions.
Building in workspace /Applications/jenkins-1.638-1/apps/jenkins/jenkins_home/jobs/GENERATOR_Create_BUILD_DEV_Job/workspace@16
FATAL: hudson.model.StringParameterValue cannot be cast to org.jenkinsci.plugins.jobgenerator.parameters.GeneratorKeyValueParameterValue
java.lang.ClassCastException: hudson.model.StringParameterValue cannot be cast to org.jenkinsci.plugins.jobgenerator.parameters.GeneratorKeyValueParameterValue
	at org.jenkinsci.plugins.jobgenerator.GeneratorRun.expand(GeneratorRun.java:164)
	at org.jenkinsci.plugins.jobgenerator.GeneratorRun.getExpandedJobName(GeneratorRun.java:217)
	at org.jenkinsci.plugins.jobgenerator.GeneratorRun$GeneratorImpl.checkParameters(GeneratorRun.java:730)
	at org.jenkinsci.plugins.jobgenerator.GeneratorRun$GeneratorImpl.doRun(GeneratorRun.java:295)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
	at hudson.model.Run.execute(Run.java:1738)
	at org.jenkinsci.plugins.jobgenerator.GeneratorRun.run(GeneratorRun.java:284)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE

I've tried calling the Job Generator from the Freestyle Project using every combination of current build parameters and current generator parameters. They all fail with the same error as before.

Any ideas how to get past this?

Victor Martinez

unread,
Dec 17, 2015, 1:48:08 PM12/17/15
to Jenkins Users
Hi there (beforehand),

 AFAIS there is cast issue when converting a StringParameterValue to GeneratorKeyValueParameterValue, basically it means that script is somehow expecting another kind of input parameter. Can you review your script? It's worth if you gist your script to help you out

Cheers (afterwards)

Ranando King

unread,
Dec 17, 2015, 4:41:35 PM12/17/15
to Jenkins Users
I'm a bit green when it comes to Jenkins. From what I can see, I don't have any scripts in my job that are causing this problem. It only occurs when I try to send multiple parameters to a Job Generator. What I need to be able to do is pass the environment from the current job (a freestyle job) to a job generator job. I did some digging and found this prior jenkins issue that seems to be the same problem, but it was supposedly fixed in 2013. I think it may have been better if GeneratorKeyValueParameterValue instead had a constructor that takes a StringParameterValueParameter as it's only parameter, and use that constructor to create the parameter values instead of trying to downcast the StringParameterValueParameters.
Reply all
Reply to author
Forward
0 new messages