Re: Jenkins global metrics

2018-09-27 Thread gotviseryon
Hi Rajendra.  Thank you so much for this news.  Would really appreciate 
help on implementing this.  Could you please guide me through?

On Thursday, September 27, 2018 at 9:44:16 PM UTC-4, rajendraprasad reddy 
wrote:
>
> Hi ,
> I did similar implementation for monitoring my Jenkins instance. But I 
> never used a plugin to do that , instead of plugins I used groovy script to 
> prepare mail body content and sending this mail body to intended recipient 
> list.
> Using groovy it is possible to get any information of Jenkins using 
> Jenkins API calls.
>
> Let me know you need further help in implementing this procedure.
>
> Thanks,
> Rajendra
>
> On Thu 27 Sep, 2018, 5:58 PM , > wrote:
>
>> Any help on this.  Little urgent.
>>
>> On Wednesday, September 26, 2018 at 3:29:23 PM UTC-4, gotvi...@gmail.com 
>> wrote:
>>>
>>> I'm looking to generate a report, as a job, which will provide the 
>>> global metrics of my Jenkins instance.  I need details in the report like 
>>> (1) How many jobs ran? (2) # of failed and successful jobs and every 
>>> possible metrics possible in one report.  I need to send this report every 
>>> week to my management, so would like to know if it's possible to schedule a 
>>> job to run this report every Friday and send the metrics by email to my 
>>> managers?  I found these two plugins - '*Global Build Status*' and '*Build 
>>> Metrics*'.  But not able to use these as part of a job, download the 
>>> report or email a link to the report or nothing of that sort.  Please help.
>>>
>> -- 
>> 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/b90c4f44-cae0-4c29-bdb1-2d9ceb0e1736%40googlegroups.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/42f25477-6bdc-485e-95a9-466833637c9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread RAJENDRA PRASAD
Hi ,
I did similar implementation for monitoring my Jenkins instance. But I
never used a plugin to do that , instead of plugins I used groovy script to
prepare mail body content and sending this mail body to intended recipient
list.
Using groovy it is possible to get any information of Jenkins using Jenkins
API calls.

Let me know you need further help in implementing this procedure.

Thanks,
Rajendra

On Thu 27 Sep, 2018, 5:58 PM ,  wrote:

> Any help on this.  Little urgent.
>
> On Wednesday, September 26, 2018 at 3:29:23 PM UTC-4, gotvi...@gmail.com
> wrote:
>>
>> I'm looking to generate a report, as a job, which will provide the global
>> metrics of my Jenkins instance.  I need details in the report like (1) How
>> many jobs ran? (2) # of failed and successful jobs and every possible
>> metrics possible in one report.  I need to send this report every week to
>> my management, so would like to know if it's possible to schedule a job to
>> run this report every Friday and send the metrics by email to my managers?
>> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.
>> But not able to use these as part of a job, download the report or email a
>> link to the report or nothing of that sort.  Please help.
>>
> --
> 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/b90c4f44-cae0-4c29-bdb1-2d9ceb0e1736%40googlegroups.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/CAMrg02Qhh814e4bQxug25kefhxeE-OOWoWB-kOgKA%2BgYQi5%3Dbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread RAJENDRA PRASAD
I am on the way to office , after reaching to office I can provide you
sample groovy script and required configuration I can share with you.
With that info you can implement in time.

Thanks,
rajendra

On 28-Sep-2018 8:21 AM,  wrote:

Hi Rajendra.  Thank you so much for this news.  Would really appreciate
help on implementing this.  Could you please guide me through?


On Thursday, September 27, 2018 at 9:44:16 PM UTC-4, rajendraprasad reddy
wrote:

