Reputation: 10279
I have a Multibranch Pipeline project which configures Jenkins Jobs based on a Jenkinsfile
per branch. The sourcecode is hosted on a Github Enterprise Server.
When I view the configuration of a branch which is created by the Jenkinsfile, I noticed that there is a option GitHub project
. This option allows to define the URL of the corresponding GitHub project.
I want to define this property via my Jenkinsfile in Pipeline syntax, but I don't know command to use and how.
Relevant parts of my Jenkinsfile:
pipeline {
agent {
docker {
image 'plinzen/android:latest'
label 'android'
}
}
triggers {
githubPush()
}
stages {
stage('build') {
steps {
checkout scm
sh './gradlew clean assembleDebug'
}
}
}
}
How can I define the GitHub project
properties via my Jenkinsfile
? I use the Jenkins GitHub Plugin in my project.
Upvotes: 0
Views: 157
Reputation: 2018
You can add a new agent node and add this code snippet to do your things. For more info you can refer to this url also. For Additional Info. Hope this helps.
git(
url: '[email protected]<repo_name>.git',
credentialsId: 'xpc',
branch: '${branch}'
)
Upvotes: 0