Comments (3)
Hi,
The plugin requires the path for the location of the Klocwork tools to be set. For a pipeline job you can add:
PATH = "/tmp/klocwork/latest/bin:$PATH"
to the environment section of your pipeline. This should resolve the issue with the location of the tools being unknown.
Best Regards,
Michael
from klocwork-plugin.
Hi,
The plugin requires the path for the location of the Klocwork tools to be set. For a pipeline job you can add:
PATH = "/tmp/klocwork/latest/bin:$PATH"
to the environment section of your pipeline. This should resolve the issue with the location of the tools being unknown.
Best Regards,
Michael
Hi Michael,
It does not work, it looks like it is related to https://issues.jenkins.io/browse/JENKINS-48082
See example pipeline code:
stage('Docker') {
agent {
docker {
image '<MY_IMAGE>'
}
}
steps {
echo 'Docker:'
withEnv(['PATH+WHATEVER=/tmp/klocwork']) {
echo "env.PATH=${env.PATH}"
sh 'echo sh PATH = $PATH'
sh '''#!/usr/bin/env bash
echo bash PATH = $PATH
'''
}
}
}
stage('Master') {
agent {
label 'master'
}
steps {
echo 'Master:'
withEnv(['PATH+WHATEVER=/tmp/klocwork']) {
echo "env.PATH=${env.PATH}"
sh 'echo sh PATH = $PATH'
sh '''#!/usr/bin/env bash
echo bash PATH = $PATH
'''
}
}
}
The result of its execution is:
$ 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 ******** -e ******** <MY_IMAGE> cat
$ docker top ae03c529a78bd9a947bb948bd5e9c428343997de60305d4b741f722d07712345 -eo pid,comm
[Pipeline] {
[Pipeline] echo
Docker:
[Pipeline] withEnv
[Pipeline] {
[Pipeline] echo
env.PATH=/tmp/klocwork:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
[Pipeline] sh
+ echo sh PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
sh PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[Pipeline] sh
bash PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
$ docker stop --time=1 ae03c529a78bd9a947bb948bd5e9c428343997de60305d4b741f722d07712345
$ docker rm -f ae03c529a78bd9a947bb948bd5e9c428343997de60305d4b741f722d07712345
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Master)
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/my-node
[Pipeline] {
[Pipeline] echo
Master:
[Pipeline] withEnv
[Pipeline] {
[Pipeline] echo
env.PATH=/tmp/klocwork:/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[Pipeline] sh
+ echo sh PATH = /tmp/klocwork:/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
sh PATH = /tmp/klocwork:/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[Pipeline] sh
bash PATH = /tmp/klocwork:/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
As you can see for docker the env. variable has not changed.
Best Regards,
Greg
from klocwork-plugin.
An "ugly" workaround would be to set the PATH variable using docker args:
docker {
image '<MY_IMAGE>'
args '-e PATH=$PATH:/tmp/klocwork/latest/bin'
from klocwork-plugin.
Related Issues (10)
- Support for DynamicAxis Plugin HOT 1
- Support for kwxsync HOT 1
- Link to wiki in pom.xml is broken. It refers to the plugins old name
- Quality Gateway should fail step in pipeline? HOT 2
- Project missing LICENSE file.
- ERROR: Content is not allowed in prolog HOT 3
- Change Plugin Owner HOT 1
- klocworkQualityGateway pipeline step doesn't mark stage & step as unstable HOT 1
- Major issue when Klocwork reporting is enabled, using Jenkins
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 klocwork-plugin.