Tuesday, 6 October 2015

Execute Shell Script as a Jenkins Job


Create a Jenkins job, ( Create a free-style software project)
In the configuration of that job there is a "Build" section with "Add build step" pulldown.
Add a "Execute Shell" step, and  insert your script path.
sudo sh /path/to/script

Allow jenkins to run the script in /etc/sudoers
jenkins    ALL = NOPASSWD: /path/to/script
jenkins ALL=(ALL) NOPASSWD:ALL
jenkins ALL=(ALL) ALL

Now run the Jenkin Job

Hope this helps!



No comments:

Post a comment