Executing a Shared Library script
To tell Jenkins to execute a pipeline from a shared library, you need to add code like the following to the Pipeline script definition:
The example uses
Mainframe_CI_Pipeline_from_Shared_Lib(
ispwStream: ISPW_Stream,
ispwApplication: ISPW_Application,
ispwRelease: ISPW_Release,
ispwAssignment: ISPW_Assignment,
ispwSrcLevel: ISPW_Src_Level,
ispwOwner: ISPW_Owner,
cesToken: 'xxxx',
jenkinsCesToken: 'xxxx',
hciConnectionId: 'xxxx',
hciToken: 'xxxx',
ccRepository: 'xxxx',
gitProject: 'xxxx',
gitCredentials: 'xxxx'
) )
where,
- @Library('RNU_Shared_Lib@JenkinsFTS') _ refers to the name of a Shared Library, with @JenkinsFTS in this example referring to the JenkinsFTS branch of the underlying Git repository. The trailing _ is required by Jenkins.
- Mainframe_CI_Pipeline_from_Shared_Lib refers to the name of the .groovy file in the vars folder of the GitHub repository, containing the pipeline code
- Within the brackets (...) parameters are passed to the pipeline script. Mainframe_CI_Pipeline_from_Shared_Lib expects a groovy Map, containing the following key:value pairs.
The parameters in this first set are specific to the individual execution of the pipeline. They correspond to the parameters defined in the pipeline configuration above and take the values from these pipeline parameters.
Key | Value | Description |
---|---|---|
ispwStream | ISPW_Stream | The ISPW_Stream parameter from the pipeline configuration above |
ispwApplication | ISPW_Application | The ISPW_Application parameter from the pipeline configuration above |
ispwRelease | ISPW_Release | The ISPW_Release parameter from the pipeline configuration above |
ispwAssignment | ISPW_Assignment | The ISPW_Assignment parameter from the pipeline configuration above |
ispwSrcLevel | ISPW_Src_Level | The ISPW_Src_Level parameter from the pipeline configuration above |
ispwOwner | ISPW_Owner | The ISPW_Owner parameter from the pipeline configuration above |
The second set of parameters may be specific to individual jobs/pipelines using the same set of scripts. They reference tokens and other IDs that have been defined during the Jenkins configuration phase. To determine the appropriate values to use, refer to the description of the pipeline parameters.
Key | Description |
---|---|
cesToken | CES Personal Access Token |
jenkinsCesToken | Jenkins Credentials ID for the CES Personal Access Token |
hciConnectionId | HCI Connection ID configured in the Common Configuration Plugin |
hciToken | The ID of the Jenkins Credential for the TSO ID that will used to execute the pipeline |
ccRepository | The Code Coverage Repository that the Pipeline will use |
gitProject | GitHub project/user used to store the Total Test Projects |
gitCredentials | Jenkins credentials for logging into git |