Multiple pipelines in Jenkinsfile

2016-05-29 Thread Bartłomiej Sacharski
I'm really hyped about the Jenkinsfiles - they make it much much easier to 
document and preserve project configuration.
However, all the examples that I've seen seem to use single pipeline.
I've tried to define different stages in separate node blocks, however they 
still were seen as a single pipeline.

Is it possible to define multiple pipelines in a single Jenkinsfile? Or 
maybe there's undocumented functionality for .jenkinsfile extension to 
handle such cases?

-- 
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/186f7a95-5d01-4f86-9a0c-e502ae05f48b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple pipelines in Jenkinsfile

2016-05-30 Thread Bartłomiej Sacharski
Basically, I would like to define multiple builds (different pipelines) 
with different stages and keep them in Jenkinsfile(s) in the repo.

On Monday, May 30, 2016 at 1:03:10 PM UTC+2, Norbert Lange wrote:
>
> Sorry, its not really clear to me what you expect.
> 1 Build = one Pipeline (execution)
> This Pipeline can be flexible and seperated horizontally with stages, and 
> vertically with parallel execution.
>
> Further, what will be ultimately run can be scripted from multiple scripts 
> (some could be "pipelines" on its own).
>
> Maybe you just mean the graphical representation?
>
> Am Sonntag, 29. Mai 2016 19:47:40 UTC+2 schrieb Bartłomiej Sacharski:
>>
>> I'm really hyped about the Jenkinsfiles - they make it much much easier 
>> to document and preserve project configuration.
>> However, all the examples that I've seen seem to use single pipeline.
>> I've tried to define different stages in separate node blocks, however 
>> they still were seen as a single pipeline.
>>
>> Is it possible to define multiple pipelines in a single Jenkinsfile? Or 
>> maybe there's undocumented functionality for .jenkinsfile extension to 
>> handle such cases?
>>
>

-- 
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/55c9a45f-ec5d-4782-b72e-263081f9c6b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple pipelines in Jenkinsfile

2016-05-30 Thread Bartłomiej Sacharski
Thanks. Will look into that.

On Monday, May 30, 2016 at 7:42:34 PM UTC+2, Norbert Lange wrote:
>
> So you have a git repository with pipeline (as script) and want to run 
> them all?
>
> Its possible, but Its somewhat a messy syntax.
> # global variable
> def Myclosure
>
> Node {
> # has to be in a node 
> Checkout scripts
> Myclosure = # load scripts and call them
> }
> # call the closure.
> Myclosure()
>
> See triggering manual load
> https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md
>
> I dont think its possible to execute plain pipeline scripts. You always 
> have to define a function (closure) thats stored and later invoked
>
>

-- 
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/6037e688-a1bc-46f7-8a47-1135feb1e4ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple pipelines in Jenkinsfile

2016-07-12 Thread Bartłomiej Sacharski


On Tuesday, July 12, 2016 at 8:16:27 PM UTC+2, Mike Rooney wrote:
>
> This need makes a lot of sense to us, where we have a couple related 
> sub-projects (as sub directories) in a single repository. It makes sense 
> that they each have their own pipeline jobs and can run on different 
> schedules. I've also seen cases similar to Alex's (hi Alex!) where there 
> are different tasks you want to do with a single repo that don't make sense 
> as one pipeline job that runs together (building/testing versus a nightly 
> cron-type task that runs in the repo).
>
> It is reasonable that a Jenkinsfile corresponds to a single Pipeline job, 
> because these are often associated with and run via a Pipeline job which 
> isn't a logical "parent" of these seed jobs. However, a great place for 
> this enhancement would be the Github Org / Bitbucket plugins that scan 
> repositories for Jenkinsfiles and are already in the place of creating 
> multiple Pipeline jobs. 
>