> Hi ,
> I did similar implementation for monitoring my Jenkins instance. But I
> never used a plugin to do that , instead of plugins I used groovy script to
> prepare mail body content and sending this mail body to intended recipient
> list.
> Using groovy it is possible to get any information of Jenkins using
> Jenkins API calls.
>
> Let me know you need further help in implementing this procedure.
>
> Thanks,
> Rajendra
>
> On Thu 27 Sep, 2018, 5:58 PM ,  wrote:
>
>> Any help on this.  Little urgent.
>>
>> On Wednesday, September 26, 2018 at 3:29:23 PM UTC-4, gotvi...@gmail.com
>> wrote:
>>>
>>> I'm looking to generate a report, as a job, which will provide the
>>> global metrics of my Jenkins instance.  I need details in the report like
>>> (1) How many jobs ran? (2) # of failed and successful jobs and every
>>> possible metrics possible in one report.  I need to send this report every
>>> week to my management, so would like to know if it's possible to schedule a
>>> job to run this report every Friday and send the metrics by email to my
>>> managers?  I found these two plugins - '*Global Build Status*' and '*Build
>>> Metrics*'.  But not able to use these as part of a job, download the
>>> report or email a link to the report or nothing of that sort.  Please help.
>>>
>> --
>> 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/b90c4f44-cae0-4c29-bdb1-2d9ceb0e1736%40googlegroups.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/42f25477-6bdc-485e-95a9-466833637c9f%40googlegroups.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/CAMrg02TcYSkBMq9AyUxtN1Moom1YORctehDMpvjX%2Bg9FuZ_TNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Windows 10 node and ssh-slave plugin

2018-09-27 Thread Christophe Demarey
Hi,

Thanks a lot for this information. Very useful.
I’ll give you feedback once I tested that.

Christophe.

> Le 26 sept. 2018 à 19:38, Ivan Fernandez Calvo  a 
> écrit :
> 
> HI,
> 
> Take a look to https://issues.jenkins-ci.org/browse/JENKINS-42856 
>  I think that it is the 
> same issue, there is a workaround, see my last comments, It does not work I 
> can help you on that issue.
> 
> El martes, 25 de septiembre de 2018, 21:39:49 (UTC+2), christoph...@inria.fr 
>  escribió:
> Hello,
> 
> I would like to know if the ssh-slave plugin is supposed to work to run the 
> slave agent on a Windows 10 node with Open SSH (Microsoft port)?
> I tried but I got some issues:
> 1/ the plugin assumes a command named true exists for the shell being 
> executed (ok for bash but not for cmd, the shell being launched on Windows). 
> A workaround is to create a true.bat file having the expected behaviour, e.g. 
> @%COMSPEC% /C exit 1 >nul
> 2/ the plugin then tries to run the java command to determine Java version 
> but, even if the java executable is in the Windows PATH, the plugin does not 
> find it. Same workaround here: create a java.bat file that runs jave with an 
> absolute path.
> 3/ The last problem I’m not able to solve is an exception during the launch 
> of the slave agent (stacktrace below):
> java.io.IOException: Unexpected termination of the channel
> 
> Any idea of what could be wrong?
> 
> Best regards,
> Christophe.
> 
> StackTrace:
> [09/25/18 20:45:55] [SSH] Checking java version of java
> [09/25/18 20:45:56] [SSH] java -version returned 1.8.0_181.
> [09/25/18 20:45:56] [SSH] Starting sftp client.
> [09/25/18 20:45:56] [SSH] Copying latest slave.jar...
> [09/25/18 20:45:56] [SSH] Copied 745,674 bytes.
> Expanded the channel window size to 4MB
> [09/25/18 20:45:56] [SSH] Starting slave process: cd "c:\builds" && java  
> -jar slave.jar
> <===[JENKINS REMOTING CAPACITY]===>
> ci@DESKTOP-IG838MJ c:\builds>"C:\Program Files (x86)\Common 
> Files\Oracle\Java\javapath\java.exe" -jar slave.jar 
> <===[JENKINS REMOTING CAPACITY]===>ERROR: Connection terminated
> ERROR: Unexpected error in launching a slave. This is probably a bug in 
> Jenkins.
> hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected 
> termination of the channel
>   at hudson.remoting.Request.abort(Request.java:329)
>   at hudson.remoting.Channel.terminate(Channel.java:992)
>   at 
> hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:96)
>   Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to 
> win10
>   at 
> hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1693)
>   at hudson.remoting.Request.call(Request.java:192)
>   at hudson.remoting.Channel.call(Channel.java:907)
>   at 
> hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:546)
>   at 
> hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:413)
>   at 
> hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:1110)
>   at 
> hudson.plugins.sshslaves.SSHLauncher.access$500(SSHLauncher.java:148)
>   at 
> hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:845)
>   at 
> hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:820)
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>   at java.lang.Thread.run(Thread.java:748)
> Caused by: java.io.IOException: Unexpected termination of the channel
> java.io.EOFException
>   at 
> java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2675)
>   at 
> java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3150)
>   at 
> java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:859)
>   at java.io.ObjectInputStream.(ObjectInputStream.java:355)
>   at 
> hudson.remoting.ObjectInputStreamEx.(ObjectInputStreamEx.java:48)
>   at 
> hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35)
>   at 
> hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:63)
> Caused: java.io.IOException: Unexpected termination of the channel
>   at 
> hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:77)
>   at 
> hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:77)
> Caused by: java.io.EOFException
>   at 
> java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2675)
>   at 
> 

