Re: Creating 2 pipelines in a single jenkinsfile

2019-01-10 Thread Faad Sayaou
Hi everyone. thank you all for your wonderful replies.
First of all, I will like to have a two separate pipelines in order to 
manage builds from feature branches as well as to make sure the right and 
stable version is uploaded to my nexus repository. I tried Denis's approach 
by creating two separate pipelines and copy build results from the first to 
the second if stable, but I had problems doing this because I am still new 
in jenkins. 
 could you suggest how this can be done?

On Thursday, 10 January 2019 20:11:48 UTC+1, Adrien Lecharpentier wrote:
>
> I agree with Arnaud. 
>
> However, having an input means that if you cancel the input, you'll have 
> aborted the build. So, even if the first 3 steps are successful, you'll 
> have an aborted build.
>
> You could try/catch the input, but that will complexify the pipeline imo.
>
> Could you explain why you need to conditionally upload the results and not 
> doing it each time it's successful? If you have some concerns about the 
> "space usage", you could make sure to replace the same package each time, 
> or configure nexus to have some cleanup tasks. 
>
> Le jeu. 10 janv. 2019 à 19:49, Arnaud bourree  > a écrit :
>
>> Hi,
>>
>> Denis answer is good but why are you doing that?
>> You said if pipeline #1 succeed, you run pipeline #2 which redo same 
>> steps including git checkout then push result to nexus. 
>> But you don't have guarantee that git checkout will fetch same source 
>> code. 
>> Why not add input validation on nexus stage in single pipeline?
>>
>> Arnaud 
>>
>> Le jeu. 10 janv. 2019 à 17:54, Denis > a 
>> écrit :
>>
>>> You can create two pipeline jobs and have the first one trigger the 
>>> second one as a downstream job.
>>> i.e in a finally block you can check the result of the build and trigger 
>>> the pipeline that publish to nexus 
>>>
>>> On January 10, 2019 5:30:03 PM GMT+02:00, Faad Sayaou >> > wrote:

 I was thinking maybe doing something like this would help but 
 unfortunately not

 node {
 stages

 }

 node2 {

 stages

 }


 but it is viewed by jenkins as a single pipeline. I am using the 
 scripted pipeline syntax

 On Thursday, 10 January 2019 16:25:11 UTC+1, Faad Sayaou wrote:
>
> Hi everyone,
> I have this scenario i would like to implement but i don not know if 
> that is possible within a single jenkinsfile.
> My idea was to have 2 pipelines
>
> 1st pipeline
>  -git checkout
>  -build
>  -Test
>
> 2nd pipeline
>
> if first build from the first pipeline was successful, then
>
> -re-do the first 3 stages from 1st pipeline
> -zip the build results
> -and push to nexus
>
> ..is this however feasible within a single jenkinsfile?
>
> thanks
>
>
>>> -- 
>>> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>>>
>>> -- 
>>> 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/97F68F8F-DB51-4C09-B894-D8A57A30DFB0%40gmail.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
>> 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/CAESUf_AYVtmQN%2BhinWSB-DgLtZ3QKTHYn0woYeEHQLfEwiBw4Q%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Adrien Lecharpentier
>

-- 
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/29186f5a-c024-4f72-a474-1ebc95e23594%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating 2 pipelines in a single jenkinsfile

2019-01-10 Thread Adrien Lecharpentier
I agree with Arnaud.

However, having an input means that if you cancel the input, you'll have
aborted the build. So, even if the first 3 steps are successful, you'll
have an aborted build.

You could try/catch the input, but that will complexify the pipeline imo.

Could you explain why you need to conditionally upload the results and not
doing it each time it's successful? If you have some concerns about the
"space usage", you could make sure to replace the same package each time,
or configure nexus to have some cleanup tasks.

Le jeu. 10 janv. 2019 à 19:49, Arnaud bourree  a
écrit :

> Hi,
>
> Denis answer is good but why are you doing that?
> You said if pipeline #1 succeed, you run pipeline #2 which redo same steps
> including git checkout then push result to nexus.
> But you don't have guarantee that git checkout will fetch same source
> code.
> Why not add input validation on nexus stage in single pipeline?
>
> Arnaud
>
> Le jeu. 10 janv. 2019 à 17:54, Denis  a écrit :
>
>> You can create two pipeline jobs and have the first one trigger the
>> second one as a downstream job.
>> i.e in a finally block you can check the result of the build and trigger
>> the pipeline that publish to nexus
>>
>> On January 10, 2019 5:30:03 PM GMT+02:00, Faad Sayaou 
>> wrote:
>>>
>>> I was thinking maybe doing something like this would help but
>>> unfortunately not
>>>
>>> node {
>>> stages
>>>
>>> }
>>>
>>> node2 {
>>>
>>> stages
>>>
>>> }
>>>
>>>
>>> but it is viewed by jenkins as a single pipeline. I am using the
>>> scripted pipeline syntax
>>>
>>> On Thursday, 10 January 2019 16:25:11 UTC+1, Faad Sayaou wrote:

 Hi everyone,
 I have this scenario i would like to implement but i don not know if
 that is possible within a single jenkinsfile.
 My idea was to have 2 pipelines

 1st pipeline
  -git checkout
  -build
  -Test

 2nd pipeline

 if first build from the first pipeline was successful, then

 -re-do the first 3 stages from 1st pipeline
 -zip the build results
 -and push to nexus

 ..is this however feasible within a single jenkinsfile?

 thanks


