Hi Mark I tried to run it and got  java.lang.NoSuchMethodError: No such 
DSL method 'nodesByLabel' and a lot more errors  

On Saturday, 10 April 2021 at 21:58:43 UTC+1 Mark Waite wrote:

> The sample that I provided would be placed in a file named 'Jenkinsfile' 
> at the root of a git repository, then a Pipeline job should be defined in 
> Jenkins for that git repository.
>
> On Sat, Apr 10, 2021 at 2:33 PM pe...@pjksolutions.com <
> pe...@pjksolutions.com> wrote:
>
>> Thanks Mark, where do I run that code ?
>>
>> On Tuesday, 6 April 2021 at 21:47:19 UTC+1 Mark Waite wrote:
>>
>>> Yes.  The Jenkins Pipeline can request to build on all available agents 
>>> or on all agents that match a specific label.  See nodesByLabel.
>>>
>>> Here's an example:
>>>
>>> def nodes = nodesByLabel label: '!windows'
>>> nodes = nodes.sort()
>>>
>>> Map tasks = [:]
>>>
>>> for (int i = 0; i < nodes.size(); i++) {
>>>     def label = nodes[i]
>>>     def stageName = 'Check git cache ' + 
>>> label.replaceAll('(-jagent)|(-ssh)|(-mwaite)|(.markwaite.net)|(-beemarkwaite)|(-jenkins)',
>>>  
>>> '')
>>>     tasks[label] = {
>>>         node(label) {
>>>             stage(stageName) {
>>>                 if (isUnix()) {
>>>                     sh '[ -d /var/lib/git/mwaite ] || (echo 
>>> /var/lib/git/mwaite directory not found; exit 1)'
>>>                 } else {
>>>                     bat 'echo git cache check not implemented for 
>>> Windows'
>>>                 }
>>>             }
>>>         }
>>>     }
>>> }
>>>
>>> timeout(time: 3, unit: 'MINUTES') {
>>>     parallel(tasks)
>>> }
>>>
>>> Jenkins multi-configuration jobs can also build on all agents that match 
>>> a particular label, using either the elastic axis plugin or the node label 
>>> parameters plugin.
>>>
>>> Mark Waite
>>>
>>> On Tue, Apr 6, 2021 at 2:36 PM pe...@pjksolutions.com <
>>> pe...@pjksolutions.com> wrote:
>>>
>>>>
>>>> Hi all, I have one master Jenkins CI server and four slaves is is 
>>>> possible to build a project on all agents simultaneously ?
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Jenkins Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to jenkinsci-use...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/jenkinsci-users/e974d160-b2b1-41ca-b23a-5f5ef296831en%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/e974d160-b2b1-41ca-b23a-5f5ef296831en%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/c8f9794a-9ece-4ff2-87db-ebe3b5afb23dn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/c8f9794a-9ece-4ff2-87db-ebe3b5afb23dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d095ae49-0a64-411d-92a0-03756aa24f3dn%40googlegroups.com.

Reply via email to