plugin to scan the Jenkins console log and determine the type of the failure

2018-09-27 Thread pbasanta2002
Hi 

Is there a plugin to scan the Jenkins console log and determine the type of 
the failure (Infrastructure / Artifactory etc..)? and take action .. 
instead of marking the build as failed /warning.

Regards,
Basanta

-- 
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/2055fe5b-d379-489c-b511-82eb42873fc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: plugin to scan the Jenkins console log and determine the type of the failure

2018-09-27 Thread Damien Coraboeuf
https://plugins.jenkins.io/build-failure-analyzer ?

On Thu, Sep 27, 2018 at 12:10 PM  wrote:

> Hi
>
> Is there a plugin to scan the Jenkins console log and determine the type
> of the failure (Infrastructure / Artifactory etc..)? and take action ..
> instead of marking the build as failed /warning.
>
> Regards,
> Basanta
>
> --
> 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/2055fe5b-d379-489c-b511-82eb42873fc1%40googlegroups.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/CAPD6afOc0ZeMCwyjguYQY9n_CD%3DuUJ3zXk9omGHx7GVf5H%3D_dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Git Checkout Issue

2018-09-27 Thread Bhavya Manjunath
Hi,

I am getting a git checkout issue "cannot checkout from starting point 
error" when triggering the scripts through Jenkins pipeline. As a 
workaround I created a new pipeline (copied from the error pipeline) and 
then tried to checkout and it worked successfully.

But after 10-12 builds I am getting the same error with the new pipeline. 
Please advice.

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/c0c4cce2-9f5d-4dfb-a864-1cdcf5ff1ad7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread gotviseryon
Any help on this.  Little urgent.

On Wednesday, September 26, 2018 at 3:29:23 PM UTC-4, gotvi...@gmail.com 
wrote:
>
> I'm looking to generate a report, as a job, which will provide the global 
> metrics of my Jenkins instance.  I need details in the report like (1) How 
> many jobs ran? (2) # of failed and successful jobs and every possible 
> metrics possible in one report.  I need to send this report every week to 
> my management, so would like to know if it's possible to schedule a job to 
> run this report every Friday and send the metrics by email to my managers?  
> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
> But not able to use these as part of a job, download the report or email a 
> link to the report or nothing of that sort.  Please help.
>

-- 
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/b90c4f44-cae0-4c29-bdb1-2d9ceb0e1736%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread R. Tyler Croy
(replies inline)

On Wed, 26 Sep 2018, gotviser...@gmail.com wrote:

> I'm looking to generate a report, as a job, which will provide the global 
> metrics of my Jenkins instance.  I need details in the report like (1) How 
> many jobs ran? (2) # of failed and successful jobs and every possible 
> metrics possible in one report.  I need to send this report every week to 
> my management, so would like to know if it's possible to schedule a job to 
> run this report every Friday and send the metrics by email to my managers?  
> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
> But not able to use these as part of a job, download the report or email a 
> link to the report or nothing of that sort.  Please help.


I personally use Datadog and their plugin integration to get such metrics out
of our Jenkins instances. You can certainly script such metrics gathering in
Jenkins, but there's nothing ready-made out of the box.



Cheers

--
GitHub:  https://github.com/rtyler
Twitter: https://twitter.com/agentdero

-- 
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/20180927144554.GA16966%40grape.brokenco.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Jenkins global metrics

2018-09-27 Thread gotviseryon
Thanks for the info Tyler.

