How to execute more code after rescue part

2017-11-14 Thread stanley . shen
Hello, all

I am having a flow job like this:


/*
 functions to parse github pull requst , and some variables for state
*/

def result = false
guard {
  job1 . ###  will be failed
  job2
  result = true
} rescue {

}

if (result) {
  add comment to pull request
  set build to SUCCESS
} else {
  add comment to pull request too
  set build to FAILURE
}


It works in most case and it doesn't work when there are errors in jobs.
After code in resuce part is executed, the next code is not executed at all.



Any suggestion on it, how can I handle it?

Thanks 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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f7bdf8de-6805-44e7-b4b1-aaebdf5ecb43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


jenkins is very slow after a long time running

2017-08-04 Thread stanley . shen
Hello, all

Recently, we meet this issue again and again.

After some time, the jenkins becomes very very slow to open, but from 
backend , it's still working.

And I see there are many light process related to jenkins, last time when 
it happens, I see there are about 1K

ps -efL | grep jenkins

Is it the reason to make jenkins slow?

Anyone meet this problem as well? What configuration should be applied to 
avoid this issue?



Thanks 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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/16f574f1-b97d-413e-adf7-da13c073e127%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I get inject environment from a freestyle job in pipeline job

2017-06-28 Thread Stanley Shen
Thanks, I didn’t notice the “Use Groovy sandbox”, and it works after I 
unchecked it.

