Take a look at Pipeline Global 
Library https://github.com/jenkinsci/workflow-cps-global-lib-plugin
I started with the same problem as you now have and solved it by using 
global pipeline scripts.
These global script are stored in Jenkins git repository workflowLibs.git 
and can be accessed within all pipeline scripts.

onsdag 15. juni 2016 12.46.26 UTC+2 skrev Christian Ditscher følgende:
>
> Hello, 
>
> I use a seperate reopsitory for my pipeline script. Multiple Jenkins Jobs 
> use this pipeline script to built different Projects. For better 
> maintainability 
> the pipeline itself consists of a main script and multiple other sript 
> files in which I implemented the different stages.
> The pipelines are started by the built in function of Jenkins to checkout 
> a Pipelinescript from SCM. Here I have configured the main pipeline script 
> to be run. This main script then uses "load" to start the different stages.
>
> The thing that annoys me is that the "load" command needs to be contained 
> inside a node {..} block.  This means I have to checkout the script files 
> again on a node to "load" it. The scripts are already checked out on the 
> master after "loading the script from SCM". I simply want to use the 
> Flyweight executor to run the content of the stage script).  A bad solution 
> would be to have the whole pipeline in one big script file. This would work 
> but is really confusing.
>
> Is there a way to tell the main script (which runs on the master) to 
> "insert" another groovy file (already present on master)?
>
> Any Ideas? 
>
> Thanks 
> Chris
>
>
>
> *Note:*
> In the Pipeline documentation I found the following but this still needs 
> to checkout the scripts to a new node every time I want to load something. 
>
>
>
> *node {
>     git '…'
>     load 'pipeline.groovy'
> }()*
>
> Ok, I could dedicate a single node like node('pipelineControl') so the 
> scripts have to be be checked out only once but this solution still doesn't 
> convince me.
>
>

-- 
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/7f85a62a-0e8f-43fa-9adb-8cdb3df13239%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to