Re: [workflow-plugin] Groovy CPS DSL from SCM and Stash notification trigger

2015-04-22 Thread Tom Deblauwe
Hello again,

Just for the record: I solved it now by putting my jobs under the workflows 
git repo, so in a directory like this: 
"src/com/bla/jobs/BuildApplication.groovy" and then in that script I could 
make a "start()" function and then call that in the job like this:

def task = new com.bla.jobs.BuildApplication()
task.start()

So now it works with the stash git commit hook.
Best regards,
Tom,

On Tuesday, 21 April 2015 09:22:40 UTC+2, Tom Deblauwe wrote:
>
> Hello,
>
> It seems one (not so good) solution is to disable giving the SHA1 to 
> jenkins in the hook on the Stash server that notifies Jenkins. There is an 
> option you can disable so that the SHA1 is not given when triggering the 
> corresponding jenkins job. Not optimal because Stash is not in control 
> anymore about what must be built.
>
> Best regards
> Tom,
>
> On Monday, 20 April 2015 12:47:13 UTC+2, Tom Deblauwe wrote:
>>
>> Hello,
>>
>> I am using the "groovy CPS DSL from SCM" as my configuration for my 
>> workflow. This works well and reads the scripts from my "workflows.git" 
>> reposity. 
>>
>> In the workflow script itself, I start with:
>>
>> node {
>>   git branch: '**', changelog: false, poll: true, url: 
>> 'ssh://git@stash:7999/my/project.git'
>> }
>>
>> I have configured my Stash gitserver to notify Jenkins about a push to my 
>> code repository. In the configuration of my workflow job, I need to enable 
>> "Poll SCM" but without any timings defined for this to work.
>> So the problem is, that I get a notification from Stash with a commit id 
>> from the "project.git" repository(as expected), but jenkins tries to 
>> checkout that commit in the "workflows.git" repository, NOT the 
>> "project.git" repository. It doesn't exist there, so the job fails.
>>
>> So how can I have my workflows scripts in a git repository, and at the 
>> same time use an external trigger to start the build?
>>
>> Best regards,
>> Tom,
>>
>

-- 
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/d06e9ef9-81ba-420a-a5ab-b080a38e1116%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [workflow-plugin] Groovy CPS DSL from SCM and Stash notification trigger

2015-04-21 Thread Tom Deblauwe
Hello,

It seems one (not so good) solution is to disable giving the SHA1 to 
jenkins in the hook on the Stash server that notifies Jenkins. There is an 
option you can disable so that the SHA1 is not given when triggering the 
corresponding jenkins job. Not optimal because Stash is not in control 
anymore about what must be built.

Best regards
Tom,

On Monday, 20 April 2015 12:47:13 UTC+2, Tom Deblauwe wrote:
>
> Hello,
>
> I am using the "groovy CPS DSL from SCM" as my configuration for my 
> workflow. This works well and reads the scripts from my "workflows.git" 
> reposity. 
>
> In the workflow script itself, I start with:
>
> node {
>   git branch: '**', changelog: false, poll: true, url: 
> 'ssh://git@stash:7999/my/project.git'
> }
>
> I have configured my Stash gitserver to notify Jenkins about a push to my 
> code repository. In the configuration of my workflow job, I need to enable 
> "Poll SCM" but without any timings defined for this to work.
> So the problem is, that I get a notification from Stash with a commit id 
> from the "project.git" repository(as expected), but jenkins tries to 
> checkout that commit in the "workflows.git" repository, NOT the 
> "project.git" repository. It doesn't exist there, so the job fails.
>
> So how can I have my workflows scripts in a git repository, and at the 
> same time use an external trigger to start the build?
>
> Best regards,
> Tom,
>

-- 
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/492c4448-a10d-40c1-85dc-da07af0e477d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[workflow-plugin] Groovy CPS DSL from SCM and Stash notification trigger

2015-04-20 Thread Tom Deblauwe
Hello,

I am using the "groovy CPS DSL from SCM" as my configuration for my 
workflow. This works well and reads the scripts from my "workflows.git" 
reposity. 

In the workflow script itself, I start with:

node {
  git branch: '**', changelog: false, poll: true, url: 
'ssh://git@stash:7999/my/project.git'
}

I have configured my Stash gitserver to notify Jenkins about a push to my 
code repository. In the configuration of my workflow job, I need to enable 
"Poll SCM" but without any timings defined for this to work.
So the problem is, that I get a notification from Stash with a commit id 
from the "project.git" repository(as expected), but jenkins tries to 
checkout that commit in the "workflows.git" repository, NOT the 
"project.git" repository. It doesn't exist there, so the job fails.

So how can I have my workflows scripts in a git repository, and at the same 
time use an external trigger to start the build?

Best regards,
Tom,

-- 
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/8ff7ed68-2642-4c65-9c84-232217ed185c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [workflow-plugin] Using Closures in workflow scripts not allowed?

2015-03-04 Thread Tom Deblauwe
Hello,

I found my problem. I was using a try-catch in my real production code, so 
the error was catched by my code, and not the sandbox, and I could not 
approve the exception. Now I made a little test to post here, and there I 
don't have the try-catch, which makes the script security catch the error. 
Now I could approve it, and now my original production code works.

Best regards,
Tom,

