Loading scripts from Workflow resources

24 views
Skip to first unread message

Mark Bidewell

unread,
Jan 10, 2017, 8:38:01 AM1/10/17
to Jenkins Users
I am looking at the external libraries capabilities of Jenkins Workflow.  Our workflow uses python scripts for portions of the build process.  Can this scripts be stored as resources and a path to them retrieved via workflow?  Right now the scripts are in a directory on the server not under Jenkins control.

Thanks.

Ramanathan Muthaiah

unread,
Jan 10, 2017, 10:06:07 AM1/10/17
to Jenkins Users


On Tuesday, January 10, 2017 at 7:08:01 PM UTC+5:30, Mark Bidewell wrote:
I am looking at the external libraries capabilities of Jenkins Workflow.  Our workflow uses python scripts for portions of the build process.  Can this scripts be stored as resources and a path to them retrieved via workflow?  Right now the scripts are in a directory on the server not under Jenkins control.

Two (actually three) possible options:

1) Explore "Managed Scripts" plugin (I suppose this supports only shell scripts) alongwith Config File Provider plugin.

2) If you have Pipeline plugin installed, then these Python scripts can be invoked using step, "sh" but this will demand your scripts in version control.

3) If the Jenkins job is a freestyle project, then the entire script can be added as a 'build step' ; but then, every change to the build script (for bug fixes or new improvements), job needs to be modified and the script content should be replaced.

/Ram

Mark Bidewell

unread,
Jan 10, 2017, 12:57:06 PM1/10/17
to Jenkins Users
Thanks, I do #2 right now, but the scripts are in a separate version control.  What I would like to do is have the scripts checked out by Jenkins with the external library so that they are auto-updated.  Is there a variable or step that gives the path to the location where the library files are checked out?

Indra Gunawan (ingunawa)

unread,
Jan 10, 2017, 1:16:11 PM1/10/17
to jenkins...@googlegroups.com

In Jenkins 2.x you go to “Manage Jenkins” -> “Configure System” and configure the “Global Pipeline libraries” SCM location:

 

--
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/f0670d45-f022-45e8-8e34-abb47ad8c508%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages