Giter Site home page Giter Site logo

klocwork-plugin's Issues

Quality Gateway should fail step in pipeline?

Hi,
I'm using this plugin, version 2.3.5, with multi-branch pipelines on Jenkins.

I'm trying to collect the results and fail the build, but the plugin doesn't report failure on Quality Gateway step.
Actually, it is failing the build after the whole pipeline, but doesn't fail the step thus doesn't let the developer know which step failed.
My usage is based on the example documentation; should fail on at least 1 critical MISRA C rule:

`klocworkWrapper(installConfig: '-- none --', ltoken: '', serverConfig: 'server', serverProject: 'my_project') {
                klocworkIntegrationStep1([additionalOpts: '', buildSpec: 'kwinject.out', disableKwdeploy: true, ignoreCompileErrors: true, importConfig: '', incrementalAnalysis: true, tablesDir: 'kwtables'])
                klocworkIntegrationStep2([additionalOpts: '', buildName: '${GIT_COMMIT}-BUILD-${BUILD_ID}', tablesDir: 'kwtables'])
                klocworkQualityGateway([enableCiGateway: false, enableServerGateway: true, 
                    gatewayCiConfig: [reportFile: '', threshold: '1'], 
                    gatewayServerConfigs: [[conditionName: 'MISRA-C:2012 Compliance', jobResult: 'failure', query: 'severity:Critical,error taxonomy:"MISRA C 2012 with Amendment 1 (C99)"', threshold: '1']]
                    ])
            }

`

Is this the expected behavior? If so, can this be added as a feature request?

I'll appreciate the help,
Gregory

Major issue when Klocwork reporting is enabled, using Jenkins

Hi,

sorry if i do anything wrong, this is the first time i post an issue on github.

I'm using Klocwork Plugin v1.8.1 with Jenkins v1.476.
I can create a job with Klocwork reporting enabled, then run it. But if i restart Jenkins, the following error occurs.


This is a copy of the Jenkins issue https://issues.jenkins-ci.org/browse/JENKINS-14005


Any project with Klockwork reporting enabled can not be loaded after a restart of Jenkins ...

SEVERE: Failed Loading job libtemplate
java.lang.NullPointerException
at com.thalesgroup.hudson.plugins.klocwork.util.KloProjectReviewLink.setKloHostPort(KloProjectReviewLink.java:50)
at com.thalesgroup.hudson.plugins.klocwork.util.KloProjectReviewLink.(KloProjectReviewLink.java:46)
at com.thalesgroup.hudson.plugins.klocwork.KloPublisher.getProjectActions(KloPublisher.java:74)
at hudson.matrix.MatrixProject.createTransientActions(MatrixProject.java:365)
at hudson.model.AbstractProject.updateTransientActions(AbstractProject.java:624)
at hudson.model.AbstractProject.onLoad(AbstractProject.java:279)
at hudson.matrix.MatrixProject.onLoad(MatrixProject.java:404)
at hudson.model.Items.load(Items.java:115)
at jenkins.model.Jenkins$15.run(Jenkins.java:2447)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
at jenkins.model.Jenkins$6.runTask(Jenkins.java:840)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

Running klocwork scan on docker agent

Jenkins and plugins versions report

