Complete the code to trigger a build on pull request creation.
pipeline {
agent any
triggers {
[1] {
orgWhitelist('github.com')
}
}
stages {
stage('Build') {
steps {
echo 'Building pull request...'
}
}
}
}The githubPullRequest trigger starts a build when a pull request is created or updated.
Complete the code to specify the branch source for the pull request build.
pipeline {
agent any
triggers {
githubPullRequest {
[1] 'origin'
}
}
stages {
stage('Test') {
steps {
echo 'Testing pull request branch...'
}
}
}
}The branchFilter option specifies which branches to build for pull requests.
Fix the error in the pull request build trigger configuration.
pipeline {
agent any
triggers {
githubPullRequest {
orgWhitelist('github.com')
[1] 'master'
}
}
stages {
stage('Deploy') {
steps {
echo 'Deploying pull request...'
}
}
}
}The correct option to filter branches is branchFilter. Using 'branch' or 'branchName' causes errors.
Fill both blanks to configure the pull request trigger with a whitelist and a trigger phrase.
pipeline {
agent any
triggers {
githubPullRequest {
[1]('github.com')
[2]('OK to test')
}
}
stages {
stage('Verify') {
steps {
echo 'Verifying pull request...'
}
}
}
}orgWhitelist restricts which organizations can trigger builds. triggerPhrase allows builds to start when a specific comment is made on the pull request.
Fill all three blanks to create a pull request build that filters branches, uses a whitelist, and triggers on a phrase.
pipeline {
agent any
triggers {
githubPullRequest {
[1]('origin/develop')
[2]('my-org')
[3]('run tests')
}
}
stages {
stage('Build and Test') {
steps {
echo 'Building and testing pull request...'
}
}
}
}This configuration filters branches with branchFilter, restricts organizations with orgWhitelist, and triggers builds on a comment phrase with triggerPhrase.