On Tuesday, 3 March 2015 17:07:06 UTC+1, Tom Deblauwe wrote:
>
> Hello group,
>
> I was trying to use a groovy construct where I could give a closure with 
> an argument, and pass that closure to a function, something like this below:
>
> class Test {
>   int num = 5
> }
>
> def runit(def func) {
>   echo "Will run it"
>   def obj = new Test()
>   func(obj)
>   echo "Ran it"
> }
>
> node {
>   runit({ obj ->
> echo "I am running:" + obj.num
>   })
> }
>
> But I get an access error from the script sandbox. So I checked but there 
> were no pending approvals in the jenkins management configuration. 
> So I don't know how to handle such a situation?
>
> I got this error:
>
> org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts 
> not permitted to use method groovy.lang.Closure call java.lang.Object
>   at 
> org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:150)
>   at 
> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:77)
>   at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:103)
>   at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:100)
>   at 
> com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:15)
>
> ..
>
> Is there some other construct I can use to achieve the same?
> Thanks,
> Best regards,
> Tom,
>

-- 
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/f1e84a33-6981-4a24-910a-369e0ad8b5de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[workflow-plugin] Using Closures in workflow scripts not allowed?

2015-03-03 Thread Tom Deblauwe
Hello group,

I was trying to use a groovy construct where I could give a closure with an 
argument, and pass that closure to a function, something like this below:

class Test {
  int num = 5
}

def runit(def func) {
  echo "Will run it"
  def obj = new Test()
  func(obj)
  echo "Ran it"
}

node {
  runit({ obj ->
echo "I am running:" + obj.num
  })
}

But I get an access error from the script sandbox. So I checked but there 
were no pending approvals in the jenkins management configuration. 
So I don't know how to handle such a situation?

I got this error:

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts 
not permitted to use method groovy.lang.Closure call java.lang.Object
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:150)
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:77)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:103)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:100)
at 
com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:15)

..

Is there some other construct I can use to achieve the same?
Thanks,
Best regards,
Tom,

-- 
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/81790551-42dc-404b-bd87-5825b5e7202e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


buildflow: node selection

2013-07-05 Thread Tom Deblauwe
hello list,

We are using the buildflow plugin succesfully. We have one job with parameters 
and also associated with a label, and italso has the enable concurrent builds 
option set. We also have multiple buildslaves with the same label. We expected  
 that the buildflow jobs are scheduled evenly across the buildslaves. however, 
always the same buildnode is used. with regular freestyle jobs we do not have 
this issue. Is there a solution?

thanks,
best regards
Tom

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Build flow plugin: attempt at modular approach

2013-05-29 Thread Tom Deblauwe
Hello,

I want to create a modularized system for my jobs in order for them to be 
maintainable. I looked at all sorts of template plugins and generators, but 
it is either difficult(XML groovy script transformation?) or not really 
reuseable in my opinion. Now I stumbled upon the build flow plugin which 
made it possible! I wanted to share my approach because I could not find 
much about it on the net. Also I was hoping the list would give me some 
feedback. The setup is like this:

I have a number of "BuildStep-" prefixed jobs. I have these:
=> BuildStep-Checkout-Source
  - uses git to check out a branch
=> BuildStep-Compile
  - runs a shell script
=> BuildStep-Test
  - runs a shell script with tests

Now all those buildsteps have in their "Advanced" setting the "Custom 
workspace" set to "$ParentWorkspace". Also the "Allow concurrent builds if 
needed" setting is checked.

Then when I want to create a job which uses these jobs. I need to create a 
Build flow job now with the DSL script like this:

build("BuildStep-Checkout-Source", ParentWorkspace:build.workspace, 
GitBranch: my_branch)
build("BuildStep-Compile", ParentWorkspace:build.workspace)
build("BuildStep-Test", ParentWorkspace:build.workspace)

Now the nice thing is that your steps are loosely coupled. And that you can 
use the regular available configuration pages of the buildsteps, without 
the need for difficult scripting or XML.
Also note that if you want something like default parameters for a 
buildstep, that you can specify the parameter in the buildstep explicitly 
and there you can use a default value.

So now I just need to test if something like e-mails to the people who have 
broken the build will work ok :)

Another pitfall: the Buildstep jobs are executed on random executors/nodes. 
So you need another trick until this is fixed in the build flow plugin. You 
need the 
https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin. 
Specify for each buildstep such a node parameter and name it e.g. "Node". 
Then you need to adapt the build() commands like this:

build("BuildStep-Checkout-Source", ParentWorkspace:build.workspace, 
Node:build.environment["NODE_NAME"], GitBranch: my_branch)
build("BuildStep-Compile", ParentWorkspace:build.workspace, 
Node:build.environment["NODE_NAME"])
build("BuildStep-Test", ParentWorkspace:build.workspace, 
Node:build.environment["NODE_NAME"])

So I think this is pretty good already, but what do you guys think?

Thanks,
Best regards,
Tom,

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clover Plug-in, Statement Coverage is always 0.

2013-05-24 Thread Tom Deblauwe
Hello,

I have the same problem here but no solution.

Notice that you also can use "covhtml" with the same syntax as "bullshtml" 
to generate even better output html than bullshtml.

Statement coverage is really unneeded according to the bullseye guys. The 
best solution would possibly be that the bullseye guys either make a 
jenkins plugin or that they generate clover output files :)

best regards,
Tom,

On Monday, 4 June 2012 13:33:08 UTC+2, Paul Schwann wrote:
>
> Hi there!
>
> I am using the clover plugin along with google's bullshtml to create a 
> test coverage report in Jenkins out of my Bullseye Coverage data. It works 
> very nice, the data are shown and in snyc with what Bullseye's own browser 
> shows. There is one little detail though: Clover shows Conditional, Method 
> and Statement coverage. For some reason, the statement coverage is always 0 
> (the other two are fine)
>
> Can I:
> 1) somehow make the plugin to show a value for statement coverage? 
> or (if not)
> 2) somehow disable the "statement" coverage statistics in the clover 
> plug-in?
>
> Thanks for your answer(s)!
>
> Regards,
> Paul
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.