On Thursday, September 27, 2018 at 10:46:20 AM UTC-4, R Tyler Croy wrote:
>
> (replies inline) 
>
> On Wed, 26 Sep 2018, gotvi...@gmail.com  wrote: 
>
> > I'm looking to generate a report, as a job, which will provide the 
> global 
> > metrics of my Jenkins instance.  I need details in the report like (1) 
> How 
> > many jobs ran? (2) # of failed and successful jobs and every possible 
> > metrics possible in one report.  I need to send this report every week 
> to 
> > my management, so would like to know if it's possible to schedule a job 
> to 
> > run this report every Friday and send the metrics by email to my 
> managers?   
> > I found these two plugins - '*Global Build Status*' and '*Build 
> Metrics*'.   
> > But not able to use these as part of a job, download the report or email 
> a 
> > link to the report or nothing of that sort.  Please help. 
>
>
> I personally use Datadog and their plugin integration to get such metrics 
> out 
> of our Jenkins instances. You can certainly script such metrics gathering 
> in 
> Jenkins, but there's nothing ready-made out of the box. 
>
>
>
> Cheers 
>
> -- 
> GitHub:  https://github.com/rtyler 
> Twitter: https://twitter.com/agentdero 
>

-- 
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/e6cb6873-445c-4851-a0c3-91ec65ce4771%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread Vishal Raina
We have been exploring Hygiene it not only helps with Jenkins metrics and 
also acts as a central dashboard for all your CI/CD tool set.
Take a look at here https://github.com/Hygieia/Hygieia.

HTH

On Wednesday, September 26, 2018 at 12:29:23 PM UTC-7, gotvi...@gmail.com 
wrote:
>
> I'm looking to generate a report, as a job, which will provide the global 
> metrics of my Jenkins instance.  I need details in the report like (1) How 
> many jobs ran? (2) # of failed and successful jobs and every possible 
> metrics possible in one report.  I need to send this report every week to 
> my management, so would like to know if it's possible to schedule a job to 
> run this report every Friday and send the metrics by email to my managers?  
> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
> But not able to use these as part of a job, download the report or email a 
> link to the report or nothing of that sort.  Please help.
>

-- 
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/ea6759eb-5eca-4242-9037-5bd390d79c66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread gotviseryon
Thanks a lot Vishal.  Will explore this.

On Thursday, September 27, 2018 at 1:12:48 PM UTC-4, Vishal Raina wrote:
>
> We have been exploring Hygiene it not only helps with Jenkins metrics and 
> also acts as a central dashboard for all your CI/CD tool set.
> Take a look at here https://github.com/Hygieia/Hygieia.
>
> HTH
>
> On Wednesday, September 26, 2018 at 12:29:23 PM UTC-7, gotvi...@gmail.com 
> wrote:
>>
>> I'm looking to generate a report, as a job, which will provide the global 
>> metrics of my Jenkins instance.  I need details in the report like (1) How 
>> many jobs ran? (2) # of failed and successful jobs and every possible 
>> metrics possible in one report.  I need to send this report every week to 
>> my management, so would like to know if it's possible to schedule a job to 
>> run this report every Friday and send the metrics by email to my managers?  
>> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
>> But not able to use these as part of a job, download the report or email a 
>> link to the report or nothing of that sort.  Please help.
>>
>

-- 
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/5b78d0f4-f2d2-4382-aaa8-95c7576d5d4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Declarative pipeline - override pipeline level agent

2018-09-27 Thread nirav
I am having trouble defining agents for my build pipeline. I need to use 2 
docker images as agents for entire pipe. first 4 steps uses one image and 
last two steps uses another one. I don't want to repeat agent statement in 
every stage.

It was easy with scripted pipe. I defined all my images on top level and 
then for each stage I just need to say container("${name of the image}")
 containers: [
containerTemplate(name: 'maven', image: 'maven:3.5.4-jdk-10', 
ttyEnabled: true, command: 'cat'),
containerTemplate(name: 'docker', image: 'docker:18.03.1-ce', 
ttyEnabled: true, command: 'cat'),
]


I see that declarative pipeline you can not define multiple agents at 
pipeline level. 

Is there a way I can define agent in one stage and in all other stages i 
refer them by label/name etc? 

ps - I don't want to do any setting under 'Manage Jenkins'.

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/5d9091ac-9744-4a74-a5a7-bda0f6c44ff6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get build results from a build job in a pipeline

