From the course: Intermediate Jenkins: Automate, Integrate, and Secure CI/CD Workflows at Scale
Unlock this course with a free trial
Join today to access over 25,200 courses taught by industry experts.
Run scripts from the pipeline - Jenkins Tutorial
From the course: Intermediate Jenkins: Automate, Integrate, and Secure CI/CD Workflows at Scale
Run scripts from the pipeline
Jenkins files can be stored in the repo along with scripts and other files needed to build a project. This allows Jenkins to access scripts directly from the pipelines. Jenkins is an automation engine, not a repository server, so it makes sense to use scripts stored in the repo for commands and logic that might be too complex to run directly in the pipeline. Combining multiple steps into a single script also keeps the pipeline definition clear and easy to debug. Put together, these two concepts help Jenkins to scale along with the complexity of your projects. I've created a new GitHub repo and added the exercise files for this lesson. The repo has a script that calculates a Fibonacci sequence. And a Jenkins file with a pipeline configuration that calls the script. The pipeline has three stages that show the different paths that can be used to call the script. A relative path can be used to access files from the root of the project. A complete path can be used by adding the workspace…