githubCreatePullRequest¶
Create a pull request on GitHub
Prerequisites¶
You need to create a personal access token within GitHub and add this to the Jenkins credentials store.
Please see GitHub documentation for details about creating the personal access token.
Parameters¶
Overview - Step¶
Name | Mandatory | Additional information |
---|---|---|
base | yes | |
body | yes | |
head | yes | |
owner | yes | |
repository | yes | |
script | (yes) | reference to Jenkins main pipeline script |
title | yes | |
token | (yes) | pass via ENV, Vault or Jenkins credentials (githubTokenCredentialsId ) |
apiUrl | no | |
assignees | no | |
labels | no | |
serverUrl | no | |
verbose | no | activates debug output |
Overview - Execution Environment¶
Orchestrator-specific only
These parameters are relevant for orchestrator usage and not considered when using the command line option.
Name | Mandatory | Additional information |
---|---|---|
Details¶
apiUrl¶
Set the GitHub API url.
Scope | Details |
---|---|
Aliases | githubApiUrl |
Type | string |
Mandatory | no |
Default | https://api.github.com |
Secret | no |
Configuration scope |
|
Resource references | none |
assignees¶
Login names of users to which the PR should be assigned to.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_assignees (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
base¶
The name of the branch you want the changes pulled into.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_base (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
body¶
The description text of the pull request in markdown format.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_body (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
head¶
The name of the branch where your changes are implemented.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_head (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
labels¶
Labels to be added to the pull request.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_labels (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
owner¶
Name of the GitHub organization.
Scope | Details |
---|---|
Aliases | githubOrg |
Type | string |
Mandatory | yes |
Default | $PIPER_owner (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: github/owner |
repository¶
Name of the GitHub repository.
Scope | Details |
---|---|
Aliases | githubRepo |
Type | string |
Mandatory | yes |
Default | $PIPER_repository (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: github/repository |
script¶
The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the this
parameter, as in script: this
. This allows the function to access the commonPipelineEnvironment
for retrieving, e.g. configuration parameters.
Scope | Details |
---|---|
Aliases | - |
Type | Jenkins Script |
Mandatory | yes |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
serverUrl¶
GitHub server url for end-user access.
Scope | Details |
---|---|
Aliases | githubServerUrl |
Type | string |
Mandatory | no |
Default | https://github.com |
Secret | no |
Configuration scope |
|
Resource references | none |
title¶
Title of the pull request.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_title (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
token¶
GitHub personal access token as per https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line
Scope | Details |
---|---|
Aliases | - githubToken - access_token |
Type | string |
Mandatory | yes |
Default | $PIPER_token (if set) |
Secret | yes |
Configuration scope |
|
Resource references | Jenkins credential id: id: githubTokenCredentialsId Vault resource: name: githubVaultSecretName default value: github Vault paths:
|
verbose¶
verbose output
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
githubTokenCredentialsId¶
Jenkins 'Secret text' credentials ID containing token to authenticate to GitHub.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Configuration scope |
|
Description¶
This step allows you to create a pull request on Github.
It can for example be used for GitOps scenarios or for scenarios where you want to have a manual confirmation step which is delegated to a GitHub pull request.
Usage¶
We recommend to define values of step parameters via .pipeline/config.yml file.
In this case, calling the step is essentially reduced to defining the step name.
Calling the step can be done either in an orchestrator specific way (e.g. via a Jenkins library step) or on the command line.
library('piper-lib-os')
githubCreatePullRequest script: this
piper githubCreatePullRequest