Matrix in Pipelines

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Matrix in Pipelines

roland.asmann
Hey everybody,

I have this job, written as a declarative pipeline, the now needs to be run on 2 nodes instead of just 1. Before, I would use the Matrix-Job for that, but I am not quite sure how to do this in my pipeline...
I searched around a bit and found some example on how to do it with a scripted pipeline, but I would prefer to stick to the declarative format -- if possible. The reason for that is that my team is just learning about pipelines and have just about mastered declarative. I don't want to throw them in the deep end for scripted yet.

Is this possible in declarative? If so, tips would be helpful.
If not, at least 1 reply telling me this would also be helpful! ;-)

Thanks,
Roland

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8ebffe59-9ac7-489a-9bf1-388d77ea7289n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Matrix in Pipelines

Jan Monterrubio
Could you do a job that takes a Node parameter and then a job with 2 stages, one for each node that just calls the first job?

On Sun, Oct 18, 2020 at 11:24 Roland Asmann <[hidden email]> wrote:
Hey everybody,

I have this job, written as a declarative pipeline, the now needs to be run on 2 nodes instead of just 1. Before, I would use the Matrix-Job for that, but I am not quite sure how to do this in my pipeline...
I searched around a bit and found some example on how to do it with a scripted pipeline, but I would prefer to stick to the declarative format -- if possible. The reason for that is that my team is just learning about pipelines and have just about mastered declarative. I don't want to throw them in the deep end for scripted yet.

Is this possible in declarative? If so, tips would be helpful.
If not, at least 1 reply telling me this would also be helpful! ;-)

Thanks,
Roland

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8ebffe59-9ac7-489a-9bf1-388d77ea7289n%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9Lz-q4NRxChqOoy7L4JhkrXxS5q8kqoP-i5WJ0_v%3Dp5Nw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Matrix in Pipelines

christop...@googlemail.com
In reply to this post by roland.asmann
Hi,

I don't exactly understand your problem. Please have a look here:
https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/

you very easily can integrate matrix in a declarative pipeline. Insert your nodes as an axis of the matrix and add an 'agent' in the stage doing your job.

But maybe I missed a point somewhere...


Roland Asmann schrieb am Sonntag, 18. Oktober 2020 um 18:23:48 UTC+2:
Hey everybody,

I have this job, written as a declarative pipeline, the now needs to be run on 2 nodes instead of just 1. Before, I would use the Matrix-Job for that, but I am not quite sure how to do this in my pipeline...
I searched around a bit and found some example on how to do it with a scripted pipeline, but I would prefer to stick to the declarative format -- if possible. The reason for that is that my team is just learning about pipelines and have just about mastered declarative. I don't want to throw them in the deep end for scripted yet.

Is this possible in declarative? If so, tips would be helpful.
If not, at least 1 reply telling me this would also be helpful! ;-)

Thanks,
Roland

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Matrix in Pipelines

roland.asmann
Hi,

Thanks for that. I see I forgot to mention something in my original
post: The nodes I want to run my job on should come from a label. So I
would need to get the 'values' in the matrix-part by figuring out which
nodes have this label set...

Can I add a simple 1-, maybe 2-line script block in my pipeline to
retrieve those values and use them?


On 19.10.2020 9:45, '[hidden email]' via Jenkins Users wrote:

> Hi,
>
> I don't exactly understand your problem. Please have a look here:
> https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/
>
> you very easily can integrate matrix in a declarative pipeline. Insert
> your nodes as an axis of the matrix and add an 'agent' in the stage
> doing your job.
>
> But maybe I missed a point somewhere...
>
>
> Roland Asmann schrieb am Sonntag, 18. Oktober 2020 um 18:23:48 UTC+2:
>
>     Hey everybody,
>
>     I have this job, written as a declarative pipeline, the now needs to
>     be run on 2 nodes instead of just 1. Before, I would use the
>     Matrix-Job for that, but I am not quite sure how to do this in my
>     pipeline...
>     I searched around a bit and found some example on how to do it with
>     a scripted pipeline, but I would prefer to stick to the declarative
>     format -- if possible. The reason for that is that my team is just
>     learning about pipelines and have just about mastered declarative. I
>     don't want to throw them in the deep end for scripted yet.
>
>     Is this possible in declarative? If so, tips would be helpful.
>     If not, at least 1 reply telling me this would also be helpful! ;-)
>
>     Thanks,
>     Roland
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe <https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
> [hidden email]
> <mailto:[hidden email]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com 
> <https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3276e41f-55ad-e86d-28d8-89f8f7e8f2d9%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Matrix in Pipelines

christop...@googlemail.com
You mean something like a dynamic axis created by a piece of script? I had a similar issue in the past and did not find a way.
There might be something with script blocks in a pipeline and dynamic stage-creation with a for-loop.
When I remember right I found some examples with google when I investigated this.

Roland Asmann schrieb am Montag, 19. Oktober 2020 um 10:16:51 UTC+2:
Hi,

Thanks for that. I see I forgot to mention something in my original
post: The nodes I want to run my job on should come from a label. So I
would need to get the 'values' in the matrix-part by figuring out which
nodes have this label set...

