[pipeline][exclusion-plugin] Trying to make exclusion-plugin work with pipeline-plugin

219 views
Skip to first unread message

Pierre Lerouge

unread,
Mar 22, 2016, 12:16:53 PM3/22/16
to Jenkins Developers
Hi,  
I'm trying to make the exclusion-plugin (https://github.com/jenkinsci/exclusion-plugin) work with the pipeline plugin, 
That's the first time I do this.

So far I've been able to call the exclusion plugin like this : 

id = new org.jvnet.hudson.plugins.exclusion.DefaultIdType('test');
 wrap
([$class: 'IdAllocator',ids:[id]]){
    step
([$class: 'CriticalBlockStart'])
    etc
....
}


the first issue was that this plugin use the environment variable to pass the allocated resources : (CriticalBlockStart.java) : 
EnvVars environment = run.getEnvironment(taskListener);
final List<String> listId = new ArrayList<String>();
// Add to a list all "variableEnv" (which are added by IdAllocator)
// Each variableEnv is a resource
for (Entry<String, String> e: environment.entrySet()) {
   
String cle = e.getKey();
   
String name = "variableEnv" + run.getParent().getName();
   
if (cle.contains(name)) {
       
String value = e.getValue();
       listId
.add(value);
   
}
}


The problem was that for the moment the SimpleBuildStep does not provide an EnvVar as a parameter like the SimpleBuildWrapper (JENKINS-29144)

So I'm trying to play on a file that could pass informations (key=value) from the wrapper to the buildstep, 
I'm thinking of writting a configuration file on the master written by the wrapper that would be read by simplebuildstep. But I don't really know where to start.

If you have any suggestion on how to transmit the information from the wrapper to the simpleBuildStep without beeing able to read the EnvVars.

Thank you for your help.

Regards, 
Pierre LEROUGE

Jesse Glick

unread,
Mar 22, 2016, 12:32:49 PM3/22/16
to Jenkins Dev
On Tue, Mar 22, 2016 at 12:16 PM, Pierre Lerouge
<lerouge...@gmail.com> wrote:
> id = new org.jvnet.hudson.plugins.exclusion.DefaultIdType('test');

You should not need to call into plugin classes directly like this.
_Snippet Generator_ ought to give you the recommended syntax.

Does https://github.com/jenkinsci/exclusion-plugin/pull/5 not already
purport to do this?

Pierre Lerouge

unread,
Mar 22, 2016, 1:09:28 PM3/22/16
to jenkin...@googlegroups.com
sadly https://github.com/jenkinsci/exclusion-plugin/pull/5 does not seems to be a full support of the workflow plugin.
Since the Snippet Generator does not list the exclusion-plugin as a wrapper or as a build step.
Thank's for your awnsers.




--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/Uuwqv1leO0A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1gFWdq7APOP6Y%2B%2B3RXXtDDgu3W3NZQoxfGL5fsPTpbew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Glick

unread,
Mar 22, 2016, 4:25:10 PM3/22/16
to Jenkins Dev
On Tue, Mar 22, 2016 at 1:08 PM, Pierre Lerouge
<lerouge...@gmail.com> wrote:
> https://github.com/jenkinsci/exclusion-plugin/pull/5 does not seems to
> be a full support of the workflow plugin.
> Since the Snippet Generator does not list the exclusion-plugin as a wrapper
> or as a build step.

`IdAllocator` should be listed under the `wrap` step;
`CriticalBlockStart` and `CriticalBlockEnd` should be listed under the
`step` step.

Volker Gropp

unread,
Jul 19, 2016, 4:17:55 AM7/19/16
to Jenkins Developers

Hi,
`CriticalBlockStart` and `CriticalBlockEnd` is listed under the 'step' step, but 'IdAllocator' is missing here under 'wrap'. Im using Jenkins ver. 2.7.1 with Exclusion Plugin 0.12 as well as under Jenkins 2.13. I know about
https://github.com/jenkinsci/lockable-resources-plugin/pull/25 but i would like to continue to use the exclusion plugin for older jobs. Is there any help or example for the IdAllocator wrap step?

Thanks for your help.

Volker Gropp
Reply all
Reply to author
Forward
0 new messages