> My proposal would be: add a configuration option for the Github and 
> Bitbucket plugins which scan organizations for Jenkinsfiles. So, "Project 
> Recognizers -> Pipeline Jenkinsfile" would get a box for this which 
> defaults to "Jenkinsfile". Some logical configuration examples might be, 
> "Jenkinsfiles/*", "**/Jenkinsfile", "Jenkinsfile-*". Then the 
> Github/Bitbucket plugins can be pointed at an org, or just one repository, 
> and multiple Jenkinsfiles can exist which define different Pipeline jobs.
>
> Bartłomiej and Alex, would something like this satisfy your use cases as 
> well?
>
 

>
> - Michael
>
> On Sunday, May 29, 2016 at 12:47:40 PM UTC-5, Bartłomiej Sacharski wrote:
>>
>> I'm really hyped about the Jenkinsfiles - they make it much much easier 
>> to document and preserve project configuration.
>> However, all the examples that I've seen seem to use single pipeline.
>> I've tried to define different stages in separate node blocks, however 
>> they still were seen as a single pipeline.
>>
>> Is it possible to define multiple pipelines in a single Jenkinsfile? Or 
>> maybe there's undocumented functionality for .jenkinsfile extension to 
>> handle such cases?
>>
>
IMO just having an option to specify the name of Jenkinsfile would be 
enough - and I would rather try to implement this as a standalone thing, 
not connected to bitbucket/github plugins (we're using Jenkins with 
standalone repository, so source-agnostic solution would be best methinks). 
Of course that should be available in both single-branch and multi-branch 
variants of pipeline plugins

-- 
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/1271674e-def7-4e4a-9d15-a00e4972fc11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Interpolating variables in agent's docker parameter

2017-05-17 Thread Bartłomiej Sacharski
Hello.

I'm trying to mount specific directory to a stage-only agent that will use 
docker in a declarative pipeline.
It looks like this:

> agent {
>   docker {
> image "myimage:latest"
> args "-v ${WORKSPACE}/out:/var/www/api/out"
>   }
> }
>

However, this results in *No such property: WORKSPACE*. When I'm using 
*env.WORKSPACE* it is interpolated to *null* (also resulting in error).
Does that mean that interpolation is only available for steps, or is there 
another trick (without resorting to scripted pipeline) to interpolate 
string properly in this case?

-- 
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/fd047f0f-2aba-4700-a7b8-caa20658e681%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Interpolating variables in agent's docker parameter

2017-05-17 Thread Bartłomiej Sacharski

>
> (replies inline) 
>
> On Wed, 17 May 2017, Bart??omiej Sacharski wrote: 
>
> > Hello. 
> > 
> > I'm trying to mount specific directory to a stage-only agent that will 
> use 
> > docker in a declarative pipeline. 
> > It looks like this: 
> > 
> > > agent { 
> > >   docker { 
> > > image "myimage:latest" 
> > > args "-v ${WORKSPACE}/out:/var/www/api/out" 
> > >   } 
> > > } 
> > > 
> > 
> > However, this results in *No such property: WORKSPACE*. When I'm using 
> > *env.WORKSPACE* it is interpolated to *null* (also resulting in error). 
> > Does that mean that interpolation is only available for steps, or is 
> there 
> > another trick (without resorting to scripted pipeline) to interpolate 
> > string properly in this case? 
>
>
>
> I believe interpolationg may work here, but I doubt the workspace or env 
> would 
> be available since those are heavily agent-dependent. Basically this would 
> be 
> referencing a variable before it has been created. 
>
> - R. Tyler Croy 
>
> -- 
>  Code:  
>   Chatter:  
>  xmpp: rty...@jabber.org  
>
>   % gpg --keyserver keys.gnupg.net --recv-key 1426C7DC3F51E16F 
> -- 
>
 
Since this is an stage-only agent, would it be possible to define a new 
variable with that value on a pipeline level, or in previous stages, before 
there is a need to interpolate it for docker agent?

-- 
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/09f0f376-021c-4567-912e-68b15f84cd78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.