println job.getRawBuild().getEnvironment()[“uuid"]
println 
Jenkins.instance.getItemByFullName(“test").getAllJobs()[0].getLastSuccessfulBuild().getEnvironment()["uuid"]

Both work for me.


Regards,
Stanley





> On Jun 29, 2017, at 1:24 AM, Richard Ginga <rgi...@disruptorbeam.com> wrote:
> 
> #1. try unclicking "Use Groovy sandbox" at the bottom of the script window.
> 
> #1 and #2 could be you don't have permissions. I am an admin of my jenkins 
> master
> 
> 
> On Wed, Jun 28, 2017 at 1:13 PM, Stanley Shen <stanley.s...@servicemax.com 
> <mailto:stanley.s...@servicemax.com>> wrote:
> Thanks for replying.
> 
> I tried solution #1 you provided, but it report error like 
> "org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: 
> Scripts not permitted to use method”
> 
> For #2, it also report error like 
> “org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: 
> Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance”
> 
> 
> Any idea on it.
> 
> 
> Regards,
> Stanley
> 
> 
> 
> 
> 
> 
>> On Jun 28, 2017, at 8:04 PM, Richard Ginga <rgi...@disruptorbeam.com 
>> <mailto:rgi...@disruptorbeam.com>> wrote:
>> 
>> The things you "can" get from the returned object (c) from a pipeline 
>> statement like: c = build job: "test job1" are here: 
>> 
>> https://github.com/jenkinsci/workflow-support-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.java
>>  
>> <https://github.com/jenkinsci/workflow-support-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.java>
>> 
>> you might be able to do something with the non-whitelisted getRawBuild 
>> method.
>> 
>> Otherwise, to get that job's env variables you must do something "like" 
>> this: (untested)
>> 
>> Jenkins.instance.getItemByFullName("test 
>> job1").getAllJobs()[0].getLastSuccessfulBuild().getEnv("uuid")
>> 
>> On Tue, Jun 27, 2017 at 9:21 PM, <stanley.s...@servicemax.com 
>> <mailto:stanley.s...@servicemax.com>> wrote:
>> Hello, all
>> 
>> I am trying to trigger a freestyle job in pipeline and need to get a inject 
>> environment from that job.
>> Before with flow job, we can use thing like 
>> 
>> c = build("test job1")
>> uuid = c.build.properties["environment"]["uuid"]
>> 
>> But I didn't find a way to do this similar in pipeline script.
>> 
>> Is there any hint on it?
>> 
>> 
>> -- 
>> 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 
>> <mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/fa73e7a7-ea85-4eee-8f8e-037689bff630%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/fa73e7a7-ea85-4eee-8f8e-037689bff630%40googlegroups.com?utm_medium=email_source=footer>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
>> 
>> 
>> 
>> -- 
>> Dick Ginga
>> Build Engineer
>> rgi...@disruptorbeam.com <mailto:rgi...@disruptorbeam.com>
>> 
>> 
>> -- 
>> 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/ouDKTknbt7k/unsubscribe 
>> <https://groups.google.com/d/topic/jenkinsci-users/ouDKTknbt7k/unsubscribe>.
>> To unsubscribe from this group and all its topics, send an email to 
>> jenkinsci-users+unsubscr...@googlegroups.com 
>> <mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/CAL3PpaVGzRL2j_rNYAhAsSPxw2F8gpotuLhpZiA3DOjkYXgDUw%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/CAL3PpaVGzRL2j_rNYAhAsSPxw2F8gpotuLhpZiA3DOjkYXgDUw%40mail.gmail.com?utm_medium=email_source=footer>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.goo

Re: How can I get inject environment from a freestyle job in pipeline job

2017-06-28 Thread Stanley Shen
Thanks for replying.

I tried solution #1 you provided, but it report error like 
"org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts 
not permitted to use method”

For #2, it also report error like 
“org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts 
not permitted to use staticMethod jenkins.model.Jenkins getInstance”


Any idea on it.


Regards,
Stanley






> On Jun 28, 2017, at 8:04 PM, Richard Ginga  wrote:
> 
> The things you "can" get from the returned object (c) from a pipeline 
> statement like: c = build job: "test job1" are here: 
> 
> https://github.com/jenkinsci/workflow-support-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.java
>  
> 
> 
> you might be able to do something with the non-whitelisted getRawBuild method.
> 
> Otherwise, to get that job's env variables you must do something "like" this: 
> (untested)
> 
> Jenkins.instance.getItemByFullName("test 
> job1").getAllJobs()[0].getLastSuccessfulBuild().getEnv("uuid")
> 
> On Tue, Jun 27, 2017 at 9:21 PM,  > wrote:
> Hello, all
> 
> I am trying to trigger a freestyle job in pipeline and need to get a inject 
> environment from that job.
> Before with flow job, we can use thing like 
> 
> c = build("test job1")
> uuid = c.build.properties["environment"]["uuid"]
> 
> But I didn't find a way to do this similar in pipeline script.
> 
> Is there any hint on it?
> 
> 
> -- 
> 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/fa73e7a7-ea85-4eee-8f8e-037689bff630%40googlegroups.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .
> 
> 
> 
> -- 
> Dick Ginga
> Build Engineer
> rgi...@disruptorbeam.com 
> 
> 
> -- 
> 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/ouDKTknbt7k/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/CAL3PpaVGzRL2j_rNYAhAsSPxw2F8gpotuLhpZiA3DOjkYXgDUw%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/50176E3F-E26F-413E-A4E3-E69195EE0021%40servicemax.com.
For more options, visit https://groups.google.com/d/optout.


How can I get inject environment from a freestyle job in pipeline job

2017-06-27 Thread stanley . shen
Hello, all

I am trying to trigger a freestyle job in pipeline and need to get a inject 
environment from that job.
Before with flow job, we can use thing like 

c = build("test job1")
uuid = c.build.properties["environment"]["uuid"]

But I didn't find a way to do this similar in pipeline script.

Is there any hint on it?

-- 
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/fa73e7a7-ea85-4eee-8f8e-037689bff630%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to mount volume correctly for jenkins docker slave

2017-03-10 Thread stanley . shen
Hello, all

I am having a docker image used for jenkins slave.

I tried to mount a volume from the host VM, but during job running, it 
fails to create things in mounted volume.

It shows permission denied, I added RW to the volume 
"/repo/test:/home/ubuntu/repo:rw".
The current user is ubuntu, I can create things using root user.

But for some reason, I want to continue to use ubuntu user but not the root 
user.
Is there any idea on how to make it work?


Thanks 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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/26067b58-e343-417c-bf8d-6bf135fb0d7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to distinct github push/merge event in github plugin

2017-02-23 Thread stanley . shen
Right now we are using github plugin to do something automatically.

When some code is pushed to repo, the job will be triggered.

But we have more specific requirement that the job is triggered only when 
we merge a PR.
Normal direct push will not trigger this job.


How can we do that? It seems in github plug we cannot tell them?

-- 
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/cdb885ec-f239-4453-b5bc-e3557354d62c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to initialize some bash helper function in all bash scripts

2017-02-04 Thread stanley . shen
Thanks for reply.

Yes, they works, but in both ways, we need some manual configuration on 
jenkins master/slave, and it makes the maintenance hard if there are quite 
lot such things.
I am trying to find a way so that it's wholly independent on jenkins 
master/slave so that even we add a new slaves or recreate the jenkins we 
don't need to do the configuration again.

Thanks,
Stanley






On Saturday, February 4, 2017 at 8:20:29 PM UTC+8, Victor Martinez wrote:
>
> Off the top of my head:
> - Add those files as part of the .bashrc file if you use ssh slaves. Confg 
> Managt tools might help you to configure that accordingly. Although this 
> approach is out of the Jenkins's scope.
> - https://wiki.jenkins-ci.org/display/JENKINS/Slave+Setup+Plugin might 
> help you
>
> Cheers
>

-- 
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/f48b947d-c584-4fc1-9646-3e37445bd586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to initialize some bash helper function in all bash scripts

2017-02-03 Thread stanley . shen
Hello, all

I am having a requirement to share some bash script function in nearly all 
jobs.
Right now I defined them as environment variable, and eval them in jobs as 
needed.

I was trying to find a more elegant way but got no lucky, for example in 
some where I can define some bash functions and they will be evaluated for 
all jobs.

Any suggestion on this?


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/c37d3451-1471-4bd0-a438-1229dab09fc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Is there a plugin to execute bash script in docker container

2017-01-23 Thread stanley . shen
Hello, all

I am having some jobs need to be executed exclusive in one jenkins node, 
the block plugin helps in this case.

But I am wondering if there is better solution, for example we can have 
docker container to execute such bash scripts.

I had a look in jenkins plugin but it seems I didn't find the one, I tried 
some plugin name relates to docker and I didn't see they helps.

Is there some plugin so that I can add build step and write some bash 
script and they are executed in docker container?

Or something like this?


Thanks for 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/d6c2ff2f-3d51-4171-8c22-0d701d2ca538%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to inject bash function to "execute bash" step for all jobs

2016-11-21 Thread stanley . shen
Hello, all

I am having one bash function and I want to use it in all "execute bash" 
step.

My Idea is that we can define the bash function in somewhere, and it can be 
inject to all "execute bash".

Then I no need to do some manual work to load this function and I can use 
it directly.

Is there any plugin can do such work?



Thanks 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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/0bf85b14-0c45-44cb-86a7-897e0b744a37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to limited user to certain jobs

2016-10-05 Thread stanley . shen
Hello, all

I am trying to limited some user to access certain jobs, and cannot see 
other jobs which are not related to them.

I am using the "Project-based Matrix Authorization Strategy" to access 
control, and it seems I cannot get what I want by this.
Also I try to create user view, but which is not shown by default to that 
user too.

I tried to look at plugins, but it seems I didn't find a proper one.

Anyone has met the same problem and how did you configure it?


Thanks in advance.

Thanks,
Stanley

-- 
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/6026b142-0209-465a-8605-9d2ce779feae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.