Define the Hudson/Jenkins Job to run in build definition programtically
CLM 6.0.2
Here is the code to achieve that, BUT, it is not working. Would appreciate your assistance.
IBuildDefinition definitionWC = (IBuildDefinition)definition.getWorkingCopy(); definition.setConfigurationProperty(HudsonConfigurationElement.ELEMENT_ID, HudsonConfigurationElement.PROPERTY_HUDSON_JOB, "<Jenkins Job Name>"); definitionWC = buildClient.save(definitionWC, new NullProgressMonitor());
Liora |
Accepted answer
Hope you are updating the working copy of the build definition. Looking at the code included in the initial post,
IBuildDefinition definitionWC = (IBuildDefinition)definition.getWorkingCopy(); It should be definitionWC.setConfigurationProperty() and not definition.setConfigurationProperty()
Thanks,
Sridevi
Liora Milbaum selected this answer as the correct answer
Comments
Liora Milbaum
commented Jul 27 '16, 12:16 a.m.
Ohh. Missed that. Checking...
Liora Milbaum
commented Jul 27 '16, 1:05 a.m.
Worked. Thanks. |
2 other answers
Ralph Schoon (63.6k●3●36●46)
| answered Jul 25 '16, 2:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Consider https://www.google.com/search?q=buildClient.save+Jenkins+site:jazz.net the first result.
.....BUT, it is not working.... is not a whole lot of information, really Comments
Liora Milbaum
commented Jul 25 '16, 2:32 a.m.
Ralph, Considered already :-)
I have reason to believe the first argument of setConfigurationProperty function call is not correct.
Hi Liora,
Liora Milbaum
commented Jul 26 '16, 7:40 a.m.
Right. I used the code as you specified.
Still doesn't work :-(
What does "does not work" mean? What errors, what issues in the debugger? See https://jazz.net/forum/questions/203755/how-should-i-ask-a-question-in-the-forum-if-i-want-to-receive-useful-answers for information you should provide. |
The stuck trace:
Exception in thread "main" com.ibm.team.repository.common.internal.ImmutablePropertyException at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2143) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380) at com.ibm.team.build.internal.common.model.impl.ConfigurationPropertyImpl.setValue(ConfigurationPropertyImpl.java:204) at com.ibm.team.build.internal.common.model.impl.BuildDefinitionImpl.setConfigurationProperty(BuildDefinitionImpl.java:1345) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597) at com.sun.proxy.$Proxy20.setConfigurationProperty(Unknown Source) at BuildDefinitionUtils.CreateBuildDefinition(BuildDefinitionUtils.java:41) at RTCBuild.main(RTCBuild.java:30) |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.