Ask Your Question

Revision history [back]

To reference a particular branch in a shared Jenkins library, follow these steps:

  1. Go to your pipeline or job configuration in Jenkins.
  2. Under the pipeline or job configuration, click on the "Pipeline Script" tab.
  3. In the pipeline script, you can use the "@Library" annotation to specify the name of the shared library and the branch to use. The syntax for this annotation is as follows:
@Library('my-shared-library@branch-name') _
  1. Replace "my-shared-library" with the name of your shared library and "branch-name" with the name of the specific branch you want to use.
  2. Save the pipeline or job configuration.

Once you have referenced the particular branch in your pipeline or job, any code changes or updates made to that branch in your shared library will be automatically reflected in your pipeline or job.