Configuring the Pipeline project to use scripts from an SCM

You can configure a Pipeline project to use pipeline scripts from a Source Code Management (SCM) source to run tests from Jenkins.

Before you begin

You must have completed the following tasks:

  • Installed the Integration Tester Jenkins Plugin. See Setting up the integration with Jenkins.
  • Created an Agent in Jenkins.
  • Created a Pipeline project in Jenkins and added the stage under which you want to add a build step.
  • Created a pipeline script and committed the script to a Git repository.
  • Been granted administrator permission of the Jenkins server to add credentials into Jenkins.
  • Added your GitHub credentials into Jenkins.

About this task

If your pipeline scripts are complex, you can then write the script without using the Jenkins UI. You must commit that script file into your Git repository. During the Pipeline build process, Jenkins checks out the script file from the Git repository and runs your Pipeline project.

Procedure

  1. Open the Jenkins Pipeline project on the Jenkins Dashboard, and then click Configure.
  2. Select the Pipeline tab.
  3. Select the Pipeline script from SCM option in the Definition field.
  4. Select the Git option from the drop-down list in the SCM field.
  5. Enter the URL of the Git repository in the Repository URL field where you stored your pipeline script.
  6. Select the credentials of the Git repository from the drop-down list.
  7. Enter the branch name of the Git repository in the Branch Specifier field, if the script is contained in a branch in the repository.
  8. Enter the path of the script that you stored in the Git repository in the Script path field.
  9. Click Save.

Results

You have configured the build job with the script that was in a remote repository to use in your Pipeline project.

What to do next

You can run the build configured in your Pipeline project. See Running tests from Jenkins.