Getting closure to work Pipeline

2018-08-26 Thread Hari Krishna Dara
I am trying out an approach in which the caller receives a closure as a 
return value from a function so that the context can be preserved for 
further call chaining. I tried the below as a test and it didn't work:

def prep() {
return [run: {-> echo "Hello Closure"}]
}

pipeline {
agent "any"

stages {
stage("Init") {
steps {
script {
p = prep()
p.run()
}
}
}
}
}


The error I see in the console log is:

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No 
signature of method: java.util.LinkedHashMap.run() is applicable for argument 
types: () values: []
Possible solutions: min(groovy.lang.Closure), put(java.lang.Object, 
java.lang.Object), put(java.lang.Object, java.lang.Object), find(), any(), 
grep()
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:131)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
at 
com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.run(WorkflowScript:14)
at ___cps.transform___(Native Method)

...

When I tried to return the closure directly instead of a map it worked fine:

def prep() {
return {-> echo "Hello Closure"}
...
p = prep()
...


Also, if I extract the map element first, it works fine (when I called the 
local variable as run, I got the script security error: Scripts not 
permitted to use method java.lang.Runnable run):

p = prep()
r = p.run
r()

And this works too:

p = prep()
p["run"]()


but this is not elegant. Is this a bug or expected behavior? The below 
equivalent worked fine in script console:

def prep() {
return [run: {-> print("Hello Closure")}]
}

prep().run()


-- 
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/f26114e0-6340-4379-8d45-bc9b6980f20d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins plugin for invoking external async jobs and polling their results

2018-08-26 Thread matti . maki
I might not have done enough research but so far I wasn't able to find too 
many Jenkins plugins or instructions that would handle this kind of 
scenario:

- At the beginning of a Jenkins job, trigger a webhook on an external 
service, possibly getting back some kind of (non-Jenkins) job ID
- Wait until the external job is finished (polling the service or 
subscribing to events), fetch the results using the API of that external 
service
- Finish the job and set its status based on the external job results

The issue is that the job running on an external platform cannot be run as 
part of the build on Jenkins slaves but it still needs to be part of a 
long, complex chain of Jenkins jobs. Thus, Jenkins is just used as a way to 
trigger the external job and publish its results.

Some plugins that I stumbled upon:
- https://github.com/jenkinsci/coverity-plugin/ - the Coverity Connect 
related parts could be vaguely similar but it seems to be quite a complex 
plugin to even just copy the basic ideas from
- https://plugins.jenkins.io/external-monitor-job - the name sounds 
promising but I think, in my case, it ends there

What I'm looking after is:
- suggestions of plugins that already do something like this (which I can 
either fork or just take ideas from)
- alternatively, is there already a better way of achieving the same thing 
with Jenkins and I just didn't realize it yet?

Thanks a lot!

-- 
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/71b2211f-ff3d-4fa1-8a49-e555ee6397cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Usage of Jenkins shared library in Job DSL

2018-08-26 Thread treneva
Yep,
My libraries are already configured there, but the DSL script is obviously 
not working. Perhaps the syntax needs to be different...

On Sunday, August 26, 2018 at 6:04:36 PM UTC+3, Jan Monterrubio wrote:
>
> Manage Jenkins -> configure system -> global libraries 
>
> You can add your shared library there. 
>
> On Fri, Aug 17, 2018 at 11:05 > wrote:
>
>> Hey,
>>
>> I am looking for advice how to achieve usage of Jenkins shared library in 
>> Job DSL – 
>> I use this snipped to seed a job whose functionality is in Jenkins file:
>>
>>
>> job('my-small-test-job') {
>> parameters {
>> stringParam('branch', '${branch}')
>> } 
>> removedJobAction: 'IGNORE'
>> def releaseScript = readFileFromWorkspace('Jenkinsfile')
>> steps {
>>   dsl {
>>   text(releaseScript)
>>   }
>> }
>> }
>>
>> The newly created [my-small-test-job] has this content (taken out of the 
>> Jenkinsfile): 
>>
>> @Library('templates')_
>>
>> stage('Demo') {
>> echo 'Hello world'
>> jobBuilder {
>>   nodeLabels = 'linux && test'
>>   antExtraArgs = 'test 
>> -Dtest.suite=com.softwareag.suites.custom.ToolsTestSuite'
>> }
>> }
>>
>> I have a shared library under [templates] that is a generic job builder 
>> (the syntax is typical groovy like jenkins pipeline, similar to what is 
>> explained here: https://jenkins.io/doc/book/pipeline/shared-libraries/)
>>
>>
>> When I try to run the newly created [my-small-test-job] I get this: 
>>
>> Processing provided DSL script
>> ERROR: startup failed:
>> script: 1: unable to resolve class Library ,  unable to find class for 
>> annotation
>>  @ line 1, column 1.
>>@Library('templates')_
>>^
>>
>> 1 error
>>
>>
>> The shared library is obviusly not added to classpath. How do I fix this?
>>
>> -- 
>> 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/6e3b23aa-873b-40c6-9859-c5cd7356611f%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/c73bac9e-3df4-4f83-a3c1-fb994c8cc13d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [CONCURRENT BUILDS] Run on master, run on slave and then sit in queue

2018-08-26 Thread Nati Mirauta
Hello,

Thank-you very much for your answer, this helped me!

Have a great day,
Nati

sâmbătă, 25 august 2018, 14:01:52 UTC+3, Daniel Butler a scris:
>
> If you set the number of executors on both master and slave to 1 that will 
> restrict the number of builds to one per node put a third into the queue. 
>
> Regards
> Daniel 
>
> On Fri, 24 Aug 2018, 12:58 Nati Mirauta, > 
> wrote:
>
>> Hello,
>>
>> I would like to know if there is a way to run a job on master once and 
>> after another build request, instead of having the job stay in queue I 
>> would want the job to run on slave and then after it runs both on master 
>> and on slave, after the next build request it will have to sit in queue. 
>> For example I have JOB1, I build it and it runs on 'master', I build it 
>> again and JOB1 will run in parallel on 'slave', if I build it again while 
>> it's already running on 'master' and 'slave', the job will have to sit in 
>> queue.
>>
>> I have tried using the Throttle Concurrent Builds Plugin available for 
>> Jenkins but I do not know exactly how to use it in a scripted pipeline. 
>> Only thing I know how to do is make a job run concurrently on 'master 'or 
>> 'slave' (two runs - both or master or both on slave) with a single build 
>> using throttle(). I have to implement this functionality in a pipeline (no 
>> plug-in checkboxes) so it will make working with git easier. Can Jenkins 
>> support this functionality?, if yes, is it possible to implement it in a 
>> scripted pipeline? I am VERY new to Jenkins, I searched the internet but I 
>> can't find anything. I greatly appreciate any kind of help/tip, any 
>> documentation that can help me achieve this functionality.
>>
>> Thank-you in advance.
>>
>> -- 
>> 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/265011e8-83fa-4a93-b127-85f3ae17cda6%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/4342279e-bf9b-4b2f-a3bc-c8f6a7a283ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: connect with SSH

2018-08-26 Thread Ivan Fernandez Calvo
I meant

echo 'password' | sudo -S command

-- 
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/b4d30378-a662-4f8d-8e3c-8ce7aceac04b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: connect with SSH

2018-08-26 Thread Ivan Fernandez Calvo
You can configure sido to do not as for password to some commands, or for every 
command. Also you can pass the password in command line

echo password | sudo command

You can inject the password in your job from a credential in Jenkins

-- 
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/734736bf-603f-40d4-a789-8264d589dda2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: connect with SSH

2018-08-26 Thread jojo
Thanks a lot.but the job as u described ask for password in mid night

On Sun, Aug 26, 2018, 21:45 Ivan Fernandez Calvo 
wrote:

> IIRC the root user is disabled by default on Mac OS X, you can enable it
> if you set a password for it(https://support.apple.com/en-us/HT204012),
> but I think that it is better to enter as a regular user and use sudo for
> those operation that you need root access.
>
> --
> 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/Kqy1yw5h47c/unsubscribe.
> To unsubscribe from this group and all its topics, 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/2960e628-257b-4607-850d-6d773546cd6d%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/CACuGLxiDQxXNpv2uggSvCEyUXwG7NKOHnAieazPBobqGMDfOeg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


connect with SSH

2018-08-26 Thread Ivan Fernandez Calvo
IIRC the root user is disabled by default on Mac OS X, you can enable it if you 
set a password for it(https://support.apple.com/en-us/HT204012), but I think 
that it is better to enter as a regular user and use sudo for those operation 
that you need root access.

-- 
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/2960e628-257b-4607-850d-6d773546cd6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pass in a parameter/property specified by Jenkins job, not user

2018-08-26 Thread Adam Hardy
Yes, exactly, I don't think pausing the job to get the info from the user is a 
good way of doing it.


If it isn't possible to pass an extra parameter/property from the Jenkins UI to 
the script on job launch and initialization, then I should move onto a different 
approach using some other logical means.


However the "parameterized build" option in the job config dialog gave me hope 
that such a non-user-defined parameter was feasible.


Is that incorrect?


Qiang Ma wrote on 26/08/18 15:20:
Hmm, JOB_NAME would be auto generated based on the branch name.

User input would make the job pause, so that doesn't seem a good option , 
either.

Then what else can be different to make the same job performing different 
deployment?  Branch name?



On Sun, Aug 26, 2018 at 7:15 AM Adam Hardy > wrote:


    I can't check until I get in on Tuesday but this is a multi-branch pipeline 
job.


    Won't env.JOB_NAME either be the approximately the name of the repo so I 
know
    which app it builds, or the name of the branch in that repo?

    If it's the former, I guess I could suffix the name with the environment and
    then parse it in the script, but that's not really something I'd like.


    --
    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/4jayfI5ijBQ/unsubscribe.
    To unsubscribe from this group and all its topics, 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/74a0e435-3ac7-e14e-0d0b-7858080a3de8%40cyberspaceroad.com.

    For more options, visit https://groups.google.com/d/optout.



--

Regards,
Qiang

--
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/4jayfI5ijBQ/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAHf%3Dn4yNObgShHRmO%2B6_c_Zr-jtnKApK-T%3DWLu%2B-cd4s4z3d8g%40mail.gmail.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/9ff2aa3f-ff41-5ec8-33c6-a202163459d1%40cyberspaceroad.com.
For more options, visit https://groups.google.com/d/optout.


Re: Usage of Jenkins shared library in Job DSL

2018-08-26 Thread Jan Monterrubio
Manage Jenkins -> configure system -> global libraries

You can add your shared library there.

On Fri, Aug 17, 2018 at 11:05  wrote:

> Hey,
>
> I am looking for advice how to achieve usage of Jenkins shared library in
> Job DSL –
> I use this snipped to seed a job whose functionality is in Jenkins file:
>
>
> job('my-small-test-job') {
> parameters {
> stringParam('branch', '${branch}')
> }
> removedJobAction: 'IGNORE'
> def releaseScript = readFileFromWorkspace('Jenkinsfile')
> steps {
>   dsl {
>   text(releaseScript)
>   }
> }
> }
>
> The newly created [my-small-test-job] has this content (taken out of the
> Jenkinsfile):
>
> @Library('templates')_
>
> stage('Demo') {
> echo 'Hello world'
> jobBuilder {
>   nodeLabels = 'linux && test'
>   antExtraArgs = 'test
> -Dtest.suite=com.softwareag.suites.custom.ToolsTestSuite'
> }
> }
>
> I have a shared library under [templates] that is a generic job builder
> (the syntax is typical groovy like jenkins pipeline, similar to what is
> explained here: https://jenkins.io/doc/book/pipeline/shared-libraries/)
>
>
> When I try to run the newly created [my-small-test-job] I get this:
>
> Processing provided DSL script
> ERROR: startup failed:
> script: 1: unable to resolve class Library ,  unable to find class for
> annotation
>  @ line 1, column 1.
>@Library('templates')_
>^
>
> 1 error
>
>
> The shared library is obviusly not added to classpath. How do I fix this?
>
> --
> 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/6e3b23aa-873b-40c6-9859-c5cd7356611f%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/CADgiF9LMjNNruE_pux-K5Gqy_UabB0KHdZwiHWVG3a7AhzSP-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Re[2]: Jenkins white-list for Build flow plugin

2018-08-26 Thread Oleg Nenashev
Added the mailing list to Cc.
In order to send messages to this mailing list, you need to join it.

Suppress the entire whitelist by using
> "-Djenkins.security.ClassFilterImpl.SUPPRESS_WHITELIST=true"
>

It has to be done in Java startup options, e.g. "java
-Djenkins.security.ClassFilterImpl.SUPPRESS_WHITELIST=true -jar jenkins.war
..."

I use Jenkins plugin Build-flow that is deprecated and not supported, but I
> need it.
>
It's better to consider migrating from the plugin.
The functionality was largely replaced by Pipeline, and the plugin has not
been maintained for years.

Hopefully it helps,
Oleg



On Sun, Aug 26, 2018 at 3:47 PM Andrey Gaizler  wrote:

> Sorry, I fail to send mail to Jenkins users list.
> Can you please answer me or to the list?
>
> Thanks!
>
>
> Воскресенье, 26 августа 2018, 15:02 +03:00 от Oleg Nenashev <
> o.v.nenas...@gmail.com>:
>
> Hi! Could you please ask the same question in the Jenkins user mailing
> list? I will respond there
>
> On Sun, Aug 26, 2018, 12:51 Andrey Gaizler  >
> wrote:
>
> Hello Oleg!
> I use Jenkins plugin Build-flow that is deprecated and not supported, but
> I need it.
> After upgrade of Jeknins it doesn't save build.xml file and history is
> removed after Jenkins restart.
> I found many topics that need to suppress white-list.
> You posted:
>
>- Suppress the entire whitelist by using
>"-Djenkins.security.ClassFilterImpl.SUPPRESS_WHITELIST=true"
>
>
> Please help me to understand where can I do this?
>
> Thanks in advance.
>
>
>
> Best wishes,
> Andrey Gaizler !
>

-- 
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/CAPfivLBHof_e-_3kXxx%3D_qFdB1h1G70RK_sQ%2Bawki5%3D1P3Cryw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pass in a parameter/property specified by Jenkins job, not user

2018-08-26 Thread Qiang Ma
Hmm, JOB_NAME would be auto generated based on the branch name.

User input would make the job pause, so that doesn't seem a good option ,
either.

Then what else can be different to make the same job performing different
deployment?  Branch name?


On Sun, Aug 26, 2018 at 7:15 AM Adam Hardy 
wrote:

> I can't check until I get in on Tuesday but this is a multi-branch
> pipeline job.
>
> Won't env.JOB_NAME either be the approximately the name of the repo so I
> know
> which app it builds, or the name of the branch in that repo?
>
> If it's the former, I guess I could suffix the name with the environment
> and
> then parse it in the script, but that's not really something I'd like.
>
>
> --
> 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/4jayfI5ijBQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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/74a0e435-3ac7-e14e-0d0b-7858080a3de8%40cyberspaceroad.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Regards,
Qiang

-- 
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/CAHf%3Dn4yNObgShHRmO%2B6_c_Zr-jtnKApK-T%3DWLu%2B-cd4s4z3d8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


connect with SSH

2018-08-26 Thread yossibr9876
Hello ,

I need to connect to mac as a root from Jenkis.
It must be as SSL ?

I try to connect with ssh and I failed .

Any idea ?

* with an admin user it ok to connect to mac .

Thanks in advance

yossibr


-- 
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/5560aee3-170b-4b78-ac76-2e8b3757f9cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Script result interpreted a a command to execute?

2018-08-26 Thread Idan Adar
Thanks Slide!

On Sun, Aug 26, 2018 at 4:25 PM Slide  wrote:

> It's because your shell command has $() around it. This will try and eval
> the subshell value. You don't need the $() at all
>
> On Sun, Aug 26, 2018, 03:44 Idan Adar  wrote:
>
>> The following block fails... appreciate any insights:
>>
>> workerVersion = sh(script:"\$(ic cs workers ${clusterName} --json | jq
>> -r .[0].kubeVersion)", returnStdout: true).trim() // This returns
>> "1.9.9.1522"
>> slackSend (channel: "certmgr-health", color: '#199515', message: 
>> "*$JOB_NAME*,
>> <$BUILD_URL|build #$BUILD_NUMBER>: _${clusterName}'s_ worker nodes
>> successfully upgraded to ${workerVersion}.")
>>
>> The *slackSend* never happens because the following error happens:
>>
>> ++ ic cs workers  --json
>> ++ jq -r '.[0].kubeVersion'
>> + 1.9.9_1522
>> /var/jenkins/workspace/Worker Nodes Upgrader - 
>> Production@tmp/durable-1e1c34b9/script.sh: line 2: 1.9.9_1522: command not 
>> found
>>
>> --
>> 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/714b1868-0a6e-4fd3-b131-ab7bebcaa104%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/X-2sV-aS7QE/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAPiUgVfSTEntQ8qmD5LtJnQ%2BNyx5rsjuvq-1KEDxSDsfXCsfJA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
*Idan Adar*

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


Re: Script result interpreted a a command to execute?

2018-08-26 Thread Slide
It's because your shell command has $() around it. This will try and eval
the subshell value. You don't need the $() at all

On Sun, Aug 26, 2018, 03:44 Idan Adar  wrote:

> The following block fails... appreciate any insights:
>
> workerVersion = sh(script:"\$(ic cs workers ${clusterName} --json | jq -r
> .[0].kubeVersion)", returnStdout: true).trim() // This returns
> "1.9.9.1522"
> slackSend (channel: "certmgr-health", color: '#199515', message: "*$JOB_NAME*,
> <$BUILD_URL|build #$BUILD_NUMBER>: _${clusterName}'s_ worker nodes
> successfully upgraded to ${workerVersion}.")
>
> The *slackSend* never happens because the following error happens:
>
> ++ ic cs workers  --json
> ++ jq -r '.[0].kubeVersion'
> + 1.9.9_1522
> /var/jenkins/workspace/Worker Nodes Upgrader - 
> Production@tmp/durable-1e1c34b9/script.sh: line 2: 1.9.9_1522: command not 
> found
>
> --
> 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/714b1868-0a6e-4fd3-b131-ab7bebcaa104%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/CAPiUgVfSTEntQ8qmD5LtJnQ%2BNyx5rsjuvq-1KEDxSDsfXCsfJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pass in a parameter/property specified by Jenkins job, not user

2018-08-26 Thread Adam Hardy

I can't check until I get in on Tuesday but this is a multi-branch pipeline job.

Won't env.JOB_NAME either be the approximately the name of the repo so I know 
which app it builds, or the name of the branch in that repo?


If it's the former, I guess I could suffix the name with the environment and 
then parse it in the script, but that's not really something I'd like.



--
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/74a0e435-3ac7-e14e-0d0b-7858080a3de8%40cyberspaceroad.com.
For more options, visit https://groups.google.com/d/optout.


Script result interpreted a a command to execute?

2018-08-26 Thread Idan Adar
The following block fails... appreciate any insights:

workerVersion = sh(script:"\$(ic cs workers ${clusterName} --json | jq -r 
.[0].kubeVersion)", returnStdout: true).trim() // This returns "1.9.9.1522"
slackSend (channel: "certmgr-health", color: '#199515', message: "*$JOB_NAME*, 
<$BUILD_URL|build #$BUILD_NUMBER>: _${clusterName}'s_ worker nodes 
successfully upgraded to ${workerVersion}.")

The *slackSend* never happens because the following error happens:

++ ic cs workers  --json
++ jq -r '.[0].kubeVersion'
+ 1.9.9_1522
/var/jenkins/workspace/Worker Nodes Upgrader - 
Production@tmp/durable-1e1c34b9/script.sh: line 2: 1.9.9_1522: command not found

-- 
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/714b1868-0a6e-4fd3-b131-ab7bebcaa104%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: JNLP java.nio.channels.ClosedChannelException with kubernetes-plugin

2018-08-26 Thread fabio . douek
Interesting that if I have a loop with some activity as follows, the job 
completes successfully, so it seems to be a constraint of 60 seconds of 
inactivity perhaps between the agent and the jnlp?

for i in 1 2 3 4 5
do
  echo "Looping ... number $i"
  sleep 50
done


On Sunday, August 26, 2018 at 9:52:17 AM UTC+1, fabio...@singlepoint.ie 
wrote:
>
> Hi Mark, thanks for the response.
>
> Yes, the pod meets the requirements:
> - I haven't provided a jnlp container
> - cat is the command
> - tty is enabled
> - Additional default container: maven:3.5.4-jdk-8 (tried different ones)
>
> What I've observed:
> - A build step with a sleep of 60 seconds always works
> - A build step with a sleep of 70 seconds always fails
>
> I was wondering, could be  a 60 seconds timeout in either the JNLP or 
> somewhere else?
>  
>
> On Sunday, August 26, 2018 at 12:02:14 AM UTC+1, Mark Waite wrote:
>>
>> Does the pod template meet the Kubernetes plugin constraints 
>>  mentioned 
>> in readme? Specifically, is ttyEnabled and is there a long-running process 
>> that will allow the pod to continue running until the job completes?
>>
>> On Sat, Aug 25, 2018 at 4:58 PM  wrote:
>>
>>> I'm using Kubernetes plugin 1.12.3
>>>
>>> The plugin works well, but whenever the agent does streams the log to 
>>> the master, it causes a connection exception as follows.
>>> To reproduce, simply create a free style job, restrict to run on the 
>>> kubernetes pod, and add a step to sleep for 300 seconds.
>>>
>>>
>>> FATAL: command execution failed
>>> java.nio.channels.ClosedChannelException
>>> at 
>>> org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
>>> at 
>>> org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
>>> at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
>>> at 
>>> jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
>>> at 
>>> jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
>>> 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: java.io.IOException: Backing channel 'JNLP4-connect connection from 
>>> ip-192-168-247-3.us-west-2.compute.internal/192.168.247.3:23684' is 
>>> disconnected.
>>> at 
>>> hudson.remoting.RemoteInvocationHandler.channelOrFail(RemoteInvocationHandler.java:214)
>>> at 
>>> hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:283)
>>> at com.sun.proxy.$Proxy110.isAlive(Unknown Source)
>>> at hudson.Launcher$RemoteLauncher$ProcImpl.isAlive(Launcher.java:1137)
>>> at hudson.Launcher$RemoteLauncher$ProcImpl.join(Launcher.java:1129)
>>> at hudson.tasks.CommandInterpreter.join(CommandInterpreter.java:155)
>>> at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
>>> at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
>>> at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
>>> at 
>>> hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
>>> at hudson.model.Build$BuildExecution.build(Build.java:206)
>>> at hudson.model.Build$BuildExecution.doRun(Build.java:163)
>>> at 
>>> hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
>>> at hudson.model.Run.execute(Run.java:1798)
>>> at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
>>> at hudson.model.ResourceController.execute(ResourceController.java:97)
>>> at hudson.model.Executor.run(Executor.java:429)
>>> FATAL: Unable to delete script file /tmp/jenkins5788393309854271460.sh
>>> java.nio.channels.ClosedChannelException
>>> at 
>>> org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
>>> at 
>>> org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
>>> at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
>>> at 
>>> jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
>>> at 
>>> jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
>>> 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: hudson.remoting.ChannelClosedException: Channel "unknown": Remote 
>>> call on JNLP4-connect connection from 
>>> ip-192-168-247-3.us-west-2.compute.internal/192.168.247.3:23684 failed. The 
>>> channel is closing down or has closed down
>>> at hudson.remoting.Channel.call(Channel.java

Re: JNLP java.nio.channels.ClosedChannelException with kubernetes-plugin

2018-08-26 Thread fabio . douek
Hi Mark, thanks for the response.

Yes, the pod meets the requirements:
- I haven't provided a jnlp container
- cat is the command
- tty is enabled
- Additional default container: maven:3.5.4-jdk-8 (tried different ones)

What I've observed:
- A build step with a sleep of 60 seconds always works
- A build step with a sleep of 70 seconds always fails

I was wondering, could be  a 60 seconds timeout in either the JNLP or 
somewhere else?
 

On Sunday, August 26, 2018 at 12:02:14 AM UTC+1, Mark Waite wrote:
>
> Does the pod template meet the Kubernetes plugin constraints 
>  mentioned in 
> readme? Specifically, is ttyEnabled and is there a long-running process 
> that will allow the pod to continue running until the job completes?
>
> On Sat, Aug 25, 2018 at 4:58 PM > 
> wrote:
>
>> I'm using Kubernetes plugin 1.12.3
>>
>> The plugin works well, but whenever the agent does streams the log to the 
>> master, it causes a connection exception as follows.
>> To reproduce, simply create a free style job, restrict to run on the 
>> kubernetes pod, and add a step to sleep for 300 seconds.
>>
>>
>> FATAL: command execution failed
>> java.nio.channels.ClosedChannelException
>>  at 
>> org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
>>  at 
>> org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
>>  at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
>>  at 
>> jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
>>  at 
>> jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
>>  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: java.io.IOException: Backing channel 'JNLP4-connect connection from 
>> ip-192-168-247-3.us-west-2.compute.internal/192.168.247.3:23684' is 
>> disconnected.
>>  at 
>> hudson.remoting.RemoteInvocationHandler.channelOrFail(RemoteInvocationHandler.java:214)
>>  at 
>> hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:283)
>>  at com.sun.proxy.$Proxy110.isAlive(Unknown Source)
>>  at hudson.Launcher$RemoteLauncher$ProcImpl.isAlive(Launcher.java:1137)
>>  at hudson.Launcher$RemoteLauncher$ProcImpl.join(Launcher.java:1129)
>>  at hudson.tasks.CommandInterpreter.join(CommandInterpreter.java:155)
>>  at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
>>  at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
>>  at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
>>  at 
>> hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
>>  at hudson.model.Build$BuildExecution.build(Build.java:206)
>>  at hudson.model.Build$BuildExecution.doRun(Build.java:163)
>>  at 
>> hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
>>  at hudson.model.Run.execute(Run.java:1798)
>>  at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
>>  at hudson.model.ResourceController.execute(ResourceController.java:97)
>>  at hudson.model.Executor.run(Executor.java:429)
>> FATAL: Unable to delete script file /tmp/jenkins5788393309854271460.sh
>> java.nio.channels.ClosedChannelException
>>  at 
>> org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
>>  at 
>> org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
>>  at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
>>  at 
>> jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
>>  at 
>> jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
>>  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: hudson.remoting.ChannelClosedException: Channel "unknown": Remote 
>> call on JNLP4-connect connection from 
>> ip-192-168-247-3.us-west-2.compute.internal/192.168.247.3:23684 failed. The 
>> channel is closing down or has closed down
>>  at hudson.remoting.Channel.call(Channel.java:948)
>>  at hudson.FilePath.act(FilePath.java:1036)
>>  at hudson.FilePath.act(FilePath.java:1025)
>>  at hudson.FilePath.delete(FilePath.java:1511)
>>  at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:123)
>>  at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
>>  at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
>>  at 
>> hudson.m