Environment
Result
Jenkins: 2.303.1
OS: Linux - 5.15.0-43-generic
---
Parameterized-Remote-Trigger:3.1.5.1
PrioritySorter:4.0.0
ace-editor:1.1
allure-jenkins-plugin:2.29.0
ant:1.11
antisamy-markup-formatter:2.1
apache-httpcomponents-client-4-api:4.5.13-1.0
authentication-tokens:1.4
badge:1.8
blueocean:1.25.0
blueocean-autofavorite:1.2.4
blueocean-bitbucket-pipeline:1.25.0
blueocean-commons:1.25.0
blueocean-config:1.25.0
blueocean-core-js:1.25.0
blueocean-dashboard:1.25.0
blueocean-display-url:2.4.1
blueocean-events:1.25.0
blueocean-git-pipeline:1.25.0
blueocean-github-pipeline:1.25.0
blueocean-i18n:1.25.0
blueocean-jira:1.25.0
blueocean-jwt:1.25.0
blueocean-personalization:1.25.0
blueocean-pipeline-api-impl:1.25.0
blueocean-pipeline-editor:1.25.0
blueocean-pipeline-scm-api:1.25.0
blueocean-rest:1.25.0
blueocean-rest-impl:1.25.0
blueocean-web:1.25.0
bootstrap4-api:4.6.0-3
bootstrap5-api:5.1.1-1
bouncycastle-api:2.25
branch-api:2.7.0
build-pipeline-plugin:1.5.8
build-timeout:1.20
built-on-column:1.1
caffeine-api:2.9.2-29.v717aac953ff3
checks-api:1.7.2
cloudbees-bitbucket-branch-source:2.9.11
cloudbees-folder:6.16
command-launcher:1.6
conditional-buildstep:1.4.1
config-autorefresh-plugin:1.0
copyartifact:1.46.2
credentials:2.6.1
credentials-binding:1.27
cvs:2.19
display-url-api:2.3.5
docker-build-publish:1.3.3
docker-commons:1.17
docker-java-api:3.1.5.2
docker-plugin:1.2.3
docker-workflow:1.26
durable-task:1.39
echarts-api:5.1.2-11
email-ext:2.83
emailext-template:1.2
envinject:2.4.0
envinject-api:1.8
external-monitor-job:1.7
favorite:2.3.3
font-awesome-api:5.15.4-1
generic-webhook-trigger:1.77
gerrit-code-review:0.4.7
gerrit-trigger:2.35.2
gerrit-verify-status-reporter:0.0.3
ghprb:1.42.2
git:4.8.2
git-client:3.10.0
git-server:1.10
github:1.34.1
github-api:1.133
github-branch-source:2.11.3
github-pullrequest:0.3.0
gradle:1.37.1
groovy-postbuild:2.5
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-1.0
htmlpublisher:1.25
jackson2-api:2.12.4
javadoc:1.6
jaxb:2.3.0.1
jdk-tool:1.5
jenkins-design-language:1.25.0
jenkins-multijob-plugin:1.36
jira:3.6
jjwt-api:0.11.2-9.c8b45b8bb173
job-dsl:1.78.1
job-import-plugin:3.4
jobConfigHistory:2.28.1
jquery:1.12.4-1
jquery-detached:1.2.1
jquery-ui:1.0.2
jquery3-api:3.6.0-2
jsch:0.1.55.2
junit:1.53
klocwork:2022.2
ldap:2.7
lockable-resources:2.11
mailer:1.34
mapdb-api:1.0.9.0
matrix-auth:2.6.8
matrix-project:1.19
maven-plugin:3.13
mercurial:2.15
momentjs:1.1.1
okhttp-api:3.14.9
pam-auth:1.6
parameterized-trigger:2.41
pipeline-build-step:2.15
pipeline-github-lib:1.0
pipeline-githubnotify-step:1.0.5
pipeline-graph-analysis:1.11
pipeline-input-step:2.12
pipeline-milestone-step:1.3.2
pipeline-model-api:1.9.3
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:1.9.3
pipeline-model-extensions:1.9.3
pipeline-rest-api:2.19
pipeline-stage-step:2.5
pipeline-stage-tags-metadata:1.9.3
pipeline-stage-view:2.19
pipeline-utility-steps:2.10.0
plain-credentials:1.7
plugin-util-api:2.5.0
popper-api:1.16.1-2
popper2-api:2.10.1-1
powershell:1.6
protecode-sc:0.18.2
pubsub-light:1.16
python:1.3
resource-disposer:0.16
role-strategy:3.2.0
run-condition:1.5
scm-api:2.6.5
script-security:1.78
snakeyaml-api:1.29.1
sse-gateway:1.24
ssh-credentials:1.19
ssh-slaves:1.33.0
sshd:3.1.0
structs:1.23
subversion:2.14.5
throttle-concurrents:2.5
timestamper:1.13
token-macro:266.v44a80cf277fd
trilead-api:1.0.13
variant:1.4
windows-slaves:1.8
workflow-aggregator:2.6
workflow-api:2.46
workflow-basic-steps:2.24
workflow-cps:2633.v6baeedc13805
workflow-cps-global-lib:2.21
workflow-cps-global-lib-http:1.13.0
workflow-durable-task-step:2.40
workflow-job:2.42
workflow-multibranch:2.26
workflow-scm-step:2.13
workflow-step-api:2.24
workflow-support:3.8
ws-cleanup:0.39