2018-09-27 Thread viacheslav . gordiievskyi
Trying to find the answer why it doesn't work for case when I use def 
jobBuild = build job: 'myjob', propagate: false, 
*wait:false*
On Wednesday, May 17, 2017 at 12:55:33 PM UTC+3, Bill Dennis wrote:
>
> Ah just saw you need the job to call all builds even if one fails. You can 
> do it with a parallel section like this:
>
> Map buildResults = [:]
>
> Boolean failedJobs = false
>
> void nofify_email(Map results) {
> echo "TEST SIMULATE notify: ${results.toString()}"
> }
>
> Boolean buildJob(String jobName, Map results) {
>
> def jobBuild = build job: jobName, propagate: false
>
> def jobResult = jobBuild.getResult()
>
> echo "Build of '${jobName}' returned result: ${jobResult}"
>
> results[jobName] = jobResult
>
> return jobResult == 'SUCCESS'
> }
>
> pipeline {
>
> agent any
>
> stages {
>
> stage('Parallel Builds') {
>
> steps {
>
> parallel(
>
> "testJob1": {
> script {
> if (!buildJob('testJob1', buildResults)) {
> failedJobs = true
> }
> }
> },
>
> "testJob2": {
> script {
> if (!buildJob('testJob2', buildResults)) {
> failedJobs = true
> }
> }
> },
> )
> }
> }
>
> stage('Completion') {
>
> steps {
> script {
> if (failedJobs) {
> error("One or more jobs have failed")
> }
> }
> }
> }
> }
>
> post {
>
> always {
> echo "Build results: ${buildResults.toString()}"
> }
>
> success {
> echo "All builds completed OK"
> }
>
> failure {
> echo "A job failed"
>
> script {
> nofify_email(buildResults)
> }
> }
> }
> }
>
>
>
> And output looks like this:
>
> Started by user anonymous
> [Pipeline] node
> Running on master in /var/jenkins_home/workspace/foo
> [Pipeline] {
> [Pipeline] stage
> [Pipeline] { (Parallel Builds)
> [Pipeline] parallel
> [Pipeline] [testJob1] { (Branch: testJob1)
> [Pipeline] [testJob2] { (Branch: testJob2)
> [Pipeline] [testJob1] script
> [Pipeline] [testJob1] {
> [Pipeline] [testJob2] script
> [Pipeline] [testJob2] {
> [Pipeline] [testJob1] build (Building testJob1)
> [testJob1] Scheduling project: testJob1
> [Pipeline] [testJob2] build (Building testJob2)
> [testJob2] Scheduling project: testJob2
> [testJob1] Starting building: testJob1 #8
> [testJob2] Starting building: testJob2 #4
> [Pipeline] [testJob2] echo
> [testJob2] Build of 'testJob2' returned result: SUCCESS
> [Pipeline] [testJob2] }
> [Pipeline] [testJob2] // script
> [Pipeline] [testJob2] }
> [testJob1] Build of 'testJob1' returned result: FAILURE
> [Pipeline] [testJob1] echo
> [Pipeline] [testJob1] }
> [Pipeline] [testJob1] // script
> [Pipeline] [testJob1] }
> [Pipeline] // parallel
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] stage
> [Pipeline] { (Completion)
> [Pipeline] script
> [Pipeline] {
> [Pipeline] error
> [Pipeline] }
> [Pipeline] // script
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] stage
> [Pipeline] { (Declarative: Post Actions)
> [Pipeline] echo
> Build results: [testJob2:SUCCESS, testJob1:FAILURE]
> [Pipeline] echo
> A job failed
> [Pipeline] script
> [Pipeline] {
> [Pipeline] echo
> TEST SIMULATE notify: [testJob2:SUCCESS, testJob1:FAILURE]
> [Pipeline] }
> [Pipeline] // script
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] }
> [Pipeline] // node
> [Pipeline] End of Pipeline
> ERROR: One or more jobs have failed
> Finished: FAILURE
>
>
> --Bill
>
> On Wednesday, 17 May 2017 03:45:27 UTC+1, Jesse Kinross-Smith wrote:
>>
>> How can I do this right - I want the results from a job I run (I need to 
>> run a dozen of these in succession and will email devs if one of them 
>> fails) 
>>
>> try{ BuildResults = build job: 'testJob'; currentBuild.result='SUCCESS'; 
>>> } catch(e){ currentBuild.result = 'FAILURE'; } finally { 
>>> notify_email(BuildResults); }
>>
>>
>> if i do the above I only get a valid BuildResults in notify_email IF the 
>> job is successful, 
>> if it fails it causes an exception saying No such property: BuildResults
>>
>> currentBuild is useless as it's the pipeline results, not the job results 
>> which is what I want
>>
>> I need the try/catch so I can continue to run my other jobs - otherwise 
>> it'll stop immediately once one job fails
>>
>> I'm sure there's some syntax I'm missing here, but I'm struggling to find 
>> it.
>>
>> Any help you can provide is appreciated.
>>
>> Regards,
>>
>> Jesse
>>
>

