Comments (10)
Looks like there were not violations in the files that were changed in the pull request.
The Will comment PR
does not mean there actually are violations in the changed content.
from violation-comments-to-stash-plugin.
Does commentOnlyChangedContent: false
not mean it will comment all violations regardless of whether it is in changed content? If not, can you elaborate on what the option does?
from violation-comments-to-stash-plugin.
from violation-comments-to-stash-plugin.
Hello.
I am also stuck with the plugin commenting nothing, even though I was adding warnings on purpose.
I am using Multibranch pipeline project with declarative Jenkinsfile.
Here is the output from build console:
...
[Pipeline] sh
[jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA] Running shell script
+ ./gradlew check
...
> Task :common:checkstyleMain
Checkstyle rule violations were found. See the report at: file:///srv/jenkins/workspace/jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA/common/build/reports/checkstyle/main.html
Checkstyle files with violations: 1
Checkstyle violations by severity: [warning:2]
...
BUILD SUCCESSFUL in 14s
7 actionable tasks: 5 executed, 2 up-to-date
[Pipeline] checkstyle
[CHECKSTYLE] Collecting checkstyle analysis files...
[CHECKSTYLE] Searching for all files in /srv/jenkins/workspace/jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA that match the pattern **/reports/checkstyle/*.xml
[CHECKSTYLE] Parsing 2 files in /srv/jenkins/workspace/jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA
[CHECKSTYLE] Successfully parsed file /srv/jenkins/workspace/jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA/common/build/reports/checkstyle/main.xml with 2 unique warnings and 0 duplicates.
[CHECKSTYLE] Successfully parsed file /srv/jenkins/workspace/jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA/impl/build/reports/checkstyle/main.xml with 108 unique warnings and 0 duplicates.
Skipping warnings blame since pipelines do not have an SCM link.%n
[CHECKSTYLE] Computing warning deltas based on reference build #2
[Pipeline] findbugs
[FINDBUGS] Collecting findbugs analysis files...
[FINDBUGS] Searching for all files in /srv/jenkins/workspace/jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA that match the pattern **/reports/findbugs/*.xml
[FINDBUGS] Parsing 2 files in /srv/jenkins/workspace/jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA
[FINDBUGS] Successfully parsed file /srv/jenkins/workspace/jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA/common/build/reports/findbugs/main.xml with 0 unique warnings and 0 duplicates.
Skipping warnings blame since pipelines do not have an SCM link.%n
[FINDBUGS] Computing warning deltas based on reference build #2
...
[Pipeline] step
---
--- Jenkins Violation Comments to Bitbucket Server ---
---
bitbucketServerUrl: https://***/bitbucket
projectKey: JEN
repoSlug: jenkins
pullRequestId: 14
credentialsId: true
createSingleFileComments: true
createCommentWithAllSingleFileComments: true
commentOnlyChangedContent: false
commentOnlyChangedContentContext: 5
minSeverity: INFO
keepOldComments: false
Pull request: 14
Workspace: /srv/jenkins/workspace/jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA
PR: JEN/jenkins/14 on https://***/bitbucket
[Pipeline] }
...
I have tried to add additional logger through Jenkins web GUI with logger 'org.jenkinsci.plugins.jvctb' set to ALL, but had no luck.
Can you please poke me the right direction?
Thank you very much for your help.
from violation-comments-to-stash-plugin.
How did you configure the plugin? Looks like you have no patterns defined.
How did you configure the job? Do you perform the merge before check
from violation-comments-to-stash-plugin.
Important stages from my Jenkinsfile:
stages {
stage('Print parameters') {
steps {
echo "pullRequestId='$params.pullRequestId'"
echo "toBranch='$params.toBranch'"
echo "toHash='$params.toHash'"
echo "mergeCommit='$params.mergeCommit'"
echo "fromHash='$params.fromHash'"
echo "action='$params.action'"
echo "author='$params.author'"
echo "reviewers='$params.reviewers'"
}
}
stage('Read commit and branch') {
when {
expression { params.pullRequestId }
}
// commit hash is used later
steps {
sh 'git rev-parse HEAD > commit'
echo "On branch ${env.BRANCH_NAME} commit ${readFile('commit').trim()}."
}
}
stage('Merge pull request') {
// when we know a pull request target we merge it
when {
expression { params.toHash }
}
steps {
echo "Merging commit ${readFile('commit').trim()} with commit ${params.toHash}"
sh "git reset --hard ${params.toHash}"
sh "git merge ${readFile('commit').trim()} --no-commit"
}
}
stage('Static analysis') {
steps {
echo 'Running static analysis...'
sh './gradlew check'
}
post {
always {
checkstyle pattern: '**/reports/checkstyle/*.xml'
findbugs pattern: '**/reports/findbugs/*.xml'
}
}
}
stage('Report violations') {
steps {
echo "Reporting static analysis violations for pull request ${params.pullRequestId}."
step([
$class: 'ViolationsToBitbucketServerRecorder',
config: [
bitbucketServerUrl: 'https://***/bitbucket',
createCommentWithAllSingleFileComments: true,
createSingleFileComments: true,
commentOnlyChangedContent: false,
commentOnlyChangedContentContext: 5,
pullRequestId: params.pullRequestId,
useUsernamePassword: false,
username: '',
password: '',
useUsernamePasswordCredentials: true,
credentialsId: 'b90c9363-25b9-4ebe-834e-f4f485a24bd7',
projectKey: 'JEN',
repoSlug: 'jenkins',
violationConfigs: [
[ pattern: '.*/checkstyle/.*\\.xml$', reporter: 'CHECKSTYLE' ],
[ pattern: '.*/findbugs/.*\\.xml$', reporter: 'FINDBUGS' ]
]
]
])
}
}
}
Adding some additional info from Jenkins build output:
ullRequestId='14'
toBranch='develop'
toHash='99eb9f28280a04a6cc20b3dc4b63a71031f8cd55'
fromHash='d40a7eaf2b38207aca3e7dee28b4c417b7e4fd2b'
action='RESCOPED_FROM'
...
[Pipeline] stage
[Pipeline] { (Read commit and branch)
[Pipeline] sh
[jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA] Running shell script
+ git rev-parse HEAD
[Pipeline] readFile
[Pipeline] echo
On branch feature/jen3 commit d40a7eaf2b38207aca3e7dee28b4c417b7e4fd2b.
[Pipeline] }
...
[Pipeline] stage
[Pipeline] { (Merge pull request)
[Pipeline] readFile
[Pipeline] echo
Merging commit d40a7eaf2b38207aca3e7dee28b4c417b7e4fd2b with commit 99eb9f28280a04a6cc20b3dc4b63a71031f8cd55
[Pipeline] sh
[jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA] Running shell script
+ git reset --hard 99eb9f28280a04a6cc20b3dc4b63a71031f8cd55
HEAD is now at 99eb9f2 Merge pull request #13 in JEN/jenkins from feature/jen2 to develop
[Pipeline] readFile
[Pipeline] sh
[jenkins-global_feature_jen3-432RALCCXJN5KCIZCIYY2LV3HP352XOLR63YXIH5Y6NRADEI57MA] Running shell script
+ git merge d40a7eaf2b38207aca3e7dee28b4c417b7e4fd2b --no-commit
Automatic merge went well; stopped before committing as requested
Auto-merging Jenkinsfile
[Pipeline] }
So merge is done and xml files have been created with check
.
Thank you.
from violation-comments-to-stash-plugin.
What version of the plugin?
from violation-comments-to-stash-plugin.
v1.70
from violation-comments-to-stash-plugin.
You are missing this logging:
https://github.com/jenkinsci/violation-comments-to-stash-plugin/blob/master/src/main/java/org/jenkinsci/plugins/jvctb/perform/JvctbPerformer.java#L256
Change:
violationConfigs: [
[ pattern: '.*/checkstyle/.*\\.xml$', reporter: 'CHECKSTYLE' ],
[ pattern: '.*/findbugs/.*\\.xml$', reporter: 'FINDBUGS' ]
]
To:
violationConfigs: [
[ pattern: '.*/checkstyle/.*\\.xml$', reporter: 'CHECKSTYLE' , parser: 'CHECKSTYLE' ],
[ pattern: '.*/findbugs/.*\\.xml$', reporter: 'FINDBUGS' , parser: 'FINDBUGS' ]
]
This should definitely be changed to an exception in the log instead of silent ignore...
from violation-comments-to-stash-plugin.
Holy.. I somehow missed the parsers. Now it works! Thanks a million!!! You have just saved my day!
from violation-comments-to-stash-plugin.
Related Issues (20)
- "Outdated" comments not deleted HOT 27
- Credentials not found error HOT 17
- NPE since v1.76 HOT 1
- Plugin doesnβt send comments to bitbucket HOT 17
- All violations related to one file in one comment HOT 7
- Recognition of changed lines seems to not work correclty HOT 15
- Escaped single quote characters in comments
- Allow INFO Files changed to include all scanned files HOT 1
- Violation plugin iterates over files not mentioned in report HOT 6
- NPE after deleting comments HOT 2
- Identify that detecting violations from console/stage output is not supported (directly) HOT 7
- To support Code Insights HOT 2
- INFO POST .../pull-requests/3/comments 400 HOT 5
- Add support for client certificate as credentials HOT 1
- Feature: ignore certain folders/paths/globs HOT 4
- Limit logging of files from Violations Lib HOT 5
- When files paths contains spaces in fails to report warnings HOT 1
- Jenkins agents becoming unresponsive during violations run HOT 3
- Report the "indent" level of an issue HOT 6
- warnings lost, or added as general comments HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from violation-comments-to-stash-plugin.