Can I add a simple 1-, maybe 2-line script block in my pipeline to
retrieve those values and use them?


On 19.10.2020 9:45, '[hidden email]' via Jenkins Users wrote:

> Hi,
>
> I don't exactly understand your problem. Please have a look here:
> https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/
>
> you very easily can integrate matrix in a declarative pipeline. Insert
> your nodes as an axis of the matrix and add an 'agent' in the stage
> doing your job.
>
> But maybe I missed a point somewhere...
>
>
> Roland Asmann schrieb am Sonntag, 18. Oktober 2020 um 18:23:48 UTC+2:
>
> Hey everybody,
>
> I have this job, written as a declarative pipeline, the now needs to
> be run on 2 nodes instead of just 1. Before, I would use the
> Matrix-Job for that, but I am not quite sure how to do this in my
> pipeline...
> I searched around a bit and found some example on how to do it with
> a scripted pipeline, but I would prefer to stick to the declarative
> format -- if possible. The reason for that is that my team is just
> learning about pipelines and have just about mastered declarative. I
> don't want to throw them in the deep end for scripted yet.
>
> Is this possible in declarative? If so, tips would be helpful.
> If not, at least 1 reply telling me this would also be helpful! ;-)
>
> Thanks,
> Roland
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe <https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
> [hidden email]
> <mailto:[hidden email]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/12a60d25-485a-4cf3-a237-a45a470ba959n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Matrix in Pipelines

roland.asmann
Thanks for the replies. I went with hard-coding the 2 nodes, in the
hopes that at some point the matrix will allow use of variables for the
value.

On 19.10.2020 12:27, '[hidden email]' via Jenkins Users wrote:

> You mean something like a dynamic axis created by a piece of script? I
> had a similar issue in the past and did not find a way.
> There might be something with script blocks in a pipeline and dynamic
> stage-creation with a for-loop.
> When I remember right I found some examples with google when I
> investigated this.
>
> Roland Asmann schrieb am Montag, 19. Oktober 2020 um 10:16:51 UTC+2:
>
>     Hi,
>
>     Thanks for that. I see I forgot to mention something in my original
>     post: The nodes I want to run my job on should come from a label. So I
>     would need to get the 'values' in the matrix-part by figuring out which
>     nodes have this label set...
>
>     Can I add a simple 1-, maybe 2-line script block in my pipeline to
>     retrieve those values and use them?
>
>
>     On 19.10.2020 9:45, '[hidden email]' via Jenkins Users
>     wrote:
>      > Hi,
>      >
>      > I don't exactly understand your problem. Please have a look here:
>      > https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/
>     <https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/>
>      >
>      > you very easily can integrate matrix in a declarative pipeline.
>     Insert
>      > your nodes as an axis of the matrix and add an 'agent' in the stage
>      > doing your job.
>      >
>      > But maybe I missed a point somewhere...
>      >
>      >
>      > Roland Asmann schrieb am Sonntag, 18. Oktober 2020 um 18:23:48
>     UTC+2:
>      >
>      > Hey everybody,
>      >
>      > I have this job, written as a declarative pipeline, the now needs to
>      > be run on 2 nodes instead of just 1. Before, I would use the
>      > Matrix-Job for that, but I am not quite sure how to do this in my
>      > pipeline...
>      > I searched around a bit and found some example on how to do it with
>      > a scripted pipeline, but I would prefer to stick to the declarative
>      > format -- if possible. The reason for that is that my team is just
>      > learning about pipelines and have just about mastered declarative. I
>      > don't want to throw them in the deep end for scripted yet.
>      >
>      > Is this possible in declarative? If so, tips would be helpful.
>      > If not, at least 1 reply telling me this would also be helpful! ;-)
>      >
>      > Thanks,
>      > Roland
>      >
>      > --
>      > You received this message because you are subscribed to a topic
>     in the
>      > Google Groups "Jenkins Users" group.
>      > To unsubscribe from this topic, visit
>      >
>     https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe
>     <https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe>
>     <https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe
>     <https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe>>.
>
>      > To unsubscribe from this group and all its topics, send an email to
>      > [hidden email]
>      > <mailto:[hidden email]>.
>      > To view this discussion on the web visit
>      >
>     https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com
>     <https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com>
>
>      >
>     <https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com?utm_medium=email&utm_source=footer
>     <https://groups.google.com/d/msgid/jenkinsci-users/5d806b70-3cab-463e-a27f-097daaa3679en%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>     --
>     This email has been checked for viruses by Avast antivirus software.
>     https://www.avast.com/antivirus <https://www.avast.com/antivirus>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe <https://groups.google.com/d/topic/jenkinsci-users/DLoPOi8U5NI/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
> [hidden email]
> <mailto:[hidden email]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/12a60d25-485a-4cf3-a237-a45a470ba959n%40googlegroups.com 
> <https://groups.google.com/d/msgid/jenkinsci-users/12a60d25-485a-4cf3-a237-a45a470ba959n%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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/84d3c0cf-b80e-7067-5d15-db7580583a8b%40gmail.com.