What Operating System are you using (both controller, and any agents involved in the problem)?

Ubuntu-based containers.

Reproduction steps

  1. Unpack klocwork installation to /tmp/klocwork/latest

  2. Add klocwork installation named latest with path /tmp/klocwork/latest

  3. Create pipeline with docker agent, e.g.:

    agent {
        docker {
            image '<MY_IMAGE>'
            reuseNode true
            label 'some_label'
        }
    }
    stage('Klocwork') {
        environment {
             KW_LTOKEN = '/tmp/ltoken'
             KW_PROJECT='<PROJECT_NAME>'
         }
         stages {
             // call kwauth & kwdeploy here
             stage('Initialize') {
                  steps {
                      klocworkWrapper(installConfig: 'latest', ltoken: "${KW_LTOKEN }", serverConfig: '<SERVER_CONFIG>', serverProject: "${KW_PROJECT}") {
                      klocworkBuildSpecGeneration([
                          additionalOpts: '',
                          buildCommand: './build.sh', // NOTE: put proper build command/script here
                          ignoreErrors: false,
                          output: 'kwinject.out',
                          tool: "kwinject"])
                      klocworkIntegrationStep1([
                          buildSpec: 'kwinject.out',
                          disableKwdeploy: false,
                          duplicateFrom: '',
                          ignoreCompileErrors: true,
                          importConfig: '',
                          incrementalAnalysis: false,
                          tablesDir: 'kwtables'])
         // rest of pipeline
    
  4. Run the pipeline

Expected Results

kwinject working properly.

Actual Results

[Pipeline] {
[Pipeline] klocworkBuildSpecGeneration
[Klocwork BuildSpecBuilder] - Starting Klocwork Build Specification Generation Step
[my-pipeline] $ docker exec --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** --env ******** cf5ba0f7bed568a7702aa710ea139cfcedae9b61234a425eef93848bd0e14505 /bin/sh -c "kwinject --version"
/bin/sh: 1: kwinject: not found
Return code: 127

Anything else?

It looks like kwinject cannot be found.

If I put full path to the kwinject using tool argument to klocworkBuildSpecGeneration then it can be found, but the next step - executing kwbuildproject fails, and it is not possible to provide full path to kwbuildproject.

For me it is strange the command is being run with docker command - because the pipeline is running in docker container already - see beginning of the build log:

[Pipeline] Start of Pipeline
[Pipeline] getContext
[Pipeline] node
Running on my-node in /home/jenkins/workspace/my-pipeline
[Pipeline] {
[Pipeline] isUnix
[Pipeline] sh
+ docker inspect -f . <MY_IMAGE>
.
[Pipeline] withDockerContainer
my-node does not seem to be running inside a container
$ docker run -t -d -u 1002:120 -v /home/jenkins/.ssh:/home/jenkins/.ssh -w /home/jenkins/workspace/my-pipeline -v /home/jenkins/workspace/`my-pipeline:/home/jenkins/workspace/my-pipeline:rw,z -v /home/jenkins/workspace/my-pipeline_tmp:/home/jenkins/workspace/my-pipeline_tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** <MY_IMAGE> cat
$ docker top cf5ba0f7bed568a7702aa710ea139cfcedae9b61234a425eef93848bd0e14505 -eo pid,comm
[Pipeline] { // rest of build log

Perhaps this is the problem (?)

Support for kwxsync

https://developer.klocwork.com/documentation/en/insight/10-1/kwxsync

The kwxsync command synchronizes issue status updates and comments, along with the ID of the user who made the changes, among projects that you specify. All of the updates are merged, so that identical issues in multiple projects have an identical history.

This is useful when projects share source code, as in the case of branches. Developers need to cite detected issues only once for each source file; kwxsync can then apply their changes to other projects containing the same source file. Since kwxsync can run incrementally to update only the most recent status updates and comments, you can run the tool continuously, to ensure that each developer sees an up-to-date list of issues.

The projects can be in different projects_root directories, as well as on different hosts.

When the same issue, across multiple projects, have different statuses - KW reports the status as 'Multiple', causing the KW plugin to crash.

4392fea provides a fix for this issue.

ERROR: Content is not allowed in prolog

Hi!
I'm using Klocwork plugin in Jenkins pipelines with success, but it's failing for a specific branch build.
This is the Klocwork step which is called when I get the error:

klocworkQualityGateway ([
    enableCiGateway: true,
    gatewayCiConfigs: [[
        enableHTMLReporting: true,
        enabledStatuses: [
            analyze: true,
            defer: true,
            filter: true,
            fix: true,
            fixInLaterRelease: true,
            fixInNextRelease: true,
            ignore: true,
            notAProblem: true
        ],
        failUnstable: true,
        name: 'No New Issues (Any Status)',
        reportFile: "kwreport.xml",
        threshold: '1'
    ]]
])

The same snippet is used in the same pipeline, and it's working as is expected in other branches.

Here is error, It's extracted from a Jenkins logger under package scope com.emenda.* and ALL level:

Feb 17, 2020 4:19:51 PM FINE com.emenda.klocwork.KlocworkGatewayPublisher perform
[com.emenda.klocwork.KlocworkGatewayPublisher] - Performing Quality Gate
Feb 17, 2020 4:19:51 PM FINE com.emenda.klocwork.KlocworkGatewayPublisher perform
[com.emenda.klocwork.KlocworkGatewayPublisher] - Entered ci gateway
Feb 17, 2020 4:19:51 PM FINE com.emenda.klocwork.KlocworkGatewayPublisher perform
[com.emenda.klocwork.KlocworkGatewayPublisher] - [ name:No New Issues (Any Status), threshold:1, reportFile:kwreport.xml, stopBuild:false, enabledSeverities:com.emenda.klocwork.definitions.KlocworkSeverities@70526d38, enabledStatuses:com.emenda.klocwork.definitions.KlocworkStatuses@75869686, enableHTMLReporting:true ]
Feb 17, 2020 4:19:51 PM FINE com.emenda.klocwork.KlocworkGatewayPublisher perform
[com.emenda.klocwork.KlocworkGatewayPublisher] - exception thrown: Content is not allowed in prolog.

We are unable to reproduce it in other branches, anyone could give us some hint?

klocworkQualityGateway pipeline step doesn't mark stage & step as unstable

Hi, I'm using klocworkQualityGateway pipeline step to mark the builds as unstable if a new issue is detected durin incremental analysis.

klocworkQualityGateway ([
    enableCiGateway: true,
    gatewayCiConfigs: [[
        enableHTMLReporting: true,
        enabledStatuses: [
            analyze: true,
            defer: true,
            filter: true,
            fix: true,
            fixInLaterRelease: true,
            fixInNextRelease: true,
            ignore: true,
            notAProblem: true
        ],
        failUnstable: true,
        name: 'No New Issues (Any Status)',
        reportFile: "kwreport.xml",
        threshold: '1'
    ]]
])

This is working as expected, quite well. But looks like it hasn't implement a new pipeline improvement about unstable status. The build is marked as unstable, but pipeline stage and step aren't marked as unstable as well.

https://jenkins.io/blog/2019/07/05/jenkins-pipeline-stage-result-visualization-improvements/

Would be really nice if the plugin can support new generation unstable flag.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.