Jenkins 2.17, Viiolation-comments-to-stash-plugin 1.21.
The plugin fail to report to Bitbucket if using the CredentialsId. This is what I get in the log:
[CheckstyleCheck] ---
[CheckstyleCheck] --- Jenkins Violation Comments to Bitbucket Server ---
[CheckstyleCheck] ---
[CheckstyleCheck] bitbucketServerUrl: https://git.richrelevance.com
[CheckstyleCheck] projectKey: RR
[CheckstyleCheck] repoSlug: root
[CheckstyleCheck] pullRequestId: 257
[CheckstyleCheck] usernamePasswordCredentialsId: true
[CheckstyleCheck] username: false
[CheckstyleCheck] password: false
[CheckstyleCheck] createSingleFileComments: false
[CheckstyleCheck] createCommentWithAllSingleFileComments: true
[CheckstyleCheck] CHECKSTYLE with pattern .*/target/checkstyle-result.xml
[CheckstyleCheck] CSSLINT with pattern null
[CheckstyleCheck] LINT with pattern null
[CheckstyleCheck] FINDBUGS with pattern null
[CheckstyleCheck] JSHINT with pattern null
[CheckstyleCheck] PMD with pattern null
[CheckstyleCheck] CPPCHECK with pattern null
[CheckstyleCheck] RESHARPER with pattern null
[CheckstyleCheck] FLAKE8 with pattern null
[CheckstyleCheck] CPPLINT with pattern null
[CheckstyleCheck] XMLLINT with pattern null
[CheckstyleCheck] PERLCRITIC with pattern null
[CheckstyleCheck] PITEST with pattern null
[CheckstyleCheck] ANDROIDLINT with pattern null
[CheckstyleCheck] Running Jenkins Violation Comments To Bitbucket Server
[CheckstyleCheck] Will comment 257
[CheckstyleCheck] Workspace: /jenkins/workspace/root_pipeline
[CheckstyleCheck] Found 5 violations from ViolationConfig [reporter=CHECKSTYLE, pattern=.*/target/checkstyle-result.xml].
[CheckstyleCheck] Jenkins has not been started, or was already shut down
[FindbugsCheck] ---
[FindbugsCheck] --- Jenkins Violation Comments to Bitbucket Server ---
[FindbugsCheck] ---
[FindbugsCheck] bitbucketServerUrl: https://git.richrelevance.com
[FindbugsCheck] projectKey: RR
[FindbugsCheck] repoSlug: root
[FindbugsCheck] pullRequestId: 257
[FindbugsCheck] usernamePasswordCredentialsId: true
[FindbugsCheck] username: true
[FindbugsCheck] password: true
[FindbugsCheck] createSingleFileComments: true
[FindbugsCheck] createCommentWithAllSingleFileComments: false
[FindbugsCheck] CHECKSTYLE with pattern null
[FindbugsCheck] CSSLINT with pattern null
[FindbugsCheck] LINT with pattern null
[FindbugsCheck] FINDBUGS with pattern .*/target/findbugsXml.xml
[FindbugsCheck] JSHINT with pattern null
[FindbugsCheck] PMD with pattern null
[FindbugsCheck] CPPCHECK with pattern null
[FindbugsCheck] RESHARPER with pattern null
[FindbugsCheck] FLAKE8 with pattern null
[FindbugsCheck] CPPLINT with pattern null
[FindbugsCheck] XMLLINT with pattern null
[FindbugsCheck] PERLCRITIC with pattern null
[FindbugsCheck] PITEST with pattern null
[FindbugsCheck] ANDROIDLINT with pattern null
[FindbugsCheck] Running Jenkins Violation Comments To Bitbucket Server
[FindbugsCheck] Will comment 257
[FindbugsCheck] Workspace: /jenkins/workspace/root_pipeline
[FindbugsCheck] Found 3 violations from ViolationConfig [reporter=FINDBUGS, pattern=.*/target/findbugsXml.xml].
[FindbugsCheck] Using username / password
[FindbugsCheck] Will comment PR RR/root/257 on https://git.richrelevance.com
step([$class: 'ViolationsToBitbucketServerRecorder',
config: [bitbucketServerUrl: 'https://git.richrelevance.com',
createCommentWithAllSingleFileComments: true, createSingleFileComments: false,
projectKey: PULL_REQUEST_TO_REPO_PROJECT_KEY, pullRequestId: PULL_REQUEST_ID,
repoSlug: PULL_REQUEST_TO_REPO_SLUG, useUsernamePassword: false,
useUsernamePasswordCredentials: true,
usernamePasswordCredentialsId: 'XXX',
violationConfigs: [[pattern: '.*/target/checkstyle-result.xml', reporter: 'CHECKSTYLE']]]])
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: 'XXX',
passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME']]) {
step([$class: 'ViolationsToBitbucketServerRecorder',
config: [bitbucketServerUrl: 'https://git.richrelevance.com',
createCommentWithAllSingleFileComments: false, createSingleFileComments: true,
projectKey: PULL_REQUEST_TO_REPO_PROJECT_KEY, pullRequestId: PULL_REQUEST_ID,
repoSlug: PULL_REQUEST_TO_REPO_SLUG, useUsernamePassword: true,
useUsernamePasswordCredentials: false,
username: env.USERNAME,
password: env.PASSWORD,
usernamePasswordCredentialsId: 'XXX',
violationConfigs: [[pattern: '.*/target/findbugsXml.xml', reporter: 'FINDBUGS']]]])
}
Note that on findbugs I'm setting both user/password and credentials, because I used Replay to test if the authentication mode made any difference.