>> --
>> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>>
>> --
>> 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/97F68F8F-DB51-4C09-B894-D8A57A30DFB0%40gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/CAESUf_AYVtmQN%2BhinWSB-DgLtZ3QKTHYn0woYeEHQLfEwiBw4Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Adrien Lecharpentier

-- 
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/CAKwJSvz1pHn5n6MDDQMN7q6a0QXRhzZ5zKgznv5gq9Ru3v7sVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating 2 pipelines in a single jenkinsfile

2019-01-10 Thread Arnaud bourree
Hi,

Denis answer is good but why are you doing that?
You said if pipeline #1 succeed, you run pipeline #2 which redo same steps
including git checkout then push result to nexus.
But you don't have guarantee that git checkout will fetch same source code.
Why not add input validation on nexus stage in single pipeline?

Arnaud

Le jeu. 10 janv. 2019 à 17:54, Denis  a écrit :

> You can create two pipeline jobs and have the first one trigger the second
> one as a downstream job.
> i.e in a finally block you can check the result of the build and trigger
> the pipeline that publish to nexus
>
> On January 10, 2019 5:30:03 PM GMT+02:00, Faad Sayaou 
> wrote:
>>
>> I was thinking maybe doing something like this would help but
>> unfortunately not
>>
>> node {
>> stages
>>
>> }
>>
>> node2 {
>>
>> stages
>>
>> }
>>
>>
>> but it is viewed by jenkins as a single pipeline. I am using the scripted
>> pipeline syntax
>>
>> On Thursday, 10 January 2019 16:25:11 UTC+1, Faad Sayaou wrote:
>>>
>>> Hi everyone,
>>> I have this scenario i would like to implement but i don not know if
>>> that is possible within a single jenkinsfile.
>>> My idea was to have 2 pipelines
>>>
>>> 1st pipeline
>>>  -git checkout
>>>  -build
>>>  -Test
>>>
>>> 2nd pipeline
>>>
>>> if first build from the first pipeline was successful, then
>>>
>>> -re-do the first 3 stages from 1st pipeline
>>> -zip the build results
>>> -and push to nexus
>>>
>>> ..is this however feasible within a single jenkinsfile?
>>>
>>> thanks
>>>
>>>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
> --
> 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/97F68F8F-DB51-4C09-B894-D8A57A30DFB0%40gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAESUf_AYVtmQN%2BhinWSB-DgLtZ3QKTHYn0woYeEHQLfEwiBw4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating 2 pipelines in a single jenkinsfile

2019-01-10 Thread Denis
You can create two pipeline jobs and have the first one trigger the second one 
as a downstream job.
i.e in a finally block you can check the result of the build and trigger the 
pipeline that publish to nexus 

On January 10, 2019 5:30:03 PM GMT+02:00, Faad Sayaou  wrote:
>I was thinking maybe doing something like this would help but
>unfortunately 
>not
>
>node {
>stages
>
>}
>
>node2 {
>
>stages
>
>}
>
>
>but it is viewed by jenkins as a single pipeline. I am using the
>scripted 
>pipeline syntax
>
>On Thursday, 10 January 2019 16:25:11 UTC+1, Faad Sayaou wrote:
>>
>> Hi everyone,
>> I have this scenario i would like to implement but i don not know if
>that 
>> is possible within a single jenkinsfile.
>> My idea was to have 2 pipelines
>>
>> 1st pipeline
>>  -git checkout
>>  -build
>>  -Test
>>
>> 2nd pipeline
>>
>> if first build from the first pipeline was successful, then
>>
>> -re-do the first 3 stages from 1st pipeline
>> -zip the build results
>> -and push to nexus
>>
>> ..is this however feasible within a single jenkinsfile?
>>
>> thanks
>>
>>
>
>-- 
>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/0a680aab-e762-45f4-bd74-7098f5977afa%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
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/97F68F8F-DB51-4C09-B894-D8A57A30DFB0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating 2 pipelines in a single jenkinsfile

2019-01-10 Thread Faad Sayaou
I was thinking maybe doing something like this would help but unfortunately 
not

node {
stages

}

node2 {

stages

}


but it is viewed by jenkins as a single pipeline. I am using the scripted 
pipeline syntax

On Thursday, 10 January 2019 16:25:11 UTC+1, Faad Sayaou wrote:
>
> Hi everyone,
> I have this scenario i would like to implement but i don not know if that 
> is possible within a single jenkinsfile.
> My idea was to have 2 pipelines
>
> 1st pipeline
>  -git checkout
>  -build
>  -Test
>
> 2nd pipeline
>
> if first build from the first pipeline was successful, then
>
> -re-do the first 3 stages from 1st pipeline
> -zip the build results
> -and push to nexus
>
> ..is this however feasible within a single jenkinsfile?
>
> thanks
>
>

-- 
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/0a680aab-e762-45f4-bd74-7098f5977afa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Creating 2 pipelines in a single jenkinsfile

2019-01-10 Thread Faad Sayaou
Hi everyone,
I have this scenario i would like to implement but i don not know if that 
is possible within a single jenkinsfile.
My idea was to have 2 pipelines

1st pipeline
 -git checkout
 -build
 -Test

2nd pipeline

if first build from the first pipeline was successful, then

-re-do the first 3 stages from 1st pipeline
-zip the build results
-and push to nexus

..is this however feasible within a single jenkinsfile?

thanks

-- 
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/a301358d-d689-4a19-b5ba-b4cf0efd9043%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.