-- 

Re: Declarative pipeline - override pipeline level agent

2018-09-27 Thread nirav
SO far I tried following but with all I keep hitting ‘Jenkins’ doesn’t have 
label ‘docker’

Try 1 : Trying to override top-level agent. I get  ‘Jenkins’ doesn’t have 
label ‘docker’ and build hangs there

pipeline {

agent { 

  docker {

image 'maven:3-alpine' 

args '-v /Users/npatel/.m2:/root/.m2' 

}

}

stages {

stage("Initialize") {

 agent { 

  docker {

image 'maven:3.5.4-jdk-10' 

args '-v /Users/npatel/.m2:/root/.m2' 

}

}

 steps{

echo "buildId: ${env.BUILD_ID}"

 }

}

}


}


Try 2 : Trying to override any agent. I still get  ‘Jenkins’ doesn’t have 
label ‘docker’ and build hangs there

pipeline {

agent any

stages {

stage("Initialize") {

 agent { 

  docker {

image 'maven:3.5.4-jdk-10' 

args '-v /Users/npatel/.m2:/root/.m2' 

}

}

 steps{

echo "buildId: ${env.BUILD_ID}"

 }

}

}


}




On Thursday, September 27, 2018 at 1:01:25 PM UTC-7, nirav wrote:
>
> I am having trouble defining agents for my build pipeline. I need to use 2 
> docker images as agents for entire pipe. first 4 steps uses one image and 
> last two steps uses another one. I don't want to repeat agent statement in 
> every stage.
>
> It was easy with scripted pipe. I defined all my images on top level and 
> then for each stage I just need to say container("${name of the image}")
>  containers: [
> containerTemplate(name: 'maven', image: 'maven:3.5.4-jdk-10', 
> ttyEnabled: true, command: 'cat'),
> containerTemplate(name: 'docker', image: 'docker:18.03.1-ce', 
> ttyEnabled: true, command: 'cat'),
> ]
>
>
> I see that declarative pipeline you can not define multiple agents at 
> pipeline level. 
>
> Is there a way I can define agent in one stage and in all other stages i 
> refer them by label/name etc? 
>
> ps - I don't want to do any setting under 'Manage Jenkins'.
>
> 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/5338401e-eb41-4c6a-818d-b3300dac3d14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Declarative pipeline - override pipeline level agent

2018-09-27 Thread Andrew Bayer
Top level docker agents can't be overridden - but you can use the
kubernetes plugin in Declarative (
https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/test/resources/org/csanchez/jenkins/plugins/kubernetes/pipeline/declarative.groovy
e.g.) which may be what you're looking for.

A.

On Thu, Sep 27, 2018 at 4:29 PM nirav  wrote:

> SO far I tried following but with all I keep hitting ‘Jenkins’ doesn’t
> have label ‘docker’
>
> Try 1 : Trying to override top-level agent. I get  ‘Jenkins’ doesn’t have
> label ‘docker’ and build hangs there
>
> pipeline {
>
> agent {
>
>   docker {
>
> image 'maven:3-alpine'
>
> args '-v /Users/npatel/.m2:/root/.m2'
>
> }
>
> }
>
> stages {
>
> stage("Initialize") {
>
>  agent {
>
>   docker {
>
> image 'maven:3.5.4-jdk-10'
>
> args '-v /Users/npatel/.m2:/root/.m2'
>
> }
>
> }
>
>  steps{
>
> echo "buildId: ${env.BUILD_ID}"
>
>  }
>
> }
>
> }
>
>
> }
>
>
> Try 2 : Trying to override any agent. I still get  ‘Jenkins’ doesn’t have
> label ‘docker’ and build hangs there
>
> pipeline {
>
> agent any
>
> stages {
>
> stage("Initialize") {
>
>  agent {
>
>   docker {
>
> image 'maven:3.5.4-jdk-10'
>
> args '-v /Users/npatel/.m2:/root/.m2'
>
> }
>
> }
>
>  steps{
>
> echo "buildId: ${env.BUILD_ID}"
>
>  }
>
> }
>
> }
>
>
> }
>
>
>
>
> On Thursday, September 27, 2018 at 1:01:25 PM UTC-7, nirav wrote:
>>
>> I am having trouble defining agents for my build pipeline. I need to use
>> 2 docker images as agents for entire pipe. first 4 steps uses one image and
>> last two steps uses another one. I don't want to repeat agent statement in
>> every stage.
>>
>> It was easy with scripted pipe. I defined all my images on top level and
>> then for each stage I just need to say container("${name of the image}")
>>  containers: [
>> containerTemplate(name: 'maven', image: 'maven:3.5.4-jdk-10',
>> ttyEnabled: true, command: 'cat'),
>> containerTemplate(name: 'docker', image: 'docker:18.03.1-ce',
>> ttyEnabled: true, command: 'cat'),
>> ]
>>
>>
>> I see that declarative pipeline you can not define multiple agents at
>> pipeline level.
>>
>> Is there a way I can define agent in one stage and in all other stages i
>> refer them by label/name etc?
>>
>> ps - I don't want to do any setting under 'Manage Jenkins'.
>>
>> 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/5338401e-eb41-4c6a-818d-b3300dac3d14%40googlegroups.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/CAPbPdOYnU8zrsYy5vuN0YV4J3Mxueqi2ubaeXnANPzzhRBSOTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does the Declarative Pipeline Plugin Assume /bin/sh for Shell Command Step (sh) when Running on Agent Node?

2018-09-27 Thread Andrew Bayer
It uses the default shell, yes - i.e., "sh -c ...", as you can see at
https://github.com/jenkinsci/durable-task-plugin/blob/c1ee6607c6939e8917762419c8474fecec06172c/src/main/java/org/jenkinsci/plugins/durabletask/BourneShellScript.java#L141-L165.
The actual content of the step, i.e., "ls -la" in "sh('ls -la')", though,
gets written to a file on the agent, and then that file is executed. So
"#!/bin/bash" should have done the trick...

A.

On Wed, Sep 26, 2018 at 2:33 PM Meg Watson  wrote:

> Hi there,
>
> I have a Jenkins Master on RHEL (v 2.121.3), and an Agent running on
> NonStop, which looks and smells like Unix.  On NonStop I have 2 choices for
> the shell, /bin/sh (which is symlinked to /bin/ksh) and /bin/bash.  I
> normally use /bin/bash.  I have a pipeline job that is pegged to run on the
> NonStop Agent (via node ()) with a pipeline declarative script.  One of the
> steps is an sh with several lines.  Problem is, the shell run by the sh
> step is /bin/sh.  I cannot figure out how to change it.  I tried
> #!/bin/bash as the first line of the sh step, but to no avail.  It seems
> like the agent may be assuming /bin/sh when executing the sh step.  Any
> ideas on how I can change the script used by the sh step in the pipeline?
>
> Declarative Pipeline Plugin 1.3.1; Pipeline: Nodes and Processes Plugin
> 2.19
>
> Thanks in advance!
>
> Meg
>
> --
> 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/923a2542-30e3-4ec6-b0f0-e142f0b5f439%40googlegroups.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/CAPbPdObokWagEO5gUT_XV6SXCR1wcYe9ho4ubbpYrBztPbWBwg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Declarative pipeline - override pipeline level agent

2018-09-27 Thread nirav
would that be useful without kubernetes cluster? And isn't this a common 
requirements? Without it my pipe looks like following. It's littered with 
same agent section in many stages. It works though.

#!/bin/groovy

