Jenkinsfile
Hi all,
I'm strugling to get this plugin working in my Jenkinsfile CI Setup. In Jenkins I've created a global maven settings config, added the git-repo (bitbucket) credentials to this global maven settings And then use this in the following way:
`
stage('Release') {
when {
branch 'master'
}
steps {
withMaven(
maven: 'Maven 3.5.0',
globalMavenSettingsConfig: 'f0fc6dcf-992a-4b63-9323-fbe146d310f5',
options: [artifactsPublisher(), junitPublisher(healthScaleFactor: 1.0, keepLongStdio: true)]) {
sh 'mvn releaser:release'
}
}
}
`
This sadly results in: Authentication is required but no CredentialsProvider has been registered
How do you guys run this plugin in Jenkins? What am I doing wrong?
Thx Mark
Auth is done with ssh, so first the box needs a key pair and the public key needs to be granted access in your git repo.
I'm not an expert with Jenkins, but I think when setting up the git repo you can select a key. I'm not sure how Jenkins finds the keys though.
There is another option, to use personal access token, then use token as password in your settings.xml, and have that settings.xml as a secret file in Jenkins credentials and use that in your Jenkinsfile.
Something like
stage('Release') { withCredentials([file(credentialsId: 'settingsWithGitSeverSection', variable: 'MAVEN_SETTINGS')]) { //some code here.... }
This is just one option, another option would be to use regular key/password secret and in your build node, you need to add the appropriate server section to your settings.xml.