def scmVars
pipeline {
agent { label 'master'}

stages {
stage("Initialize") {
   * agent {*
*docker {*
*image 'maven:3-alpine' *
*args '-v /Users/npatel/.m2:/root/.m2' *
*reuseNode true*
*}*
*}*
 steps{
sh '''
pwd
ls -lah
printenv
'''
 }
}
stage(“Checkout”) {
*agent {*
*docker {*
*image 'maven:3-alpine' *
*args '-v /Users/npatel/.m2:/root/.m2' *
*reuseNode true*
*}*
*}*
steps {
script {
scmVars = git credentialsId: 'bitbucket-npatel', url: 
'http://git'

 }

}
 }
stage('Build') {
 *agent {*
*docker {*
*image 'maven:3-alpine' *
*args '-v /Users/npatel/.m2:/root/.m2' *
*reuseNode true*
*}*
* }*
 steps {
sh '''
echo "multiline shell steps"
#mvn -B -DskipTests install
'''
 }   
}
stage('test') {
*agent {*
*docker {*
*image 'maven:3-alpine' *
*args '-v /Users/npatel/.m2:/root/.m2' *
*reuseNode true*
*}*
*}*
steps {
sh '''
echo "skipping tests for now"
# mvn surefire:test
'''
}
}
stage('build dist') {
agent {
docker {
image 'maven:3-alpine' 
args '-v /Users/npatel/.m2:/root/.m2' 
reuseNode true
}
}
steps {
sh '''
#mvn play2:dist -Dplay2.distFormats=tar.gz
'''
}
}
stage('docker build') {
   agent {
  docker {
image "docker:18.03.1-ce"
registryUrl ""
registryCredentialsId "dockerhub-npatel"
  }
}
   steps {   
sh """
docker -v
  
"""
}
} 
}
}

On Thursday, September 27, 2018 at 1:36:13 PM UTC-7, Andrew Bayer wrote:
>
> Top level docker agents can't be overridden - but you can use the 
> kubernetes plugin in Declarative (
> https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/test/resources/org/csanchez/jenkins/plugins/kubernetes/pipeline/declarative.groovy
>  
> e.g.) which may be what you're looking for.
>
> A.
>
> On Thu, Sep 27, 2018 at 4:29 PM nirav > 
> wrote:
>
>> SO far I tried following but with all I keep hitting ‘Jenkins’ doesn’t 
>> have label ‘docker’
>>
>> Try 1 : Trying to override top-level agent. I get  ‘Jenkins’ doesn’t have 
>> label ‘docker’ and build hangs there
>>
>> pipeline {
>>
>> agent { 
>>
>>   docker {
>>
>> image 'maven:3-alpine' 
>>
>> args '-v /Users/npatel/.m2:/root/.m2' 
>>
>> }
>>
>> }
>>
>> stages {
>>
>> stage("Initialize") {
>>
>>  agent { 
>>
>>   docker {
>>
>> image 'maven:3.5.4-jdk-10' 
>>
>> args '-v /Users/npatel/.m2:/root/.m2' 
>>
>> }
>>
>> }
>>
>>  steps{
>>
>> echo "buildId: ${env.BUILD_ID}"
>>
>>  }
>>
>> }
>>
>> }
>>
>>
>> }
>>
>>
>> Try 2 : Trying to override any agent. I still get  ‘Jenkins’ doesn’t have 
>> label ‘docker’ and build hangs there
>>
>> pipeline {
>>
>> agent any
>>
>> stages {
>>
>> stage("Initialize") {
>>
>>  agent { 
>>
>>   docker {
>>
>> image 'maven:3.5.4-jdk-10' 
>>
>> args '-v /Users/npatel/.m2:/root/.m2' 
>>
>> }
>>
>> }
>>
>>  steps{
>>
>> echo "buildId: ${env.BUILD_ID}"
>>
>>  }
>>
>> }
>>
>> }
>>
>>
>> }
>>
>>
>>
>>
>> On Thursday, September 27, 2018 at 1:01:25 PM UTC-7, nirav wrote:
>>>
>>> I am having trouble defining agents for my build pipeline. I need to use 
>>> 2 docker images as agents for entire pipe. first 4 steps uses one image and 
>>> last two steps uses another one. I don't want to repeat agent statement in 
>>> every stage.
>>>
>>> It was easy with scripted pipe. I defined all my images on top level and 
>>> then for each stage I just need to say container("${name of