SSL invalid handshake issue

2021-10-07 Thread jesus fernandez
I am using the P4 plugin for Jenkins, I had this SSL invalid handshake 
issue before which I sorted by starting jenkins (I am running Jenkins 
through the war file on Windows 10)  with the following command " java 
-DsecureSocketEnabledProtocols=TLSv1 -jar jenkins.war" but it does not seem 
to be working on a new machine I just setup with Jenkins. I remember 
changing something on the jenkins.xml file, but I think I was using jenkins 
as a windows service by that time and I am unable to find that file on my 
whole system.  I am using Jenkins 2.289.2 and P4 plugin 1.11.5. Any hints / 
help would be greatly appreciated. Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b0eafb65-9fda-435e-b0fe-06989cbf610en%40googlegroups.com.


how to use publish-over-dropbox plugin

2021-06-30 Thread jesus fernandez
I am using Jenkins 2.299, I am trying to use the 
publish-over-dropbox(latest version) plugin for jenkins for the first time, 
but when I try to create the credentials using the kind Dropbox api token, 
I generate it and copy paste it to the token field, but then I get an ```A 
problem occurred while processing the request.
Logging ID=a615b9e8-c399-44d3-866a-5e7a71cb9a3e``` error and I get logout. 
Then I get a neverending callstack, this is the few first lines
```
2021-06-29 19:16:57.599+ [id=15]WARNING 
hudson.security.csrf.CrumbFilter#doFilter: Found invalid crumb 
2125f052b3c77f4a957e7b456a7ca37ca80fdd36dcc7a1988fb238cf721f6fb4. If you 
are calling this URL with a script, please use the API Token instead. More 
information: https://www.jenkins.io/redirect/crumb-cannot-be-used-for-script
2021-06-29 19:16:57.599+ [id=15]WARNING 
hudson.security.csrf.CrumbFilter#doFilter: No valid crumb was included in 
request for /credentials/store/system/domain/_/createCredentials by jesus. 
Returning 403.
2021-06-29 19:17:06.152+ [id=75]WARNING 
o.e.j.s.h.ContextHandler$Context#log: Error while serving 
http://localhost:8080/credentials/store/system/domain/_/createCredentials
java.io.IOException: HTTP 400 error Bad Request
Caused: java.io.IOException: {"error_description": "code doesn't exist or 
has expired", "error": "invalid_grant"}
at 
org.jenkinsci.plugins.publishoverdropbox.domain.JsonObjectRequest.execute(JsonObjectRequest.java:181)
at 
org.jenkinsci.plugins.publishoverdropbox.domain.DropboxV2.readAccessTokenFromWeb(DropboxV2.java:576)
Caused: 
org.jenkinsci.plugins.publishoverdropbox.domain.model.RestException: Error 
when retrieving access token from Dropbox
at 
org.jenkinsci.plugins.publishoverdropbox.domain.DropboxV2.readAccessTokenFromWeb(DropboxV2.java:578)
at 
org.jenkinsci.plugins.publishoverdropbox.domain.DropboxV2.convertAuthorizationToAccessCode(DropboxV2.java:544)
at 
org.jenkinsci.plugins.publishoverdropbox.impl.DropboxTokenImpl.(DropboxTokenImpl.java:53)
Caused: java.io.IOException: Error when retrieving access token from Dropbox
at 
org.jenkinsci.plugins.publishoverdropbox.impl.DropboxTokenImpl.(DropboxTokenImpl.java:55)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown 
Source)
at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at 
org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:541)
Caused: java.lang.IllegalArgumentException
at 
org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:556)
at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:805)
at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:85)
at 
org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:690)
```

I have no idea what is causing this, if the plugin is not working or I am 
doing something wrong

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7c1bbf4f-73ec-4964-8f18-029e934f6c41n%40googlegroups.com.


Re: how can I iterate a json with a list of objects in a pipeline?

2021-04-19 Thread jesus fernandez
Thanks it works now!

El lunes, 19 de abril de 2021 a las 18:55:19 UTC+2, davidmic...@gmail.com 
escribió:

> You're missing the most important value of what JsonSlurper (and similar 
> tools) provides. There is no reason to iterate maps, and it's important to 
> realize that there is no ordering guarantee of map values.
>
> If you want to reference the "issues" property, just reference 
> "json.issues". You will need to iterate over the "json.issues" list, and 
> each of those objects should be "issue" objects, and if you need to 
> reference those particular properties, just reference "issue.type", 
> "issue.severity", et cetera.
>
> On Monday, April 19, 2021 at 9:23:27 AM UTC-7 jesusfern...@gmail.com 
> wrote:
>
>> I have a json object which I receive in my jenkins pipeline through a url 
>> and I parse it like this:
>> ```
>> def url = 'http://localhost:8080/job/find_issues/22/cppcheck/all/api/json
>> '
>> def json = new JsonSlurper().parseText( new URL(url).text )
>>
>> ```
>>
>> Which has this format
>> ```
>> {
>> "_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi",
>> "issues": [],
>> "size": 100,
>> "toString": "- (-): 100 issues (0 duplicates)"
>> }
>> ```
>> which can have a different number of issues inside the `issues` list, 
>> each of them having this structure:
>> ```
>> {
>> "addedAt": 0,
>> "authorEmail": "-",
>> "authorName": "-",
>> "baseName": "stat_obj.cpp",
>> "category": "",
>> "columnEnd": 0,
>> "columnStart": 0,
>> "commit": "-",
>> "description": "",
>> "fileName": "D:/Source/Game/objects/stat_obj.cpp",
>> "fingerprint": "D2CD3A23FB45D3A1F1C3CB8BE5241602",
>> "lineEnd": 5592,
>> "lineStart": 5592,
>> "message": "Unmatched '('. Configuration: 'DEBUGMAPEXPLORATION'.",
>> "moduleName": "",
>> "origin": "cppcheck",
>> "originName": "CPPCheck",
>> "packageName": "-",
>> "reference": "19",
>> "severity": "HIGH",
>> "toString": "D:/Source/Game/objects/stat_obj.cpp(5592,0): syntaxError: : 
>> Unmatched '('. Configuration: 'DEBUGMAPEXPLORATION'.",
>> "type": "syntaxError"
>> }
>> ```
>> How can I access the Issues list and the iterate through each one of the 
>> issues and them through each of the issue keys? 
>> I have tried different ways, lastly I have this:
>> ```
>> for (entry in json) {
>> if(entry.key == "issues")
>> {
>> for (issue in entry.value) {
>> entry.value.each{ key, value ->
>> if (key == "fileName"){
>> errorsList.add(value)
>> }
>> if (key == "lineStart"){
>> errorsList.add(value)
>> }
>> if (key == "message"){
>> errorsList.add(value)
>> }
>> if (key == "severity"){
>> errorsList.add(value)
>> }
>> if (key == "type"){
>> errorsList.add(value)
>> }
>> def msg = "New ERROR found in static analysis, TYPE OF 
>> ERROR ${errorsList[4]}, SEVERITY: ${errorsList[3]}, ERROR MESSAGE: 
>> ${errorsList[2]}, FILE ${errorsList[0]} AT LINE: ${errorsList[1]}"
>> println msg
>> errorsList.clear()
>> }
>> }
>> }
>> }
>> ```
>> But when I call print `msg` I have something like this:
>> ```
>> 17:13:09  New ERROR found in static analysis, TYPE OF ERROR null, 
>> SEVERITY: null, ERROR MESSAGE: null, FILE null AT LINE: null
>> ```
>> It seems like I am over iterating but I do not get to see where is the 
>> mistake...
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d1d4c5eb-a8ca-450d-9d9c-7a49d8ddc803n%40googlegroups.com.


how can I iterate a json with a list of objects in a pipeline?

2021-04-19 Thread jesus fernandez
I have a json object which I receive in my jenkins pipeline through a url 
and I parse it like this:
```
def url = 'http://localhost:8080/job/find_issues/22/cppcheck/all/api/json'
def json = new JsonSlurper().parseText( new URL(url).text )

```

Which has this format
```
{
"_class": "io.jenkins.plugins.analysis.core.restapi.ReportApi",
"issues": [],
"size": 100,
"toString": "- (-): 100 issues (0 duplicates)"
}
```
which can have a different number of issues inside the `issues` list, each 
of them having this structure:
```
{
"addedAt": 0,
"authorEmail": "-",
"authorName": "-",
"baseName": "stat_obj.cpp",
"category": "",
"columnEnd": 0,
"columnStart": 0,
"commit": "-",
"description": "",
"fileName": "D:/Source/Game/objects/stat_obj.cpp",
"fingerprint": "D2CD3A23FB45D3A1F1C3CB8BE5241602",
"lineEnd": 5592,
"lineStart": 5592,
"message": "Unmatched '('. Configuration: 'DEBUGMAPEXPLORATION'.",
"moduleName": "",
"origin": "cppcheck",
"originName": "CPPCheck",
"packageName": "-",
"reference": "19",
"severity": "HIGH",
"toString": "D:/Source/Game/objects/stat_obj.cpp(5592,0): syntaxError: : 
Unmatched '('. Configuration: 'DEBUGMAPEXPLORATION'.",
"type": "syntaxError"
}
```
How can I access the Issues list and the iterate through each one of the 
issues and them through each of the issue keys? 
I have tried different ways, lastly I have this:
```
for (entry in json) {
if(entry.key == "issues")
{
for (issue in entry.value) {
entry.value.each{ key, value ->
if (key == "fileName"){
errorsList.add(value)
}
if (key == "lineStart"){
errorsList.add(value)
}
if (key == "message"){
errorsList.add(value)
}
if (key == "severity"){
errorsList.add(value)
}
if (key == "type"){
errorsList.add(value)
}
def msg = "New ERROR found in static analysis, TYPE OF 
ERROR ${errorsList[4]}, SEVERITY: ${errorsList[3]}, ERROR MESSAGE: 
${errorsList[2]}, FILE ${errorsList[0]} AT LINE: ${errorsList[1]}"
println msg
errorsList.clear()
}
}
}
}
```
But when I call print `msg` I have something like this:
```
17:13:09  New ERROR found in static analysis, TYPE OF ERROR null, SEVERITY: 
null, ERROR MESSAGE: null, FILE null AT LINE: null
```
It seems like I am over iterating but I do not get to see where is the 
mistake...

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7e05e337-ce69-403c-a807-629edf41b838n%40googlegroups.com.


Re: how to access all classes and methods of a plugin in jenkins pipeline?

2021-04-15 Thread jesus fernandez
Yes I will do so


El miércoles, 14 de abril de 2021 a las 21:00:34 UTC+2, 
ullrich...@gmail.com escribió:

> Can you please file a bug report for the warnings plugin, it seems 
> something broken in my build...
>
> Am 14.04.2021 um 18:55 schrieb jesus fernandez :
>
> yes all the other plugins I have checked so far have a woeking javadoc
>
> El mié., 14 abr. 2021 18:20, Ullrich Hafner  
> escribió:
>
>> I publish one, but never looked at the results. Does that work for other 
>> plugins?
>>
>> Am 13.04.2021 um 13:32 schrieb jesus fernandez :
>>
>> is there a javadoc for warnings-ng plugin? or just the github? I get a 
>> 404 when accesing the warnings-ng javadoc
>>
>> El lunes, 12 de abril de 2021 a las 14:28:33 UTC+2, ullrich...@gmail.com 
>> escribió:
>>
>>> In the source code in GitHub?
>>>
>>> You can also look for methods annotated with ExportedBean.
>>>
>>> Am 12.04.2021 um 10:16 schrieb jesus fernandez :
>>>
>>>
>>> where can I see that? in the javadoc I do not see any method with that 
>>> annotation, thoug I could use the getResults() with no problems
>>> El domingo, 11 de abril de 2021 a las 21:43:06 UTC+2, ullrich...@
>>> gmail.com escribió:
>>>
>>>> Due to security considerations only methods marked with @Whitelisted 
>>>> are accessible in Groovy scripts. Does your getter have such an annotation?
>>>>
>>>> Am 11.04.2021 um 19:02 schrieb jesus fernandez >>> >:
>>>>
>>>> I am a junior dev trying to lear about Jenkins, I have been learning on 
>>>> my own for a couple of months. Currently I have a pipeline (just for 
>>>> learning purposes) which runs static analysis on a folder, and then 
>>>> publish 
>>>> it, I have been able to send a report through email using jelly templates, 
>>>> from there I realized it is posbile to instantiate the classes of a plugin 
>>>> to use its methods so I went to the cppcheck javadoc here 
>>>> https://javadoc.jenkins.io/plugin/cppcheck/ and did some trial and 
>>>> error so I can get some values of my report and then do something else 
>>>> with 
>>>> them something, so I had something like this in my pipeline:
>>>> ```
>>>> pipeline {
>>>> agent any
>>>>
>>>> stages {
>>>>   stage('analysis') {
>>>> steps {
>>>>   script{
>>>> bat'cppcheck "E:/My_project/Source/" --xml --xml-version=2 . 2> 
>>>> cppcheck.xml'
>>>>   }
>>>>}
>>>> }
>>>> stage('Test'){
>>>>   steps {
>>>> script {
>>>>   publishCppcheck pattern:'cppcheck.xml'
>>>>   for (action in currentBuild.rawBuild.getActions()) {
>>>> def name = action.getClass().getName()
>>>> if (name == 
>>>> 'org.jenkinsci.plugins.cppcheck.CppcheckBuildAction') {
>>>>def cppcheckaction = action
>>>>def totalErrors = 
>>>> cppcheckaction.getResult().report.getNumberTotal()
>>>>println totalErrors
>>>>def warnings = 
>>>> cppcheckaction.getResult().statistics.getNumberWarningSeverity()
>>>>println warnings
>>>>   }
>>>> }
>>>>   } 
>>>> }
>>>> }
>>>> }
>>>>
>>>> }
>>>> ```
>>>> which output is:
>>>> ```
>>>> [Pipeline] echo
>>>> 102
>>>> [Pipeline] echo
>>>> 4
>>>> ```
>>>>
>>>> My logic (wrongly) tells me that if I can access to the report and 
>>>> statistics classes like that and uses their methods getNumberTotal() and 
>>>> getNumberWarningSeverity() respectively, therefore I should be able to 
>>>> also 
>>>> access the ```DiffState``` class in the same way and use the 
>>>> ```valueOf()``` method to get an enum of the new errors. But adding this 
>>>> to 
>>>> my pipeline:
>>>> ```
>>>> def nueva = cppcheckaction.getResult().diffState.valueOf(NEW)
>>>> println nueva
>>>> ```
>>>> Gives me an error:
>>>> ```
>>>> org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: 
>>>> No such field found: field 
>>>> org.jenkinsci.plugins.cppcheck.CppcheckBuildAction

Re: Can I send cppcheck results through slack in a jenkins pipeline?

2021-04-15 Thread jesus fernandez
Thanks it is working now, I am also wondering what is the tool-id when 
trying to access the details of the analysis result, explained 
here 
https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md#summary-of-the-analysis-result
 
I cannot find other reference to what tool id is. I guess each tool (in my 
case cppcheck) has an id for the plugin what I cannot finde which ID 
correspond to each tool

El miércoles, 14 de abril de 2021 a las 20:57:21 UTC+2, 
ullrich...@gmail.com escribió:

> You must wrap it into tm: see 
> https://github.com/jenkinsci/warnings-ng-plugin/blob/master/ui-tests/src/test/java/io/jenkins/plugins/analysis/warnings/SmokeTests.java#L99
>
>
> Am 13.04.2021 um 16:17 schrieb jesus fernandez :
>
> How can I access those token macros? (sorry if this is a silly question) I 
> have never used them before, I tried to print the value with ```println 
> ${ANALYSIS_ISSUES_COUNT, tool="cppcheck", type="NEW"}``` but I get an 
> unexpected token error
>
> El viernes, 9 de abril de 2021 a las 14:03:39 UTC+2, ullrich...@gmail.com 
> escribió:
>
>>
>> https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md#token-macro-support
>>
>> Am 09.04.2021 um 13:59 schrieb jesus fernandez :
>>
>> Thanks for replying, any documentation or link to guide me in the right 
>> direction on how to do it? I am quite Junior and have been learning Jenkins 
>> on my own
>>
>> El viernes, 9 de abril de 2021 a las 13:46:48 UTC+2, ullrich...@gmail.com 
>> escribió:
>>
>>> Exporting results from one plugin into another plugin is definitely 
>>> possible. You typically have two steps:
>>> 1) Export the data from a producer plugin
>>> a) using Tokens
>>> b) using API methods of the plugin
>>> 2) Import the data (or reformat and aggregate it) into a consumer plugin
>>>
>>> For step 1 I can say this works for the warnings plugin, it can export 
>>> the results of CppCheck either into tokens or into objects (that you can 
>>> process using your pipeline). 
>>>
>>> I have no idea if the slack plugin is capable of doing step 2 though, 
>>> but I would assume that it works in that way...
>>>
>>> Am 09.04.2021 um 08:39 schrieb jesus fernandez :
>>>
>>> I just started using cppcheck, and I was wondering if there is any way 
>>> to access to the report values (for instance number of total errors) and 
>>> send it to slack. I have been searching in the documentation and here in SO 
>>> but I have found nothing, as I just have been using Jenkins for a couple of 
>>> months ( I am a junior dev) I was wondering if somebody know if this is 
>>> possible and could drive me in the right direction.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to jenkinsci-use...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/d3aee90e-5331-480f-84d7-4df7c3ebcf6fn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/d3aee90e-5331-480f-84d7-4df7c3ebcf6fn%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>>
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com.
>>
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/abdfdbec-e2cf-4f69-a089-1cb93dcef30en%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/abdfdbec-e2cf-4f69-a089-1cb93dcef30en%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>>
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com.
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/c5ba204c-fa9f-4f6c-800f-69dba9680f87n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/c5ba204c-fa9f-4f6c-800f-69dba9680f87n%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/cc21e77e-8e16-4cac-9f6d-a79723d9b6c2n%40googlegroups.com.


Re: how to access all classes and methods of a plugin in jenkins pipeline?

2021-04-14 Thread jesus fernandez
yes all the other plugins I have checked so far have a woeking javadoc

El mié., 14 abr. 2021 18:20, Ullrich Hafner 
escribió:

> I publish one, but never looked at the results. Does that work for other
> plugins?
>
> Am 13.04.2021 um 13:32 schrieb jesus fernandez <
> jesusfernandez0...@gmail.com>:
>
> is there a javadoc for warnings-ng plugin? or just the github? I get a 404
> when accesing the warnings-ng javadoc
>
> El lunes, 12 de abril de 2021 a las 14:28:33 UTC+2, ullrich...@gmail.com
> escribió:
>
>> In the source code in GitHub?
>>
>> You can also look for methods annotated with ExportedBean.
>>
>> Am 12.04.2021 um 10:16 schrieb jesus fernandez :
>>
>>
>> where can I see that? in the javadoc I do not see any method with that
>> annotation, thoug I could use the getResults() with no problems
>> El domingo, 11 de abril de 2021 a las 21:43:06 UTC+2, ullrich...@
>> gmail.com escribió:
>>
>>> Due to security considerations only methods marked with @Whitelisted are
>>> accessible in Groovy scripts. Does your getter have such an annotation?
>>>
>>> Am 11.04.2021 um 19:02 schrieb jesus fernandez :
>>>
>>> I am a junior dev trying to lear about Jenkins, I have been learning on
>>> my own for a couple of months. Currently I have a pipeline (just for
>>> learning purposes) which runs static analysis on a folder, and then publish
>>> it, I have been able to send a report through email using jelly templates,
>>> from there I realized it is posbile to instantiate the classes of a plugin
>>> to use its methods so I went to the cppcheck javadoc here
>>> https://javadoc.jenkins.io/plugin/cppcheck/ and did some trial and
>>> error so I can get some values of my report and then do something else with
>>> them something, so I had something like this in my pipeline:
>>> ```
>>> pipeline {
>>> agent any
>>>
>>> stages {
>>>   stage('analysis') {
>>> steps {
>>>   script{
>>> bat'cppcheck "E:/My_project/Source/" --xml --xml-version=2 . 2>
>>> cppcheck.xml'
>>>   }
>>>}
>>> }
>>> stage('Test'){
>>>   steps {
>>> script {
>>>   publishCppcheck pattern:'cppcheck.xml'
>>>   for (action in currentBuild.rawBuild.getActions()) {
>>> def name = action.getClass().getName()
>>> if (name ==
>>> 'org.jenkinsci.plugins.cppcheck.CppcheckBuildAction') {
>>>def cppcheckaction = action
>>>def totalErrors =
>>> cppcheckaction.getResult().report.getNumberTotal()
>>>println totalErrors
>>>def warnings =
>>> cppcheckaction.getResult().statistics.getNumberWarningSeverity()
>>>println warnings
>>>   }
>>> }
>>>   }
>>> }
>>> }
>>> }
>>>
>>> }
>>> ```
>>> which output is:
>>> ```
>>> [Pipeline] echo
>>> 102
>>> [Pipeline] echo
>>> 4
>>> ```
>>>
>>> My logic (wrongly) tells me that if I can access to the report and
>>> statistics classes like that and uses their methods getNumberTotal() and
>>> getNumberWarningSeverity() respectively, therefore I should be able to also
>>> access the ```DiffState``` class in the same way and use the
>>> ```valueOf()``` method to get an enum of the new errors. But adding this to
>>> my pipeline:
>>> ```
>>> def nueva = cppcheckaction.getResult().diffState.valueOf(NEW)
>>> println nueva
>>> ```
>>> Gives me an error:
>>> ```
>>> org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No
>>> such field found: field org.jenkinsci.plugins.cppcheck.CppcheckBuildAction
>>> diffState
>>> at
>>> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(
>>> SandboxInterceptor.java:425 <https://sandboxinterceptor.java:425/>)
>>> at
>>> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(
>>> SandboxInterceptor.java:409 <https://sandboxinterceptor.java:409/>)
>>> ...
>>> ```
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to jenkinsci-use...@googlegroups.com.
>

Re: Can I send cppcheck results through slack in a jenkins pipeline?

2021-04-13 Thread jesus fernandez
How can I access those token macros? (sorry if this is a silly question) I 
have never used them before, I tried to print the value with ```println 
${ANALYSIS_ISSUES_COUNT, tool="cppcheck", type="NEW"}``` but I get an 
unexpected token error

El viernes, 9 de abril de 2021 a las 14:03:39 UTC+2, ullrich...@gmail.com 
escribió:

>
> https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md#token-macro-support
>
> Am 09.04.2021 um 13:59 schrieb jesus fernandez :
>
> Thanks for replying, any documentation or link to guide me in the right 
> direction on how to do it? I am quite Junior and have been learning Jenkins 
> on my own
>
> El viernes, 9 de abril de 2021 a las 13:46:48 UTC+2, ullrich...@gmail.com 
> escribió:
>
>> Exporting results from one plugin into another plugin is definitely 
>> possible. You typically have two steps:
>> 1) Export the data from a producer plugin
>> a) using Tokens
>> b) using API methods of the plugin
>> 2) Import the data (or reformat and aggregate it) into a consumer plugin
>>
>> For step 1 I can say this works for the warnings plugin, it can export 
>> the results of CppCheck either into tokens or into objects (that you can 
>> process using your pipeline). 
>>
>> I have no idea if the slack plugin is capable of doing step 2 though, but 
>> I would assume that it works in that way...
>>
>> Am 09.04.2021 um 08:39 schrieb jesus fernandez :
>>
>> I just started using cppcheck, and I was wondering if there is any way to 
>> access to the report values (for instance number of total errors) and send 
>> it to slack. I have been searching in the documentation and here in SO but 
>> I have found nothing, as I just have been using Jenkins for a couple of 
>> months ( I am a junior dev) I was wondering if somebody know if this is 
>> possible and could drive me in the right direction.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/d3aee90e-5331-480f-84d7-4df7c3ebcf6fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/d3aee90e-5331-480f-84d7-4df7c3ebcf6fn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>>
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com.
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/abdfdbec-e2cf-4f69-a089-1cb93dcef30en%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/abdfdbec-e2cf-4f69-a089-1cb93dcef30en%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c5ba204c-fa9f-4f6c-800f-69dba9680f87n%40googlegroups.com.


Re: how to access all classes and methods of a plugin in jenkins pipeline?

2021-04-13 Thread jesus fernandez
is there a javadoc for warnings-ng plugin? or just the github? I get a 404 
when accesing the warnings-ng javadoc

El lunes, 12 de abril de 2021 a las 14:28:33 UTC+2, ullrich...@gmail.com 
escribió:

> In the source code in GitHub?
>
> You can also look for methods annotated with ExportedBean.
>
> Am 12.04.2021 um 10:16 schrieb jesus fernandez :
>
>
> where can I see that? in the javadoc I do not see any method with that 
> annotation, thoug I could use the getResults() with no problems
> El domingo, 11 de abril de 2021 a las 21:43:06 UTC+2, ullrich...@gmail.com 
> escribió:
>
>> Due to security considerations only methods marked with @Whitelisted are 
>> accessible in Groovy scripts. Does your getter have such an annotation?
>>
>> Am 11.04.2021 um 19:02 schrieb jesus fernandez :
>>
>> I am a junior dev trying to lear about Jenkins, I have been learning on 
>> my own for a couple of months. Currently I have a pipeline (just for 
>> learning purposes) which runs static analysis on a folder, and then publish 
>> it, I have been able to send a report through email using jelly templates, 
>> from there I realized it is posbile to instantiate the classes of a plugin 
>> to use its methods so I went to the cppcheck javadoc here 
>> https://javadoc.jenkins.io/plugin/cppcheck/ and did some trial and error 
>> so I can get some values of my report and then do something else with them 
>> something, so I had something like this in my pipeline:
>> ```
>> pipeline {
>> agent any
>>
>> stages {
>>   stage('analysis') {
>> steps {
>>   script{
>> bat'cppcheck "E:/My_project/Source/" --xml --xml-version=2 . 2> 
>> cppcheck.xml'
>>   }
>>}
>> }
>> stage('Test'){
>>   steps {
>> script {
>>   publishCppcheck pattern:'cppcheck.xml'
>>   for (action in currentBuild.rawBuild.getActions()) {
>> def name = action.getClass().getName()
>> if (name == 'org.jenkinsci.plugins.cppcheck.CppcheckBuildAction') 
>> {
>>def cppcheckaction = action
>>def totalErrors = 
>> cppcheckaction.getResult().report.getNumberTotal()
>>println totalErrors
>>def warnings = 
>> cppcheckaction.getResult().statistics.getNumberWarningSeverity()
>>println warnings
>>   }
>> }
>>   } 
>> }
>> }
>> }
>>
>> }
>> ```
>> which output is:
>> ```
>> [Pipeline] echo
>> 102
>> [Pipeline] echo
>> 4
>> ```
>>
>> My logic (wrongly) tells me that if I can access to the report and 
>> statistics classes like that and uses their methods getNumberTotal() and 
>> getNumberWarningSeverity() respectively, therefore I should be able to also 
>> access the ```DiffState``` class in the same way and use the 
>> ```valueOf()``` method to get an enum of the new errors. But adding this to 
>> my pipeline:
>> ```
>> def nueva = cppcheckaction.getResult().diffState.valueOf(NEW)
>> println nueva
>> ```
>> Gives me an error:
>> ```
>> org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No 
>> such field found: field org.jenkinsci.plugins.cppcheck.CppcheckBuildAction 
>> diffState
>> at 
>> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(
>> SandboxInterceptor.java:425 <https://sandboxinterceptor.java:425/>)
>> at 
>> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(
>> SandboxInterceptor.java:409 <https://sandboxinterceptor.java:409/>)
>> ...
>> ```
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/ca24b1f9-b0a8-4e81-8101-0b25f8267602n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/ca24b1f9-b0a8-4e81-8101-0b25f8267602n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>>
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com.
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/9c65acbc-f199-4d99-8d96-0b37a44a4f2an%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/9c65acbc-f199-4d99-8d96-0b37a44a4f2an%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b2fbf350-74c1-4109-a08d-8f1a0ef91d42n%40googlegroups.com.


Re: how to access all classes and methods of a plugin in jenkins pipeline?

2021-04-12 Thread jesus fernandez

where can I see that? in the javadoc I do not see any method with that 
annotation, thoug I could use the getResults() with no problems
El domingo, 11 de abril de 2021 a las 21:43:06 UTC+2, ullrich...@gmail.com 
escribió:

> Due to security considerations only methods marked with @Whitelisted are 
> accessible in Groovy scripts. Does your getter have such an annotation?
>
> Am 11.04.2021 um 19:02 schrieb jesus fernandez :
>
> I am a junior dev trying to lear about Jenkins, I have been learning on my 
> own for a couple of months. Currently I have a pipeline (just for learning 
> purposes) which runs static analysis on a folder, and then publish it, I 
> have been able to send a report through email using jelly templates, from 
> there I realized it is posbile to instantiate the classes of a plugin to 
> use its methods so I went to the cppcheck javadoc here 
> https://javadoc.jenkins.io/plugin/cppcheck/ and did some trial and error 
> so I can get some values of my report and then do something else with them 
> something, so I had something like this in my pipeline:
> ```
> pipeline {
> agent any
>
> stages {
>   stage('analysis') {
> steps {
>   script{
> bat'cppcheck "E:/My_project/Source/" --xml --xml-version=2 . 2> 
> cppcheck.xml'
>   }
>}
> }
> stage('Test'){
>   steps {
> script {
>   publishCppcheck pattern:'cppcheck.xml'
>   for (action in currentBuild.rawBuild.getActions()) {
> def name = action.getClass().getName()
> if (name == 'org.jenkinsci.plugins.cppcheck.CppcheckBuildAction') {
>def cppcheckaction = action
>def totalErrors = cppcheckaction.getResult().report.getNumberTotal()
>println totalErrors
>def warnings = 
> cppcheckaction.getResult().statistics.getNumberWarningSeverity()
>println warnings
>   }
> }
>   } 
> }
> }
> }
>
> }
> ```
> which output is:
> ```
> [Pipeline] echo
> 102
> [Pipeline] echo
> 4
> ```
>
> My logic (wrongly) tells me that if I can access to the report and 
> statistics classes like that and uses their methods getNumberTotal() and 
> getNumberWarningSeverity() respectively, therefore I should be able to also 
> access the ```DiffState``` class in the same way and use the 
> ```valueOf()``` method to get an enum of the new errors. But adding this to 
> my pipeline:
> ```
> def nueva = cppcheckaction.getResult().diffState.valueOf(NEW)
> println nueva
> ```
> Gives me an error:
> ```
> org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No 
> such field found: field org.jenkinsci.plugins.cppcheck.CppcheckBuildAction 
> diffState
> at 
> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(
> SandboxInterceptor.java:425 <https://sandboxinterceptor.java:425/>)
> at 
> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(
> SandboxInterceptor.java:409 <https://sandboxinterceptor.java:409/>)
> ...
> ```
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/ca24b1f9-b0a8-4e81-8101-0b25f8267602n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/ca24b1f9-b0a8-4e81-8101-0b25f8267602n%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9c65acbc-f199-4d99-8d96-0b37a44a4f2an%40googlegroups.com.


how to access all classes and methods of a plugin in jenkins pipeline?

2021-04-11 Thread jesus fernandez
I am a junior dev trying to lear about Jenkins, I have been learning on my 
own for a couple of months. Currently I have a pipeline (just for learning 
purposes) which runs static analysis on a folder, and then publish it, I 
have been able to send a report through email using jelly templates, from 
there I realized it is posbile to instantiate the classes of a plugin to 
use its methods so I went to the cppcheck javadoc here 
https://javadoc.jenkins.io/plugin/cppcheck/ and did some trial and error so 
I can get some values of my report and then do something else with them 
something, so I had something like this in my pipeline:
```
pipeline {
agent any

stages {
  stage('analysis') {
steps {
  script{
bat'cppcheck "E:/My_project/Source/" --xml --xml-version=2 . 2> 
cppcheck.xml'
  }
   }
}
stage('Test'){
  steps {
script {
  publishCppcheck pattern:'cppcheck.xml'
  for (action in currentBuild.rawBuild.getActions()) {
def name = action.getClass().getName()
if (name == 'org.jenkinsci.plugins.cppcheck.CppcheckBuildAction') {
   def cppcheckaction = action
   def totalErrors = cppcheckaction.getResult().report.getNumberTotal()
   println totalErrors
   def warnings = 
cppcheckaction.getResult().statistics.getNumberWarningSeverity()
   println warnings
  }
}
  } 
}
}
}

}
```
which output is:
```
[Pipeline] echo
102
[Pipeline] echo
4
```

My logic (wrongly) tells me that if I can access to the report and 
statistics classes like that and uses their methods getNumberTotal() and 
getNumberWarningSeverity() respectively, therefore I should be able to also 
access the ```DiffState``` class in the same way and use the 
```valueOf()``` method to get an enum of the new errors. But adding this to 
my pipeline:
```
def nueva = cppcheckaction.getResult().diffState.valueOf(NEW)
println nueva
```
Gives me an error:
```
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No 
such field found: field org.jenkinsci.plugins.cppcheck.CppcheckBuildAction 
diffState
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(
SandboxInterceptor.java:425)
at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(
SandboxInterceptor.java:409)
...
```

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ca24b1f9-b0a8-4e81-8101-0b25f8267602n%40googlegroups.com.


Re: is there a way to see all the available methods of a plugin in Jenkins?

2021-04-09 Thread jesus fernandez
I have also tried this `def action = 
it.getAction('org.jenkinsci.plugins.cppcheck.CppcheckBuildAction')` which 
is how the variable get instantiated in the jelly template but I get ` 
java.lang.NullPointerException: Cannot invoke method getAction() on null 
object ` I am kind of lost here... any help is much appreciated

El viernes, 9 de abril de 2021 a las 16:05:31 UTC+2, jesus fernandez 
escribió:

> But the object model of both is different, you need to choose the 
> correct one in the email template!
>
> Yes, that template I am using it with publishcpp at the moment but I am 
> not able to get the value of any of their properties within my pipeline 
> like if I try to echo to check its value I get an error 
> 'groovy.lang.MissingPropertyException: No such property: cppcheckResult for 
> class: groovy.lang.Binding' so I am stuck trying to get the total number of 
> errors from each build
>
> El viernes, 9 de abril de 2021 a las 15:41:22 UTC+2, jesus fernandez 
> escribió:
>
>> but this is like god trying to explain something to a rock, I have just 
>> started in this world...hehehe
>>
>> El viernes, 9 de abril de 2021 a las 15:40:44 UTC+2, jesus fernandez 
>> escribió:
>>
>>> hahaha oh gosh I should have known I watched your video on youtube a few 
>>> days ago. 
>>>
>>> El viernes, 9 de abril de 2021 a las 15:39:30 UTC+2, 
>>> ullrich...@gmail.com escribió:
>>>
>>>>
>>>>
>>>> I actually have tried both to publish the result, 
>>>>
>>>>
>>>> But the object model of both is different, you need to choose the 
>>>> correct one in the email template!
>>>>
>>>> have not decided which one to use yet, any suggestion? 
>>>>
>>>>
>>>> I am biased as I am the author of the warnings plugin ;-)
>>>>
>>>> I like the dashboard of the warnings-ng better, but I ilke from the 
>>>> publushcpp that you can see the line where the error is right from Jenkins 
>>>> without need to open the editor and look for the line...
>>>>
>>>>
>>>> This could be done in the warnings plugin as well.
>>>> Example: 
>>>> https://ci.jenkins.io/job/Plugins/job/analysis-model/job/master/1150/pmd/source.6e8cd82c-d953-4e48-9163-87d374ee6241/#32
>>>>
>>>>
>>>> El viernes, 9 de abril de 2021 a las 14:40:34 UTC+2, ullrich...@
>>>> gmail.com escribió:
>>>>
>>>>> First of all: are you using the warnings-ng plugin or the cppcheck 
>>>>> plugin in your build? They use different models. 
>>>>>
>>>>> I’m not sure if there is an easy way to debug email ext templates in 
>>>>> the meantime, I am not using it actively. 
>>>>> But you can simply start with a subset of the script below and check 
>>>>> which values produce a result and which not. 
>>>>>
>>>>> Am 09.04.2021 um 14:32 schrieb jesus fernandez >>>> >:
>>>>>
>>>>> my projects are in Perforce. What if I want to acces to one of those 
>>>>> properties which I know are available from looking at the jelly template, 
>>>>> for instance ${cppcheckResult.getDiff().getNumberNoCategorySeverity()} I 
>>>>> tried to echo that property but I get an error how could I access to it?
>>>>> this is the jelly template I am using (I took it from SO)
>>>>> >>>> xmlns:d="jelly:define">
>>>>> 
>>>>>   
>>>>> >>>> value="${it.getAction('org.jenkinsci.plugins.cppcheck.CppcheckBuildAction')}"
>>>>>  
>>>>> />
>>>>> 
>>>>> >>>> value="${cppcheckAction.getResult()}" />
>>>>> 
>>>>>   Summary
>>>>> 
>>>>> #cppcheckStatistics { width: auto; }
>>>>> #cppcheckStatistics .number { text-align: right; }
>>>>> 
>>>>> 
>>>>>   
>>>>> 
>>>>>   Severity
>>>>>   Count
>>>>>   Delta
>>>>> 
>>>>>   
>>>>> 

Re: is there a way to see all the available methods of a plugin in Jenkins?

2021-04-09 Thread jesus fernandez
But the object model of both is different, you need to choose the 
correct one in the email template!

Yes, that template I am using it with publishcpp at the moment but I am not 
able to get the value of any of their properties within my pipeline like if 
I try to echo to check its value I get an error 
'groovy.lang.MissingPropertyException: No such property: cppcheckResult for 
class: groovy.lang.Binding' so I am stuck trying to get the total number of 
errors from each build

El viernes, 9 de abril de 2021 a las 15:41:22 UTC+2, jesus fernandez 
escribió:

> but this is like god trying to explain something to a rock, I have just 
> started in this world...hehehe
>
> El viernes, 9 de abril de 2021 a las 15:40:44 UTC+2, jesus fernandez 
> escribió:
>
>> hahaha oh gosh I should have known I watched your video on youtube a few 
>> days ago. 
>>
>> El viernes, 9 de abril de 2021 a las 15:39:30 UTC+2, ullrich...@gmail.com 
>> escribió:
>>
>>>
>>>
>>> I actually have tried both to publish the result, 
>>>
>>>
>>> But the object model of both is different, you need to choose the 
>>> correct one in the email template!
>>>
>>> have not decided which one to use yet, any suggestion? 
>>>
>>>
>>> I am biased as I am the author of the warnings plugin ;-)
>>>
>>> I like the dashboard of the warnings-ng better, but I ilke from the 
>>> publushcpp that you can see the line where the error is right from Jenkins 
>>> without need to open the editor and look for the line...
>>>
>>>
>>> This could be done in the warnings plugin as well.
>>> Example: 
>>> https://ci.jenkins.io/job/Plugins/job/analysis-model/job/master/1150/pmd/source.6e8cd82c-d953-4e48-9163-87d374ee6241/#32
>>>
>>>
>>> El viernes, 9 de abril de 2021 a las 14:40:34 UTC+2, ullrich...@
>>> gmail.com escribió:
>>>
>>>> First of all: are you using the warnings-ng plugin or the cppcheck 
>>>> plugin in your build? They use different models. 
>>>>
>>>> I’m not sure if there is an easy way to debug email ext templates in 
>>>> the meantime, I am not using it actively. 
>>>> But you can simply start with a subset of the script below and check 
>>>> which values produce a result and which not. 
>>>>
>>>> Am 09.04.2021 um 14:32 schrieb jesus fernandez >>> >:
>>>>
>>>> my projects are in Perforce. What if I want to acces to one of those 
>>>> properties which I know are available from looking at the jelly template, 
>>>> for instance ${cppcheckResult.getDiff().getNumberNoCategorySeverity()} I 
>>>> tried to echo that property but I get an error how could I access to it?
>>>> this is the jelly template I am using (I took it from SO)
>>>> >>> xmlns:d="jelly:define">
>>>> 
>>>>   
>>>> >>> value="${it.getAction('org.jenkinsci.plugins.cppcheck.CppcheckBuildAction')}"
>>>>  
>>>> />
>>>> 
>>>> >>> value="${cppcheckAction.getResult()}" />
>>>> 
>>>>   Summary
>>>> 
>>>> #cppcheckStatistics { width: auto; }
>>>> #cppcheckStatistics .number { text-align: right; }
>>>> 
>>>> 
>>>>   
>>>> 
>>>>   Severity
>>>>   Count
>>>>   Delta
>>>> 
>>>>   
>>>>   
>>>> 
>>>>   Error
>>>>   ${cppcheckResult.statistics.getNumberErrorSeverity()}
>>>>   ${cppcheckResult.getDiff().getNumberErrorSeverity()}
>>>> 
>>>> 
>>>>   Warning
>>>>   ${cppcheckResult.statistics.getNumberWarningSeverity()}
>>>>   ${cppcheckResult.getDiff().getNumberWarningSeverity()}
>>>> 
>>>> 
>>>>   Style
>>>>   ${cppcheckResult.statistics.getNumberS

Re: is there a way to see all the available methods of a plugin in Jenkins?

2021-04-09 Thread jesus fernandez
but this is like god trying to explain something to a rock, I have just 
started in this world...hehehe

El viernes, 9 de abril de 2021 a las 15:40:44 UTC+2, jesus fernandez 
escribió:

> hahaha oh gosh I should have known I watched your video on youtube a few 
> days ago. 
>
> El viernes, 9 de abril de 2021 a las 15:39:30 UTC+2, ullrich...@gmail.com 
> escribió:
>
>>
>>
>> I actually have tried both to publish the result, 
>>
>>
>> But the object model of both is different, you need to choose the correct 
>> one in the email template!
>>
>> have not decided which one to use yet, any suggestion? 
>>
>>
>> I am biased as I am the author of the warnings plugin ;-)
>>
>> I like the dashboard of the warnings-ng better, but I ilke from the 
>> publushcpp that you can see the line where the error is right from Jenkins 
>> without need to open the editor and look for the line...
>>
>>
>> This could be done in the warnings plugin as well.
>> Example: 
>> https://ci.jenkins.io/job/Plugins/job/analysis-model/job/master/1150/pmd/source.6e8cd82c-d953-4e48-9163-87d374ee6241/#32
>>
>>
>> El viernes, 9 de abril de 2021 a las 14:40:34 UTC+2, ullrich...@gmail.com 
>> escribió:
>>
>>> First of all: are you using the warnings-ng plugin or the cppcheck 
>>> plugin in your build? They use different models. 
>>>
>>> I’m not sure if there is an easy way to debug email ext templates in the 
>>> meantime, I am not using it actively. 
>>> But you can simply start with a subset of the script below and check 
>>> which values produce a result and which not. 
>>>
>>> Am 09.04.2021 um 14:32 schrieb jesus fernandez :
>>>
>>> my projects are in Perforce. What if I want to acces to one of those 
>>> properties which I know are available from looking at the jelly template, 
>>> for instance ${cppcheckResult.getDiff().getNumberNoCategorySeverity()} I 
>>> tried to echo that property but I get an error how could I access to it?
>>> this is the jelly template I am using (I took it from SO)
>>> >> xmlns:d="jelly:define">
>>> 
>>>   
>>> >> value="${it.getAction('org.jenkinsci.plugins.cppcheck.CppcheckBuildAction')}"
>>>  
>>> />
>>> 
>>> >> value="${cppcheckAction.getResult()}" />
>>> 
>>>   Summary
>>> 
>>> #cppcheckStatistics { width: auto; }
>>> #cppcheckStatistics .number { text-align: right; }
>>> 
>>> 
>>>   
>>> 
>>>   Severity
>>>   Count
>>>   Delta
>>> 
>>>   
>>>   
>>> 
>>>   Error
>>>   ${cppcheckResult.statistics.getNumberErrorSeverity()}
>>>   ${cppcheckResult.getDiff().getNumberErrorSeverity()}
>>> 
>>> 
>>>   Warning
>>>   ${cppcheckResult.statistics.getNumberWarningSeverity()}
>>>   ${cppcheckResult.getDiff().getNumberWarningSeverity()}
>>> 
>>> 
>>>   Style
>>>   ${cppcheckResult.statistics.getNumberStyleSeverity()}
>>>   ${cppcheckResult.getDiff().getNumberStyleSeverity()}
>>> 
>>> 
>>>   Performance
>>>   ${cppcheckResult.statistics.getNumberPerformanceSeverity()}
>>>   ${cppcheckResult.getDiff().getNumberPerformanceSeverity()}
>>> 
>>> 
>>>   Portability
>>>   ${cppcheckResult.statistics.getNumberPortabilitySeverity()}
>>>   ${cppcheckResult.getDiff().getNumberPortabilitySeverity()}
>>> 
>>> 
>>>   Information
>>>   ${cppcheckResult.statistics.getNumberInformationSeverity()}
>>>   ${cppcheckResult.getDiff().getNumberInformationSeverity()}
&g

Re: is there a way to see all the available methods of a plugin in Jenkins?

2021-04-09 Thread jesus fernandez
hahaha oh gosh I should have known I watched your video on youtube a few 
days ago. 

El viernes, 9 de abril de 2021 a las 15:39:30 UTC+2, ullrich...@gmail.com 
escribió:

>
>
> I actually have tried both to publish the result, 
>
>
> But the object model of both is different, you need to choose the correct 
> one in the email template!
>
> have not decided which one to use yet, any suggestion? 
>
>
> I am biased as I am the author of the warnings plugin ;-)
>
> I like the dashboard of the warnings-ng better, but I ilke from the 
> publushcpp that you can see the line where the error is right from Jenkins 
> without need to open the editor and look for the line...
>
>
> This could be done in the warnings plugin as well.
> Example: 
> https://ci.jenkins.io/job/Plugins/job/analysis-model/job/master/1150/pmd/source.6e8cd82c-d953-4e48-9163-87d374ee6241/#32
>
>
> El viernes, 9 de abril de 2021 a las 14:40:34 UTC+2, ullrich...@gmail.com 
> escribió:
>
>> First of all: are you using the warnings-ng plugin or the cppcheck plugin 
>> in your build? They use different models. 
>>
>> I’m not sure if there is an easy way to debug email ext templates in the 
>> meantime, I am not using it actively. 
>> But you can simply start with a subset of the script below and check 
>> which values produce a result and which not. 
>>
>> Am 09.04.2021 um 14:32 schrieb jesus fernandez :
>>
>> my projects are in Perforce. What if I want to acces to one of those 
>> properties which I know are available from looking at the jelly template, 
>> for instance ${cppcheckResult.getDiff().getNumberNoCategorySeverity()} I 
>> tried to echo that property but I get an error how could I access to it?
>> this is the jelly template I am using (I took it from SO)
>> > xmlns:d="jelly:define">
>> 
>>   
>> > value="${it.getAction('org.jenkinsci.plugins.cppcheck.CppcheckBuildAction')}"
>>  
>> />
>> 
>> > value="${cppcheckAction.getResult()}" />
>> 
>>   Summary
>> 
>> #cppcheckStatistics { width: auto; }
>> #cppcheckStatistics .number { text-align: right; }
>> 
>> 
>>   
>> 
>>   Severity
>>   Count
>>   Delta
>> 
>>   
>>   
>> 
>>   Error
>>   ${cppcheckResult.statistics.getNumberErrorSeverity()}
>>   ${cppcheckResult.getDiff().getNumberErrorSeverity()}
>> 
>> 
>>   Warning
>>   ${cppcheckResult.statistics.getNumberWarningSeverity()}
>>   ${cppcheckResult.getDiff().getNumberWarningSeverity()}
>> 
>> 
>>   Style
>>   ${cppcheckResult.statistics.getNumberStyleSeverity()}
>>   ${cppcheckResult.getDiff().getNumberStyleSeverity()}
>> 
>> 
>>   Performance
>>   ${cppcheckResult.statistics.getNumberPerformanceSeverity()}
>>   ${cppcheckResult.getDiff().getNumberPerformanceSeverity()}
>> 
>> 
>>   Portability
>>   ${cppcheckResult.statistics.getNumberPortabilitySeverity()}
>>   ${cppcheckResult.getDiff().getNumberPortabilitySeverity()}
>> 
>> 
>>   Information
>>   ${cppcheckResult.statistics.getNumberInformationSeverity()}
>>   ${cppcheckResult.getDiff().getNumberInformationSeverity()}
>> 
>> 
>>   No category
>>   ${cppcheckResult.statistics.getNumberNoCategorySeverity()}
>>   ${cppcheckResult.getDiff().getNumberNoCategorySeverity()}
>> 
>>   
>>   
>> 
>>   Total
>>   > href="${rooturl}${build.url}cppcheckResult">${cppcheckResult.report.getNumberTotal()}
>>   &

Re: is there a way to see all the available methods of a plugin in Jenkins?

2021-04-09 Thread jesus fernandez

I actually have tried both to publish the result, have not decided which 
one to use yet, any suggestion? I like the dashboard of the warnings-ng 
better, but I ilke from the publushcpp that you can see the line where the 
error is right from Jenkins without need to open the editor and look for 
the line...
El viernes, 9 de abril de 2021 a las 14:40:34 UTC+2, ullrich...@gmail.com 
escribió:

> First of all: are you using the warnings-ng plugin or the cppcheck plugin 
> in your build? They use different models. 
>
> I’m not sure if there is an easy way to debug email ext templates in the 
> meantime, I am not using it actively. 
> But you can simply start with a subset of the script below and check which 
> values produce a result and which not. 
>
> Am 09.04.2021 um 14:32 schrieb jesus fernandez :
>
> my projects are in Perforce. What if I want to acces to one of those 
> properties which I know are available from looking at the jelly template, 
> for instance ${cppcheckResult.getDiff().getNumberNoCategorySeverity()} I 
> tried to echo that property but I get an error how could I access to it?
> this is the jelly template I am using (I took it from SO)
>  xmlns:d="jelly:define">
> 
>   
>  value="${it.getAction('org.jenkinsci.plugins.cppcheck.CppcheckBuildAction')}" 
> />
> 
>  value="${cppcheckAction.getResult()}" />
> 
>   Summary
> 
> #cppcheckStatistics { width: auto; }
> #cppcheckStatistics .number { text-align: right; }
> 
> 
>   
> 
>   Severity
>   Count
>   Delta
> 
>   
>   
> 
>   Error
>   ${cppcheckResult.statistics.getNumberErrorSeverity()}
>   ${cppcheckResult.getDiff().getNumberErrorSeverity()}
> 
> 
>   Warning
>   ${cppcheckResult.statistics.getNumberWarningSeverity()}
>   ${cppcheckResult.getDiff().getNumberWarningSeverity()}
> 
> 
>   Style
>   ${cppcheckResult.statistics.getNumberStyleSeverity()}
>   ${cppcheckResult.getDiff().getNumberStyleSeverity()}
> 
> 
>   Performance
>   ${cppcheckResult.statistics.getNumberPerformanceSeverity()}
>   ${cppcheckResult.getDiff().getNumberPerformanceSeverity()}
> 
> 
>   Portability
>   ${cppcheckResult.statistics.getNumberPortabilitySeverity()}
>   ${cppcheckResult.getDiff().getNumberPortabilitySeverity()}
> 
> 
>   Information
>   ${cppcheckResult.statistics.getNumberInformationSeverity()}
>   ${cppcheckResult.getDiff().getNumberInformationSeverity()}
> 
> 
>   No category
>   ${cppcheckResult.statistics.getNumberNoCategorySeverity()}
>   ${cppcheckResult.getDiff().getNumberNoCategorySeverity()}
> 
>   
>   
> 
>   Total
>href="${rooturl}${build.url}cppcheckResult">${cppcheckResult.report.getNumberTotal()}
>href="${rooturl}${build.url}cppcheckResult/source.all/?before=5after=5states=new">${cppcheckResult.getDiff().getNumberTotal()}
> 
>   
> 
>   
> 
>  
>  
> 
>
> El viernes, 9 de abril de 2021 a las 14:27:16 UTC+2, ullrich...@gmail.com 
> escribió:
>
>> Are your projects located in GitHub? Then it would be quite easy to 
>> report results automatically using the GitHub checks plugin. Email is quite 
>> old-school when it comes to build result reporting... 
>>
>> Am 09.04.2021 um 13:58 schrieb jesus fernandez :
>>
>> Thanks for asering. I have been checking the javadoc of the plugin 
>> https://javadoc.jenkins.io/plugin/email-ext/ but my java knowledge is 
>> super basic and I do not get to see where the methods available to Jenkins 
>> are. So I guess t

Re: is there a way to see all the available methods of a plugin in Jenkins?

2021-04-09 Thread jesus fernandez
my projects are in Perforce. What if I want to acces to one of those 
properties which I know are available from looking at the jelly template, 
for instance ${cppcheckResult.getDiff().getNumberNoCategorySeverity()} I 
tried to echo that property but I get an error how could I access to it?
this is the jelly template I am using (I took it from SO)


  




  Summary

#cppcheckStatistics { width: auto; }
#cppcheckStatistics .number { text-align: right; }


  

  Severity
  Count
  Delta

  
  

  Error
  ${cppcheckResult.statistics.getNumberErrorSeverity()}
  ${cppcheckResult.getDiff().getNumberErrorSeverity()}


  Warning
  ${cppcheckResult.statistics.getNumberWarningSeverity()}
  ${cppcheckResult.getDiff().getNumberWarningSeverity()}


  Style
  ${cppcheckResult.statistics.getNumberStyleSeverity()}
  ${cppcheckResult.getDiff().getNumberStyleSeverity()}


  Performance
  ${cppcheckResult.statistics.getNumberPerformanceSeverity()}
  ${cppcheckResult.getDiff().getNumberPerformanceSeverity()}


  Portability
  ${cppcheckResult.statistics.getNumberPortabilitySeverity()}
  ${cppcheckResult.getDiff().getNumberPortabilitySeverity()}


  Information
  ${cppcheckResult.statistics.getNumberInformationSeverity()}
  ${cppcheckResult.getDiff().getNumberInformationSeverity()}


  No category
  ${cppcheckResult.statistics.getNumberNoCategorySeverity()}
  ${cppcheckResult.getDiff().getNumberNoCategorySeverity()}

  
  

  Total
  ${cppcheckResult.report.getNumberTotal()}
  ${cppcheckResult.getDiff().getNumberTotal()}

  

  

 
 


El viernes, 9 de abril de 2021 a las 14:27:16 UTC+2, ullrich...@gmail.com 
escribió:

> Are your projects located in GitHub? Then it would be quite easy to report 
> results automatically using the GitHub checks plugin. Email is quite 
> old-school when it comes to build result reporting... 
>
> Am 09.04.2021 um 13:58 schrieb jesus fernandez :
>
> Thanks for asering. I have been checking the javadoc of the plugin 
> https://javadoc.jenkins.io/plugin/email-ext/ but my java knowledge is 
> super basic and I do not get to see where the methods available to Jenkins 
> are. So I guess this is too advanced for me ATM
>
> El viernes, 9 de abril de 2021 a las 13:48:03 UTC+2, ullrich...@gmail.com 
> escribió:
>
>> You need to read the code of the plugin. I.e., the model of the producer 
>> plugin.
>>
>>
>> Am 09.04.2021 um 13:08 schrieb jesus fernandez :
>>
>> I am learning Jenkins on my own and I am trying to learn about plugins. I 
>> have a stage to send an email with the cppcheck results with a template I 
>> found 
>> https://stackoverflow.com/questions/13888338/sending-cppcheck-result-report-on-email-from-jenkins-using-email-ext-plugin
>>  
>> the template instantiate the ```CppcheckBuildAction``` and access its 
>> methods, what I would like to know if is possible to check what methods are 
>> avaialable for that instance and if possible how / where I can see them.
>> Also how could I for example echo / println one of them. For instance in 
>> the template provided in the link above it acces the total number of errors 
>> with ${cppcheckResult.report.getNumberTotal()} but if I echo it I get an 
>> error ```groovy.lang.MissingPropertyException: No such property: 
>> cppcheckResult for class: groovy.lang.Binding```, this is what I tried
>> stage('Email') {
>> steps {
>> script{
>> publishCppcheck pattern:'cppcheck.xml'
>> emailext( subject: 'foo', to: 'ma...@mail.net', body: '${JELLY_SCRIPT, 
>> template="custom"}')
>> }
>> echo "${cppcheckResult.report.getNumberTotal()}"
>> }
>>

Re: Can I send cppcheck results through slack in a jenkins pipeline?

2021-04-09 Thread jesus fernandez
Thanks for replying, any documentation or link to guide me in the right 
direction on how to do it? I am quite Junior and have been learning Jenkins 
on my own

El viernes, 9 de abril de 2021 a las 13:46:48 UTC+2, ullrich...@gmail.com 
escribió:

> Exporting results from one plugin into another plugin is definitely 
> possible. You typically have two steps:
> 1) Export the data from a producer plugin
> a) using Tokens
> b) using API methods of the plugin
> 2) Import the data (or reformat and aggregate it) into a consumer plugin
>
> For step 1 I can say this works for the warnings plugin, it can export the 
> results of CppCheck either into tokens or into objects (that you can 
> process using your pipeline). 
>
> I have no idea if the slack plugin is capable of doing step 2 though, but 
> I would assume that it works in that way...
>
> Am 09.04.2021 um 08:39 schrieb jesus fernandez :
>
> I just started using cppcheck, and I was wondering if there is any way to 
> access to the report values (for instance number of total errors) and send 
> it to slack. I have been searching in the documentation and here in SO but 
> I have found nothing, as I just have been using Jenkins for a couple of 
> months ( I am a junior dev) I was wondering if somebody know if this is 
> possible and could drive me in the right direction.
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/d3aee90e-5331-480f-84d7-4df7c3ebcf6fn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/d3aee90e-5331-480f-84d7-4df7c3ebcf6fn%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/abdfdbec-e2cf-4f69-a089-1cb93dcef30en%40googlegroups.com.


Re: is there a way to see all the available methods of a plugin in Jenkins?

2021-04-09 Thread jesus fernandez
Thanks for asering. I have been checking the javadoc of the 
plugin https://javadoc.jenkins.io/plugin/email-ext/ but my java knowledge 
is super basic and I do not get to see where the methods available to 
Jenkins are. So I guess this is too advanced for me ATM

El viernes, 9 de abril de 2021 a las 13:48:03 UTC+2, ullrich...@gmail.com 
escribió:

> You need to read the code of the plugin. I.e., the model of the producer 
> plugin.
>
>
> Am 09.04.2021 um 13:08 schrieb jesus fernandez :
>
> I am learning Jenkins on my own and I am trying to learn about plugins. I 
> have a stage to send an email with the cppcheck results with a template I 
> found 
> https://stackoverflow.com/questions/13888338/sending-cppcheck-result-report-on-email-from-jenkins-using-email-ext-plugin
>  
> the template instantiate the ```CppcheckBuildAction``` and access its 
> methods, what I would like to know if is possible to check what methods are 
> avaialable for that instance and if possible how / where I can see them.
> Also how could I for example echo / println one of them. For instance in 
> the template provided in the link above it acces the total number of errors 
> with ${cppcheckResult.report.getNumberTotal()} but if I echo it I get an 
> error ```groovy.lang.MissingPropertyException: No such property: 
> cppcheckResult for class: groovy.lang.Binding```, this is what I tried
> stage('Email') {
> steps {
> script{
> publishCppcheck pattern:'cppcheck.xml'
> emailext( subject: 'foo', to: 'ma...@mail.net', body: '${JELLY_SCRIPT, 
> template="custom"}')
> }
> echo "${cppcheckResult.report.getNumberTotal()}"
> }
> }
> my final goal actually is to send the email just when the report find a 
> new error so I was thinking to save the total number of errors in an 
> external file and compare it with each build and if the number is bigger 
> send the email, is there any native / easier way to do this?
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/901e41a0-e2ec-466c-87a9-23d6082897e1n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/901e41a0-e2ec-466c-87a9-23d6082897e1n%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/48090815-12d1-4f8a-a15b-2d0c0185b830n%40googlegroups.com.


is there a way to see all the available methods of a plugin in Jenkins?

2021-04-09 Thread jesus fernandez
I am learning Jenkins on my own and I am trying to learn about plugins. I 
have a stage to send an email with the cppcheck results with a template I 
found 
https://stackoverflow.com/questions/13888338/sending-cppcheck-result-report-on-email-from-jenkins-using-email-ext-plugin
 
the template instantiate the ```CppcheckBuildAction``` and access its 
methods, what I would like to know if is possible to check what methods are 
avaialable for that instance and if possible how / where I can see them.
Also how could I for example echo / println one of them. For instance in 
the template provided in the link above it acces the total number of errors 
with ${cppcheckResult.report.getNumberTotal()} but if I echo it I get an 
error ```groovy.lang.MissingPropertyException: No such property: 
cppcheckResult for class: groovy.lang.Binding```, this is what I tried
stage('Email') {
steps {
script{
publishCppcheck pattern:'cppcheck.xml'
emailext( subject: 'foo', to: 'm...@mail.net', body: '${JELLY_SCRIPT, 
template="custom"}')
}
echo "${cppcheckResult.report.getNumberTotal()}"
}
}
my final goal actually is to send the email just when the report find a new 
error so I was thinking to save the total number of errors in an external 
file and compare it with each build and if the number is bigger send the 
email, is there any native / easier way to do this?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/901e41a0-e2ec-466c-87a9-23d6082897e1n%40googlegroups.com.


Can I send cppcheck results through slack in a jenkins pipeline?

2021-04-09 Thread jesus fernandez
I just started using cppcheck, and I was wondering if there is any way to 
access to the report values (for instance number of total errors) and send 
it to slack. I have been searching in the documentation and here in SO but 
I have found nothing, as I just have been using Jenkins for a couple of 
months ( I am a junior dev) I was wondering if somebody know if this is 
possible and could drive me in the right direction.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d3aee90e-5331-480f-84d7-4df7c3ebcf6fn%40googlegroups.com.


Re: I cannot run Azure CLI commands from jenkins pipeline

2021-04-08 Thread jesus fernandez
it happened to be an issue with the path, as jenkins uses its own path for 
its user I have not declared the path for the right user

El miércoles, 7 de abril de 2021 a las 9:24:44 UTC+2, jesus fernandez 
escribió:

> az is installed as it runs from the cmd, and it also runs if I start 
> jenkins from a non administrator prompt, it just do not work when starting 
> Jenkins from a admin prompt (which I need to)
>
> El martes, 6 de abril de 2021 a las 21:22:06 UTC+2, Martin Schmude 
> escribió:
>
>> Maybe az has not been installed on the system where the job is executed.
>> Or az is not part of the PATH variable in the context of the job 
>> execution.
>> Let the job execute "echo $env:path" before any "az ..." commands, so 
>> that it prints out its path environment variable.
>>
>> jesusfern...@gmail.com schrieb am Dienstag, 6. April 2021 um 13:21:16 
>> UTC+2:
>>
>>> I am trying to run some az commands from a Jenkins pipeline which 
>>> (running in Windows 10) I already used in my laptop´s Jenkins, but when 
>>> trying to use it on another computer (also running w10) I get this error : 
>>> ```
>>> 11:12:47  powershell.exe : az : The term 'az' is not recognized as the 
>>> name of a cmdlet, function, script file, or operable program. Check the 
>>> 11:12:47  At 
>>> C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellWrapper.ps1:3
>>>  
>>> char:1
>>> 11:12:47  + & powershell -NoProfile -NonInteractive -ExecutionPolicy 
>>> Bypass -Comm ...
>>> 11:12:47  + 
>>> ~
>>> 11:12:47  + CategoryInfo  : NotSpecified: (az : The term 
>>> '...ram. Check the :String) [], RemoteException
>>> 11:12:47  + FullyQualifiedErrorId : NativeCommandError
>>> 11:12:47   
>>> 11:12:47  spelling of the name, or if a path was included, verify that 
>>> the path is correct and try again.
>>> 11:12:47  At 
>>> C:\Users\User\.jenkins\workspace\playground\tmp\durable-933c3d89\powershellScript.ps1:3
>>>  
>>> char:25
>>> 11:12:47  + az devops configure --defaults 
>>> organization=h ...
>>> 11:12:47  + ~~
>>> 11:12:47  + CategoryInfo  : ObjectNotFound: (az:String) [], 
>>> CommandNotFoundException
>>> 11:12:47  + FullyQualifiedErrorId : CommandNotFoundException
>>> 11:12:47   
>>> 11:12:47  az : The term 'az' is not recognized as the name of a cmdlet, 
>>> function, script file, or operable program. Check the 
>>> 11:12:47  spelling of the name, or if a path was included, verify that 
>>> the path is correct and try again.
>>> 11:12:47  At 
>>> C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellScript.ps1:4
>>>  
>>> char:35
>>> 11:12:47  + $output = az boards work-item show 
>>> --id=89609 ...
>>> 11:12:47  +   ~~
>>> 11:12:47  + CategoryInfo  : ObjectNotFound: (az:String) [], 
>>> CommandNotFoundException
>>> 11:12:47  + FullyQualifiedErrorId : CommandNotFoundException
>>> ```
>>> However running any command from the cmd / powershell works fine. I have 
>>> set the ```Set-ExecutionPolicy Unrestricted``` command but I do not get any 
>>> hint of what is going wrong
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5bcb14dd-b50c-4fe8-a8af-967fb502720an%40googlegroups.com.


error when sending jelly template using email ext plugin with jenkins

2021-04-08 Thread jesus fernandez
I want to send the cppcheck report through email but I had never used the 
email ext plugin before, so I found this  
https://stackoverflow.com/questions/13888338/sending-cppcheck-result-report-on-email-from-jenkins-using-email-ext-plugin
 
with a nice jelly template to do so, I have also followed the steps in the 
documentation, to send my own templates in a pipeline job, I have created 
my template with a .jelly extension and set it into my 
```$JENKINS_HOME\email-templates``` although the email-templates folder did 
not exist, so I am not sure if it should be created beforehand just by 
installing the plugin or what I am missing. This is my stage
```
stage('Mail cppcheck report') {
steps{
script{
def mailRecipients = "em...@email.net"
def jobName = currentBuild.fullDisplayName
mimeType: 'text/html'
emailext body: '''${JELLY_SCRIPT, template="custom"}''',
subject: "[Jenkins] ${jobName}",
to: "${mailRecipients}" 
}
}
}
```

And this is the template I want to use but I keep getting the following 
error ``` JellyException: Could not parse Jelly script : null``` even 
though the email is sent the email body is just the error mentioned above.

```





CPPCHECK RESULT
Found: 
${cppcheckResult.report.getNumberTotal()}




```
I have also tried with some other templates and I get no error but I 
receive an empty email instead, like with this one. 
```

  

  


  Summary

#cppcheckStatistics { width: auto; }
#cppcheckStatistics .number { text-align: right; }


  

  Severity
  Count
  Delta

  
  

  Error
  ${cppcheckResult.statistics.getNumberErrorSeverity()}
  ${cppcheckResult.getDiff().getNumberErrorSeverity()}


  Warning
  ${cppcheckResult.statistics.getNumberWarningSeverity()}
  ${cppcheckResult.getDiff().getNumberWarningSeverity()}


  Style
  ${cppcheckResult.statistics.getNumberStyleSeverity()}
  ${cppcheckResult.getDiff().getNumberStyleSeverity()}


  Performance
  ${cppcheckResult.statistics.getNumberPerformanceSeverity()}
  ${cppcheckResult.getDiff().getNumberPerformanceSeverity()}


  Portability
  ${cppcheckResult.statistics.getNumberPortabilitySeverity()}
  ${cppcheckResult.getDiff().getNumberPortabilitySeverity()}


  Information
  ${cppcheckResult.statistics.getNumberInformationSeverity()}
  ${cppcheckResult.getDiff().getNumberInformationSeverity()}


  No category
  ${cppcheckResult.statistics.getNumberNoCategorySeverity()}
  ${cppcheckResult.getDiff().getNumberNoCategorySeverity()}

  
  

  Total
  ${cppcheckResult.report.getNumberTotal()}
  ${cppcheckResult.getDiff().getNumberTotal()}

  

  

  

```

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8ea4ff9c-1e1f-4b63-b05c-7b04bad9f310n%40googlegroups.com.


Re: how can I use my own templates with email ext plugin in Jenkins?

2021-04-08 Thread jesus fernandez
I have also tried with some other templates with the same result, if I 
remove the ```mimeType: 'text/html'``` I do not get an error but I get a 
blank email in both cases

El jueves, 8 de abril de 2021 a las 13:02:11 UTC+2, jesus fernandez 
escribió:

> I want to send the cppcheck report through email but I had never used the 
> email ext plugin before, so I found this  
> https://stackoverflow.com/questions/13888338/sending-cppcheck-result-report-on-email-from-jenkins-using-email-ext-plugin
>  
> with a nice jelly template to do so, I have also followed the steps in the 
> documentation, to send my own templates in a pipeline job, I have created 
> my template with a .jelly extension and set it into my 
> ```$JENKINS_HOME\email-templates``` although the email-templates folder did 
> not exist, so I am not sure if it should be created beforehand just by 
> installing the plugin or what I am missing. This is my stage
> ```
> stage('Mail cppcheck report') {
> steps{
> script{
> def mailRecipients = "em...@email.net"
> def jobName = currentBuild.fullDisplayName
> 
> emailext body: '''${JELLY_SCRIPT, 
> template="custom"}''',
> subject: "[Jenkins] ${jobName}",
> to: "${mailRecipients}" 
> }
> }
> }
> ```
>
> And this is the template I want to use but I keep getting the following 
> error ``` JellyException: Could not parse Jelly script : null```
>
> ```
>  xmlns:d="jelly:define">
>   
>  value="${it.getAction('org.jenkinsci.plugins.cppcheck.CppcheckBuildAction')}" 
> />
>   
> 
> 
>   Summary
> 
> #cppcheckStatistics { width: auto; }
> #cppcheckStatistics .number { text-align: right; }
> 
> 
>   
> 
>   Severity
>   Count
>   Delta
> 
>   
>   
> 
>   Error
>   ${cppcheckResult.statistics.getNumberErrorSeverity()}
>   ${cppcheckResult.getDiff().getNumberErrorSeverity()}
> 
> 
>   Warning
>   ${cppcheckResult.statistics.getNumberWarningSeverity()}
>   ${cppcheckResult.getDiff().getNumberWarningSeverity()}
> 
> 
>   Style
>   ${cppcheckResult.statistics.getNumberStyleSeverity()}
>   ${cppcheckResult.getDiff().getNumberStyleSeverity()}
> 
> 
>   Performance
>   ${cppcheckResult.statistics.getNumberPerformanceSeverity()}
>   ${cppcheckResult.getDiff().getNumberPerformanceSeverity()}
> 
> 
>   Portability
>   ${cppcheckResult.statistics.getNumberPortabilitySeverity()}
>   ${cppcheckResult.getDiff().getNumberPortabilitySeverity()}
> 
> 
>   Information
>   ${cppcheckResult.statistics.getNumberInformationSeverity()}
>   ${cppcheckResult.getDiff().getNumberInformationSeverity()}
> 
> 
>   No category
>   ${cppcheckResult.statistics.getNumberNoCategorySeverity()}
>   ${cppcheckResult.getDiff().getNumberNoCategorySeverity()}
> 
>   
>   
> 
>   Total
>href="${rooturl}${build.url}cppcheckResult">${cppcheckResult.report.getNumberTotal()}
>href="${rooturl}${build.url}cppcheckResult/source.all/?before=5after=5states=new">${cppcheckResult.getDiff().getNumberTotal()}
> 
>   
> 
>   
> 
>   
> 
> ```
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/43b0776a-7903-46fb-96b6-ef1b73db27can%40googlegroups.com.


how can I use my own templates with email ext plugin in Jenkins?

2021-04-08 Thread jesus fernandez
I want to send the cppcheck report through email but I had never used the 
email ext plugin before, so I found this  
https://stackoverflow.com/questions/13888338/sending-cppcheck-result-report-on-email-from-jenkins-using-email-ext-plugin
 
with a nice jelly template to do so, I have also followed the steps in the 
documentation, to send my own templates in a pipeline job, I have created 
my template with a .jelly extension and set it into my 
```$JENKINS_HOME\email-templates``` although the email-templates folder did 
not exist, so I am not sure if it should be created beforehand just by 
installing the plugin or what I am missing. This is my stage
```
stage('Mail cppcheck report') {
steps{
script{
def mailRecipients = "em...@email.net"
def jobName = currentBuild.fullDisplayName

emailext body: '''${JELLY_SCRIPT, template="custom"}''',
subject: "[Jenkins] ${jobName}",
to: "${mailRecipients}" 
}
}
}
```

And this is the template I want to use but I keep getting the following 
error ``` JellyException: Could not parse Jelly script : null```

```

  

  


  Summary

#cppcheckStatistics { width: auto; }
#cppcheckStatistics .number { text-align: right; }


  

  Severity
  Count
  Delta

  
  

  Error
  ${cppcheckResult.statistics.getNumberErrorSeverity()}
  ${cppcheckResult.getDiff().getNumberErrorSeverity()}


  Warning
  ${cppcheckResult.statistics.getNumberWarningSeverity()}
  ${cppcheckResult.getDiff().getNumberWarningSeverity()}


  Style
  ${cppcheckResult.statistics.getNumberStyleSeverity()}
  ${cppcheckResult.getDiff().getNumberStyleSeverity()}


  Performance
  ${cppcheckResult.statistics.getNumberPerformanceSeverity()}
  ${cppcheckResult.getDiff().getNumberPerformanceSeverity()}


  Portability
  ${cppcheckResult.statistics.getNumberPortabilitySeverity()}
  ${cppcheckResult.getDiff().getNumberPortabilitySeverity()}


  Information
  ${cppcheckResult.statistics.getNumberInformationSeverity()}
  ${cppcheckResult.getDiff().getNumberInformationSeverity()}


  No category
  ${cppcheckResult.statistics.getNumberNoCategorySeverity()}
  ${cppcheckResult.getDiff().getNumberNoCategorySeverity()}

  
  

  Total
  ${cppcheckResult.report.getNumberTotal()}
  ${cppcheckResult.getDiff().getNumberTotal()}

  

  

  

```

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/276b13fb-4be3-4fc3-8268-4c7ea2ddd3b7n%40googlegroups.com.


Re: I cannot run Azure CLI commands from jenkins pipeline

2021-04-07 Thread jesus fernandez
az is installed as it runs from the cmd, and it also runs if I start 
jenkins from a non administrator prompt, it just do not work when starting 
Jenkins from a admin prompt (which I need to)

El martes, 6 de abril de 2021 a las 21:22:06 UTC+2, Martin Schmude escribió:

> Maybe az has not been installed on the system where the job is executed.
> Or az is not part of the PATH variable in the context of the job execution.
> Let the job execute "echo $env:path" before any "az ..." commands, so that 
> it prints out its path environment variable.
>
> jesusfern...@gmail.com schrieb am Dienstag, 6. April 2021 um 13:21:16 
> UTC+2:
>
>> I am trying to run some az commands from a Jenkins pipeline which 
>> (running in Windows 10) I already used in my laptop´s Jenkins, but when 
>> trying to use it on another computer (also running w10) I get this error : 
>> ```
>> 11:12:47  powershell.exe : az : The term 'az' is not recognized as the 
>> name of a cmdlet, function, script file, or operable program. Check the 
>> 11:12:47  At 
>> C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellWrapper.ps1:3
>>  
>> char:1
>> 11:12:47  + & powershell -NoProfile -NonInteractive -ExecutionPolicy 
>> Bypass -Comm ...
>> 11:12:47  + 
>> ~
>> 11:12:47  + CategoryInfo  : NotSpecified: (az : The term 
>> '...ram. Check the :String) [], RemoteException
>> 11:12:47  + FullyQualifiedErrorId : NativeCommandError
>> 11:12:47   
>> 11:12:47  spelling of the name, or if a path was included, verify that 
>> the path is correct and try again.
>> 11:12:47  At 
>> C:\Users\User\.jenkins\workspace\playground\tmp\durable-933c3d89\powershellScript.ps1:3
>>  
>> char:25
>> 11:12:47  + az devops configure --defaults 
>> organization=h ...
>> 11:12:47  + ~~
>> 11:12:47  + CategoryInfo  : ObjectNotFound: (az:String) [], 
>> CommandNotFoundException
>> 11:12:47  + FullyQualifiedErrorId : CommandNotFoundException
>> 11:12:47   
>> 11:12:47  az : The term 'az' is not recognized as the name of a cmdlet, 
>> function, script file, or operable program. Check the 
>> 11:12:47  spelling of the name, or if a path was included, verify that 
>> the path is correct and try again.
>> 11:12:47  At 
>> C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellScript.ps1:4
>>  
>> char:35
>> 11:12:47  + $output = az boards work-item show 
>> --id=89609 ...
>> 11:12:47  +   ~~
>> 11:12:47  + CategoryInfo  : ObjectNotFound: (az:String) [], 
>> CommandNotFoundException
>> 11:12:47  + FullyQualifiedErrorId : CommandNotFoundException
>> ```
>> However running any command from the cmd / powershell works fine. I have 
>> set the ```Set-ExecutionPolicy Unrestricted``` command but I do not get any 
>> hint of what is going wrong
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/63896e4c-2dd0-42b6-8778-5ad554637512n%40googlegroups.com.


I cannot run Azure CLI commands from jenkins pipeline

2021-04-06 Thread jesus fernandez
I am trying to run some az commands from a Jenkins pipeline which (running 
in Windows 10) I already used in my laptop´s Jenkins, but when trying to 
use it on another computer (also running w10) I get this error : 
```
11:12:47  powershell.exe : az : The term 'az' is not recognized as the name 
of a cmdlet, function, script file, or operable program. Check the 
11:12:47  At 
C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellWrapper.ps1:3
 
char:1
11:12:47  + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass 
-Comm ...
11:12:47  + 
~
11:12:47  + CategoryInfo  : NotSpecified: (az : The term 
'...ram. Check the :String) [], RemoteException
11:12:47  + FullyQualifiedErrorId : NativeCommandError
11:12:47   
11:12:47  spelling of the name, or if a path was included, verify that the 
path is correct and try again.
11:12:47  At 
C:\Users\User\.jenkins\workspace\playground\tmp\durable-933c3d89\powershellScript.ps1:3
 
char:25
11:12:47  + az devops configure --defaults 
organization=h ...
11:12:47  + ~~
11:12:47  + CategoryInfo  : ObjectNotFound: (az:String) [], 
CommandNotFoundException
11:12:47  + FullyQualifiedErrorId : CommandNotFoundException
11:12:47   
11:12:47  az : The term 'az' is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the 
11:12:47  spelling of the name, or if a path was included, verify that the 
path is correct and try again.
11:12:47  At 
C:\Users\User\.jenkins\workspace\playground@tmp\durable-933c3d89\powershellScript.ps1:4
 
char:35
11:12:47  + $output = az boards work-item show 
--id=89609 ...
11:12:47  +   ~~
11:12:47  + CategoryInfo  : ObjectNotFound: (az:String) [], 
CommandNotFoundException
11:12:47  + FullyQualifiedErrorId : CommandNotFoundException
```
However running any command from the cmd / powershell works fine. I have 
set the ```Set-ExecutionPolicy Unrestricted``` command but I do not get any 
hint of what is going wrong

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5b733163-a0c1-40c5-b747-2ba12bd09f2en%40googlegroups.com.


Re: how can I run cppcheck in Jenkins?

2021-04-01 Thread jesus fernandez
Thanks for answering,

I tried what you suggested but adding it as a env variable to the node 
variables does not work either. Regarding adding it to the jenkins user 
path I am not sure what you mean, I am not sure how to do that in windows 
10, I start jenkins just by executing the .war file

El miércoles, 31 de marzo de 2021 a las 15:35:37 UTC+2, Jérôme Godbout 
escribió:

> Jenkins run as his own user by default, check node user or login user you 
> are using. The cppcheck must be into that user env PATH variable. 
>
>  
>
> I work round this to avoid spamming the PATH variable on the machine by 
> doing env config into Jenkins, and I use that env variable to give a full 
> path on each node.
>
>  
>
> https:///computer//configure
>
>  
>
>  
>
> Then each node can install or put his binary into a custom path depends on 
> the node. I use the node label to declare his capacity:
>
>  
>
>  
>
> That way I run into a node that provide DOXYGEN for example, I then need 
> to resolve the doxygen path with the env variable or if the variable is not 
> present I assume the tool is inside the node current PATH var already (save 
> some time for tool that are install system wide).
>
>  
>
> *Jérôme Godbout, B. Ing.*
>
>
> Software / Firmware Team Lead
> *O:* (418) 682-3636 ext.: 114  
>
> *C:* (581) 777-0050 
> godb...@dimonoff.com
>
> [image: signature_16446078] <https://www.dimonoff.com/>
>
> *dimonoff.com* <https://www.dimonoff.com/>
>
> 1015 Avenue Wilfrid-Pelletier, 
>
> Québec, QC G1W 0C4, 4e étage
>
>  
>
>  
>
> *From: *jenkins...@googlegroups.com  on 
> behalf of jesus fernandez 
> *Date: *Wednesday, March 31, 2021 at 5:44 AM
> *To: *Jenkins Users 
> *Subject: *how can I run cppcheck in Jenkins?
>
> I have a playground pipeline and I am trying to start using cppcheck, but 
> when I execute the command in the cmd (I am running windows 10) it works 
> fine, but if executing the command inside the pipeline, it returns 
> ```'cppcheck' is not recognized as an internal or external command``` I 
> have installed the plugin and restarted Jenkins... what am I missing then? 
> . This is the sample pipeline:
>
> ```
>
> pipeline {
>
> agent any
>
> stages {
>
> stage('Static Analysis') {
>
> steps {
>
> script{
>
> env.FAILED_STAGE=env.STAGE_NAME
>
> bat'cppcheck "D:/Source/Game"'
>
> }
>
> }
>
> }
>
> }
>
> }
>
> ```
>
>  
>
> however the exactly same command, copied and pasted into the cmd, works 
> just fine, analyze the folder and gives me the cppcheck.xml file. 
>
>  
>
> Also if running the pipeline like this it seems to work just fine:
>
> ```
>
> stage('Static Analysis') {
>
> steps {
>
> script{
>
> bat'call  "C:\\Program Files\\Cppcheck\\cppcheck.exe" 
> D:\\Source\\Game  --xml --xml-version=2 . 2> cppcheck.xml'
>
> }
>
> }
>
> }
>
> ```
>
>  
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/04691194-8864-411b-bd34-2ed8e20ab9fan%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/04691194-8864-411b-bd34-2ed8e20ab9fan%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/071dc060-c260-4885-9d15-f96043d15964n%40googlegroups.com.


how can I run cppcheck in Jenkins?

2021-03-31 Thread jesus fernandez
I have a playground pipeline and I am trying to start using cppcheck, but 
when I execute the command in the cmd (I am running windows 10) it works 
fine, but if executing the command inside the pipeline, it returns 
```'cppcheck' is not recognized as an internal or external command``` I 
have installed the plugin and restarted Jenkins... what am I missing then? 
. This is the sample pipeline:
```
pipeline {
agent any
stages {
stage('Static Analysis') {
steps {
script{
env.FAILED_STAGE=env.STAGE_NAME
bat'cppcheck "D:/Source/Game"'
}
}
}
}
}
```

however the exactly same command, copied and pasted into the cmd, works 
just fine, analyze the folder and gives me the cppcheck.xml file. 

Also if running the pipeline like this it seems to work just fine:
```
stage('Static Analysis') {
steps {
script{
bat'call  "C:\\Program Files\\Cppcheck\\cppcheck.exe" 
D:\\Source\\Game  --xml --xml-version=2 . 2> cppcheck.xml'
}
}
}
```

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/04691194-8864-411b-bd34-2ed8e20ab9fan%40googlegroups.com.


Re: How to publish cppcheck results in a pipeline?

2021-03-26 Thread jesus fernandez
Thanks Jerome I use sonarqube at the moment ( I am also learning on this
one, but at least is working) but I wanted to check other alternatives as
sonarqibe slow down the pipeline as it takes quiet some computing time.
Would you recommend sonarqube over cppcheck for a jenkins pipeline?

El vie., 26 mar. 2021 14:52, Jérôme Godbout  escribió:

> You probably need something like this:
>
> cppcheck --xml-version=2 --enable=all   2>samplecppcheck.xml
>
>
>
>
> https://stackoverflow.com/questions/10611011/cannot-generate-xml-output-from-cppcheck
>
>
>
> cppcheck is a pain from command line, the command line was an after
> though, they screw big time. I stop using it just for that reason, the CLI
> is not matching the GUI and the results are unpredictable in case of
> errors. The fact that it requires the redirection of std_err, just that
> show a bad design from people who doesn’t give a damn about CLI. I strongly
> recommend you find something else to do your static analysis into your CI.
>
>
>
>
>
> *Jérôme Godbout, B. Ing.*
>
>
> Software / Firmware Team Lead
> *O:* (418) 682-3636 ext.: 114
>
> *C:* (581) 777-0050
> godbo...@dimonoff.com
>
> [image: signature_1613841900] <https://www.dimonoff.com/>
>
> *dimonoff.com* <https://www.dimonoff.com/>
>
> 1015 Avenue Wilfrid-Pelletier,
>
> Québec, QC G1W 0C4, 4e étage
>
>
>
>
>
> *From: *jenkinsci-users@googlegroups.com 
> on behalf of Ullrich Hafner 
> *Date: *Friday, March 26, 2021 at 7:44 AM
> *To: *Jenkins Users 
> *Subject: *Re: How to publish cppcheck results in a pipeline?
>
> I don’t know. Don’t you have a dedicated forum to ask cppcheck questions?
>
>
>
> I still do not understand why you are redirecting stdout or stderr. I
> would assume that every tool that creates XML files automatically creates
> the file in your workspace. Did you check the workspace if there is a file
> if you omit the redirect (>)?
>
>
>
>
>
> Am 26.03.2021 um 11:28 schrieb jesus fernandez <
> jesusfernandez0...@gmail.com>:
>
>
>
> Thanks for the replies but how woud the command be then? something like
> this cppcheck "E:/Source" --force — enable=all — inconclusive — xml —
> xml-version=2 . > cppcheck.xm
>
> El jueves, 25 de marzo de 2021 a las 21:49:15 UTC+1, ullrich...@gmail.com
> escribió:
>
> Yes, this is definitely not XML :-)
>
> This is the stderr of your program!
>
>
>
> 2 > cppcheck.xml pipes your stderr to a file. You do not need this part.
>
>
>
> Am 25.03.2021 um 20:08 schrieb jesus fernandez :
>
>
>
> so it seems like if it basically is writting all the outputs the cmd throws
>
> El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez
> escribió:
>
> the supposely .xml does not have any format, these are the first 5 lines:
>
> Checking E:\Source\Game\AchievementManager.cpp ...
>
>
> Checking E:\Source\Game\AchievementManager.cpp: 
> APP_STEAM;FINAL_RELEASE;_DEBUG...
>
>
> Checking E:\Source\Game\AchievementManager.cpp: 
> APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...
>
>
> Checking E:\Source\Game\AchievementManager.cpp: 
> APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...
>
> Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...
>
>
>
> El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, ullrich...@gmail.com
>  escribió:
>
> If you can’t check on your own if the file contains valid XML can you
> please show the first 5 lines of the XML file here?
>
>
>
> Am 25.03.2021 um 19:36 schrieb jesus fernandez :
>
>
>
> I thought the  ```bat'cppcheck "E:/Source" --force — enable=all —
> inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does
> genearate a valid xml. is it a matter of missing parameters or a matter of
> having to parse the output? in the documentation and the SO link I attached
> it is supposed to be done like that... what am I missing here?
>
> El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com
>  escribió:
>
> The exception says it is not a valid XML file. Is it a valid XML file?
> Seems that there is content before the fir XML tag. Can you open it in an
> editor that can validate the XML?
>
>
>
> Am 25.03.2021 um 17:57 schrieb jesus fernandez :
>
>
>
> Thanks for replying, I have opened and it has 2000 lines of code but I do
> not know if it is valid or not as I have never used cppcheck before, and if
> it is not valid is it because I am not using the right parameters when
> calling cppcheck or how?
>
>
>
>
>
> El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.c

Re: How to publish cppcheck results in a pipeline?

2021-03-26 Thread jesus fernandez
Thanks for the replies but how woud the command be then? something like 
this cppcheck "E:/Source" --force — enable=all — inconclusive — xml — 
xml-version=2 . > cppcheck.xm

El jueves, 25 de marzo de 2021 a las 21:49:15 UTC+1, ullrich...@gmail.com 
escribió:

> Yes, this is definitely not XML :-)
> This is the stderr of your program! 
>
> 2 > cppcheck.xml pipes your stderr to a file. You do not need this part. 
>
> Am 25.03.2021 um 20:08 schrieb jesus fernandez :
>
> so it seems like if it basically is writting all the outputs the cmd throws
>
> El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez 
> escribió:
>
>> the supposely .xml does not have any format, these are the first 5 lines:
>> Checking E:\Source\Game\AchievementManager.cpp ...
>>
>> Checking E:\Source\Game\AchievementManager.cpp: 
>> APP_STEAM;FINAL_RELEASE;_DEBUG...
>>
>> Checking E:\Source\Game\AchievementManager.cpp: 
>> APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...
>>
>> Checking E:\Source\Game\AchievementManager.cpp: 
>> APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...
>> Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...
>>
>> El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, ullrich...@gmail.com
>>  escribió:
>>
>>> If you can’t check on your own if the file contains valid XML can you 
>>> please show the first 5 lines of the XML file here?
>>>
>>> Am 25.03.2021 um 19:36 schrieb jesus fernandez :
>>>
>>> I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — 
>>> inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does 
>>> genearate a valid xml. is it a matter of missing parameters or a matter of 
>>> having to parse the output? in the documentation and the SO link I attached 
>>> it is supposed to be done like that... what am I missing here?
>>>
>>> El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@
>>> gmail.com escribió:
>>>
>>>> The exception says it is not a valid XML file. Is it a valid XML file? 
>>>> Seems that there is content before the fir XML tag. Can you open it in an 
>>>> editor that can validate the XML?
>>>>
>>>> Am 25.03.2021 um 17:57 schrieb jesus fernandez >>> >:
>>>>
>>>> Thanks for replying, I have opened and it has 2000 lines of code but I 
>>>> do not know if it is valid or not as I have never used cppcheck before, 
>>>> and 
>>>> if it is not valid is it because I am not using the right parameters when 
>>>> calling cppcheck or how?
>>>>
>>>>
>>>>
>>>> El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@
>>>> gmail.com escribió:
>>>>
>>>>> It look like your create XML is not valid. Can you please open the XML 
>>>>> file and check? 
>>>>>
>>>>> Am 25.03.2021 um 17:40 schrieb jesus fernandez >>>> >:
>>>>>
>>>>> I am learning about Jenkins on my own, and I wanted to try the 
>>>>> cppcheck plugin, I have setup the following sample pipeline:
>>>>> ```
>>>>> pipeline {
>>>>> agent any
>>>>>
>>>>> stages {
>>>>> stage('analysis') {
>>>>> steps {
>>>>> script{
>>>>> bat'cppcheck "E:/Source" --force — enable=all — 
>>>>> inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
>>>>> }
>>>>> }
>>>>> }
>>>>> }
>>>>> post {
>>>>> always {
>>>>> // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
>>>>> publishCppcheck pattern:'cppcheck.xml'
>>>>> }
>>>>> }
>>>>> }
>>>>> ```
>>>>>
>>>>> But I get an error in the post step which I do not know if it is 
>>>>> related to my projecto or if I am doing something wrong. I have follow 
>>>>> the 
>>>>> instructions on this thread [cppcheck][1]but it does not seem to work, 
>>>>> wehther I use ```publushCppcheck``` :
>>>>> ```
>>>>> [Pipeline] { (Declarative: Post Actions)
>>>>> [Pipeline] publishCppcheck (hide)
>>>>> [Cppcheck] Star

Re: How to publish cppcheck results in a pipeline?

2021-03-25 Thread jesus fernandez
so it seems like if it basically is writting all the outputs the cmd throws

El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez 
escribió:

> the supposely .xml does not have any format, these are the first 5 lines:
> Checking E:\Source\Game\AchievementManager.cpp ...
>
> Checking E:\Source\Game\AchievementManager.cpp: 
> APP_STEAM;FINAL_RELEASE;_DEBUG...
>
> Checking E:\Source\Game\AchievementManager.cpp: 
> APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...
>
> Checking E:\Source\Game\AchievementManager.cpp: 
> APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...
> Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...
>
> El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, ullrich...@gmail.com 
> escribió:
>
>> If you can’t check on your own if the file contains valid XML can you 
>> please show the first 5 lines of the XML file here?
>>
>> Am 25.03.2021 um 19:36 schrieb jesus fernandez :
>>
>> I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — 
>> inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does 
>> genearate a valid xml. is it a matter of missing parameters or a matter of 
>> having to parse the output? in the documentation and the SO link I attached 
>> it is supposed to be done like that... what am I missing here?
>>
>> El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com 
>> escribió:
>>
>>> The exception says it is not a valid XML file. Is it a valid XML file? 
>>> Seems that there is content before the fir XML tag. Can you open it in an 
>>> editor that can validate the XML?
>>>
>>> Am 25.03.2021 um 17:57 schrieb jesus fernandez :
>>>
>>> Thanks for replying, I have opened and it has 2000 lines of code but I 
>>> do not know if it is valid or not as I have never used cppcheck before, and 
>>> if it is not valid is it because I am not using the right parameters when 
>>> calling cppcheck or how?
>>>
>>>
>>>
>>> El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@
>>> gmail.com escribió:
>>>
>>>> It look like your create XML is not valid. Can you please open the XML 
>>>> file and check? 
>>>>
>>>> Am 25.03.2021 um 17:40 schrieb jesus fernandez >>> >:
>>>>
>>>> I am learning about Jenkins on my own, and I wanted to try the cppcheck 
>>>> plugin, I have setup the following sample pipeline:
>>>> ```
>>>> pipeline {
>>>> agent any
>>>>
>>>> stages {
>>>> stage('analysis') {
>>>> steps {
>>>> script{
>>>> bat'cppcheck "E:/Source" --force — enable=all — 
>>>> inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
>>>> }
>>>> }
>>>> }
>>>> }
>>>> post {
>>>> always {
>>>> // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
>>>> publishCppcheck pattern:'cppcheck.xml'
>>>> }
>>>> }
>>>> }
>>>> ```
>>>>
>>>> But I get an error in the post step which I do not know if it is 
>>>> related to my projecto or if I am doing something wrong. I have follow the 
>>>> instructions on this thread [cppcheck][1]but it does not seem to work, 
>>>> wehther I use ```publushCppcheck``` :
>>>> ```
>>>> [Pipeline] { (Declarative: Post Actions)
>>>> [Pipeline] publishCppcheck (hide)
>>>> [Cppcheck] Starting the cppcheck analysis.
>>>> [Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
>>>> [Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
>>>>  - with linked exception:
>>>> [org.xml.sax.SAXParseException; systemId: 
>>>> file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
>>>> columnNumber: 1; El contenido no está permitido en el prólogo.]
>>>> [Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
>>>>  - with linked exception:
>>>> [org.xml.sax.SAXParseException; systemId: 
>>>> file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
>>>> columnNumber: 1; El contenido no está permitido en el prólogo.]
>>>> at 
>>>> org.jenkinsci.plugins.cppcheck.pars

Re: How to publish cppcheck results in a pipeline?

2021-03-25 Thread jesus fernandez
the supposely .xml does not have any format, these are the first 5 lines:
Checking E:\Source\Game\AchievementManager.cpp ...
Checking E:\Source\Game\AchievementManager.cpp: 
APP_STEAM;FINAL_RELEASE;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: 
APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: 
APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, ullrich...@gmail.com 
escribió:

> If you can’t check on your own if the file contains valid XML can you 
> please show the first 5 lines of the XML file here?
>
> Am 25.03.2021 um 19:36 schrieb jesus fernandez :
>
> I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — 
> inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does 
> genearate a valid xml. is it a matter of missing parameters or a matter of 
> having to parse the output? in the documentation and the SO link I attached 
> it is supposed to be done like that... what am I missing here?
>
> El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com 
> escribió:
>
>> The exception says it is not a valid XML file. Is it a valid XML file? 
>> Seems that there is content before the fir XML tag. Can you open it in an 
>> editor that can validate the XML?
>>
>> Am 25.03.2021 um 17:57 schrieb jesus fernandez :
>>
>> Thanks for replying, I have opened and it has 2000 lines of code but I do 
>> not know if it is valid or not as I have never used cppcheck before, and if 
>> it is not valid is it because I am not using the right parameters when 
>> calling cppcheck or how?
>>
>>
>>
>> El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com 
>> escribió:
>>
>>> It look like your create XML is not valid. Can you please open the XML 
>>> file and check? 
>>>
>>> Am 25.03.2021 um 17:40 schrieb jesus fernandez :
>>>
>>> I am learning about Jenkins on my own, and I wanted to try the cppcheck 
>>> plugin, I have setup the following sample pipeline:
>>> ```
>>> pipeline {
>>> agent any
>>>
>>> stages {
>>> stage('analysis') {
>>> steps {
>>> script{
>>> bat'cppcheck "E:/Source" --force — enable=all — 
>>> inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
>>> }
>>> }
>>> }
>>> }
>>> post {
>>> always {
>>> // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
>>> publishCppcheck pattern:'cppcheck.xml'
>>> }
>>> }
>>> }
>>> ```
>>>
>>> But I get an error in the post step which I do not know if it is related 
>>> to my projecto or if I am doing something wrong. I have follow the 
>>> instructions on this thread [cppcheck][1]but it does not seem to work, 
>>> wehther I use ```publushCppcheck``` :
>>> ```
>>> [Pipeline] { (Declarative: Post Actions)
>>> [Pipeline] publishCppcheck (hide)
>>> [Cppcheck] Starting the cppcheck analysis.
>>> [Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
>>> [Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
>>>  - with linked exception:
>>> [org.xml.sax.SAXParseException; systemId: 
>>> file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
>>> columnNumber: 1; El contenido no está permitido en el prólogo.]
>>> [Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
>>>  - with linked exception:
>>> [org.xml.sax.SAXParseException; systemId: 
>>> file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
>>> columnNumber: 1; El contenido no está permitido en el prólogo.]
>>> at 
>>> org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
>>> at 
>>> org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
>>> at 
>>> org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
>>> at hudson.FilePath.act(FilePath.java:1164)
>>> at hudson.FilePath.act(FilePath.java:1147)
>>> at 
>>> org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
>>> at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java

Re: How to publish cppcheck results in a pipeline?

2021-03-25 Thread jesus fernandez
I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — 
inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does 
genearate a valid xml. is it a matter of missing parameters or a matter of 
having to parse the output? in the documentation and the SO link I attached 
it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com 
escribió:

> The exception says it is not a valid XML file. Is it a valid XML file? 
> Seems that there is content before the fir XML tag. Can you open it in an 
> editor that can validate the XML?
>
> Am 25.03.2021 um 17:57 schrieb jesus fernandez :
>
> Thanks for replying, I have opened and it has 2000 lines of code but I do 
> not know if it is valid or not as I have never used cppcheck before, and if 
> it is not valid is it because I am not using the right parameters when 
> calling cppcheck or how?
>
>
>
> El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com 
> escribió:
>
>> It look like your create XML is not valid. Can you please open the XML 
>> file and check? 
>>
>> Am 25.03.2021 um 17:40 schrieb jesus fernandez :
>>
>> I am learning about Jenkins on my own, and I wanted to try the cppcheck 
>> plugin, I have setup the following sample pipeline:
>> ```
>> pipeline {
>> agent any
>>
>> stages {
>> stage('analysis') {
>> steps {
>> script{
>> bat'cppcheck "E:/Source" --force — enable=all — 
>> inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
>> }
>> }
>> }
>> }
>> post {
>> always {
>> // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
>> publishCppcheck pattern:'cppcheck.xml'
>> }
>> }
>> }
>> ```
>>
>> But I get an error in the post step which I do not know if it is related 
>> to my projecto or if I am doing something wrong. I have follow the 
>> instructions on this thread [cppcheck][1]but it does not seem to work, 
>> wehther I use ```publushCppcheck``` :
>> ```
>> [Pipeline] { (Declarative: Post Actions)
>> [Pipeline] publishCppcheck (hide)
>> [Cppcheck] Starting the cppcheck analysis.
>> [Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
>> [Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
>>  - with linked exception:
>> [org.xml.sax.SAXParseException; systemId: 
>> file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
>> columnNumber: 1; El contenido no está permitido en el prólogo.]
>> [Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
>>  - with linked exception:
>> [org.xml.sax.SAXParseException; systemId: 
>> file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
>> columnNumber: 1; El contenido no está permitido en el prólogo.]
>> at 
>> org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
>> at 
>> org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
>> at 
>> org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
>> at hudson.FilePath.act(FilePath.java:1164)
>> at hudson.FilePath.act(FilePath.java:1147)
>> at 
>> org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
>> at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
>> at 
>> org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
>> at 
>> org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
>> at 
>> org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
>> at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
>> at java.util.concurrent.FutureTask.run(Unknown Source)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>> at java.lang.Thread.run(Unknown Source)
>> Caused by: javax.xml.bind.UnmarshalException
>> ```
>>
>> or ```scanforIssues``` from warnings ng plugin::
>> ```
>> [Pipeline] { (Declarative: Post Actions)
>> [Pipeline] scanForIssues
>> [CPPCheck] [-ERROR-] Parsing of file 
>> 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an 
>> exception:
>> [CPP

Re: How to publish cppcheck results in a pipeline?

2021-03-25 Thread jesus fernandez
Thanks for replying, I have opened and it has 2000 lines of code but I do 
not know if it is valid or not as I have never used cppcheck before, and if 
it is not valid is it because I am not using the right parameters when 
calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com 
escribió:

> It look like your create XML is not valid. Can you please open the XML 
> file and check? 
>
> Am 25.03.2021 um 17:40 schrieb jesus fernandez :
>
> I am learning about Jenkins on my own, and I wanted to try the cppcheck 
> plugin, I have setup the following sample pipeline:
> ```
> pipeline {
> agent any
>
> stages {
> stage('analysis') {
> steps {
> script{
> bat'cppcheck "E:/Source" --force — enable=all — 
> inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
> }
> }
> }
> }
> post {
> always {
> // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
> publishCppcheck pattern:'cppcheck.xml'
> }
> }
> }
> ```
>
> But I get an error in the post step which I do not know if it is related 
> to my projecto or if I am doing something wrong. I have follow the 
> instructions on this thread [cppcheck][1]but it does not seem to work, 
> wehther I use ```publushCppcheck``` :
> ```
> [Pipeline] { (Declarative: Post Actions)
> [Pipeline] publishCppcheck (hide)
> [Cppcheck] Starting the cppcheck analysis.
> [Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
> [Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
>  - with linked exception:
> [org.xml.sax.SAXParseException; systemId: 
> file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
> columnNumber: 1; El contenido no está permitido en el prólogo.]
> [Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [org.xml.sax.SAXParseException; systemId: 
> file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
> columnNumber: 1; El contenido no está permitido en el prólogo.]
> at 
> org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
> at 
> org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
> at 
> org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
> at hudson.FilePath.act(FilePath.java:1164)
> at hudson.FilePath.act(FilePath.java:1147)
> at 
> org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
> at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
> at 
> org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
> at 
> org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
> at 
> org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
> at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
> at java.util.concurrent.FutureTask.run(Unknown Source)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
> Caused by: javax.xml.bind.UnmarshalException
> ```
>
> or ```scanforIssues``` from warnings ng plugin::
> ```
> [Pipeline] { (Declarative: Post Actions)
> [Pipeline] scanForIssues
> [CPPCheck] [-ERROR-] Parsing of file 
> 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an 
> exception:
> [CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: 
> Unexpected character 'C' (code 67) in prolog; expected '<'
>  at [row,col {unknown-source}]: [1,1]
> [CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
> [CPPCheck] [-ERROR-]  at 
> com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
> [CPPCheck] [-ERROR-]  at 
> com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
> [CPPCheck] [-ERROR-]  at 
> com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
> [CPPCheck] [-ERROR-]  at 
> se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
> [CPPCheck] [-ERROR-]  at 
> edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
> [CPPCheck] [-ERROR-]  at 
> io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
> [CPPCheck] [-ERROR-]  at 
> io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
> [CPPCheck] [-ERRO

How to publish cppcheck results in a pipeline?

2021-03-25 Thread jesus fernandez
I am learning about Jenkins on my own, and I wanted to try the cppcheck 
plugin, I have setup the following sample pipeline:
```
pipeline {
agent any

stages {
stage('analysis') {
steps {
script{
bat'cppcheck "E:/Source" --force — enable=all — 
inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
}
}
}
}
post {
always {
// scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
publishCppcheck pattern:'cppcheck.xml'
}
}
}
```

But I get an error in the post step which I do not know if it is related to 
my projecto or if I am doing something wrong. I have follow the 
instructions on this thread [cppcheck][1]but it does not seem to work, 
wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: 
file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: 
file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; 
columnNumber: 1; El contenido no está permitido en el prólogo.]
at 
org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at 
org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at 
org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at 
org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at 
org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at 
org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at 
org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 
'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an 
exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: 
Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at 
com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at 
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at 
com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at 
se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at 
edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at 
io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at 
io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at 
io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at 
io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at 
io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at 
io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at 
io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at 
io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at 
io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at 

Re: how can I get the value of a global variable within a function in a pipeline?

2021-02-12 Thread jesus fernandez
Thanks a lot Victor, the links provided made it much clear now and the 
example worked just fine. You are always saving me hehe

El jueves, 11 de febrero de 2021 a las 22:11:15 UTC+1, 
victormar...@gmail.com escribió:

> You can simplify it quite a bit with the post stage event 
> https://www.jenkins.io/doc/book/pipeline/syntax/#post
>
> The example pipeline uses the post *stages* section, you can use the one 
> specific the stage 3
>
> Another example can be found in 
> https://www.jenkins.io/blog/2017/02/15/declarative-notifications/
>
> Environment variables within an environment section are immutable, though 
> you can use the script closure with the env map to set a new env variable 
> that can be override
>
> For instance:
>
> stage(“stage 3”) {
>   steps{
>  script{
>env.FAILED_STAGE=env.STAGE_NAME
>  }
>  error ...
>   }
> }
>
> Cheers
>
>
>
>
>
> See 
>
> On Thursday, 11 February 2021 at 17:56:40 UTC jesusfern...@gmail.com 
> wrote:
>
>>
>> I have a declarative pipeline with a few steps. at the end I send a message 
>> to slack with some statistics of the compilation times and some more 
>> information. I want to send in case it fails the stage at which it fails. I 
>> have set a global variable but the function does not seem to be able to read 
>> its value. This is a simplified version of what I have: 
>>
>> ```
>> def FAILED_STAGE
>>
>> def sendSlackNotifcation() 
>> {
>> if ( currentBuild.currentResult == "SUCCESS" ) {
>>
>> slackSend message: "${currentBuild.result}", channel: '#jenkins_bot2'
>> }
>> 
>> else {
>>
>> slackSend color : "#FF", message: "${FAILED_STAGE}", channel: 
>> '#jenkins_bot2'
>>
>> }
>> }
>>
>> pipeline {
>> agent any
>>
>> stages {
>> stage('stage1') {
>> steps{
>> echo "stage1"
>> }
>> } 
>> 
>> stage('stage2') {
>> steps{
>> echo "stage2"
>> }
>> }
>> 
>> stage("Stage 3") {
>> steps {
>> script {
>> FAILED_STAGE=env.STAGE_NAME
>> echo "${FAILED_STAGE}"
>> error "failed for some reason."
>> }
>> }
>> }
>> }
>> post {
>> failure {
>> sendSlackNotifcation()
>> }
>> }
>>
>> }
>> ```
>> And this is the output I get:
>> ```
>> 13:38:53  [Pipeline] {
>> 13:38:53  [Pipeline] stage
>> 13:38:53  [Pipeline] { (stage1)
>> 13:38:53  [Pipeline] echo
>> 13:38:53  stage1
>> 13:38:53  [Pipeline] }
>> 13:38:53  [Pipeline] // stage
>> 13:38:53  [Pipeline] stage
>> 13:38:53  [Pipeline] { (stage2)
>> 13:38:53  [Pipeline] echo
>> 13:38:53  stage2
>> 13:38:53  [Pipeline] }
>> 13:38:53  [Pipeline] // stage
>> 13:38:53  [Pipeline] stage
>> 13:38:53  [Pipeline] { (Stage 3)
>> 13:38:53  [Pipeline] script
>> 13:38:53  [Pipeline] {
>> 13:38:53  [Pipeline] echo
>> 13:38:53  Stage 3
>> 13:38:53  [Pipeline] error
>> 13:38:53  [Pipeline] }
>> 13:38:53  [Pipeline] // script
>> 13:38:53  [Pipeline] }
>> 13:38:53  [Pipeline] // stage
>> 13:38:53  [Pipeline] stage
>> 13:38:53  [Pipeline] { (Declarative: Post Actions)
>> 13:38:53  Error when executing failure post condition:
>>
>> 13:38:53  groovy.lang.MissingPropertyException: No such property: 
>> FAILED_STAGE for class: WorkflowScript
>> ```
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/16c44a41-f7a2-4c4e-94d3-c820bebdf138n%40googlegroups.com.


how can I get the value of a global variable within a function in a pipeline?

2021-02-11 Thread Jesus Fernandez
I have a declarative pipeline with a few steps. at the end I send a message to 
slack with some statistics of the compilation times and some more information. 
I want to send in case it fails the stage at which it fails. I have set a 
global variable but the function does not seem to be able to read its value. 
This is a simplified version of what I have: 

```
def FAILED_STAGE

def sendSlackNotifcation() 
{
if ( currentBuild.currentResult == "SUCCESS" ) {
slackSend message: "${currentBuild.result}", channel: '#jenkins_bot2'
}

else {
slackSend color : "#FF", message: "${FAILED_STAGE}", channel: 
'#jenkins_bot2'

}
}

pipeline {
agent any

stages {
stage('stage1') {
steps{
echo "stage1"
}
} 

stage('stage2') {
steps{
echo "stage2"
}
}

stage("Stage 3") {
steps {
script {
FAILED_STAGE=env.STAGE_NAME
echo "${FAILED_STAGE}"
error "failed for some reason."
}
}
}
}
post {
failure {
sendSlackNotifcation()
}
}

}
```
And this is the output I get:
```
13:38:53  [Pipeline] {
13:38:53  [Pipeline] stage
13:38:53  [Pipeline] { (stage1)
13:38:53  [Pipeline] echo
13:38:53  stage1
13:38:53  [Pipeline] }
13:38:53  [Pipeline] // stage
13:38:53  [Pipeline] stage
13:38:53  [Pipeline] { (stage2)
13:38:53  [Pipeline] echo
13:38:53  stage2
13:38:53  [Pipeline] }
13:38:53  [Pipeline] // stage
13:38:53  [Pipeline] stage
13:38:53  [Pipeline] { (Stage 3)
13:38:53  [Pipeline] script
13:38:53  [Pipeline] {
13:38:53  [Pipeline] echo
13:38:53  Stage 3
13:38:53  [Pipeline] error
13:38:53  [Pipeline] }
13:38:53  [Pipeline] // script
13:38:53  [Pipeline] }
13:38:53  [Pipeline] // stage
13:38:53  [Pipeline] stage
13:38:53  [Pipeline] { (Declarative: Post Actions)
13:38:53  Error when executing failure post condition:
13:38:53  groovy.lang.MissingPropertyException: No such property: FAILED_STAGE 
for class: WorkflowScript
```

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/be75d622-ca44-47af-a06c-99464b802bbcn%40googlegroups.com.


Re: how can I get the value of a global variable within a function in a pipeline?

2021-02-11 Thread jesus fernandez
Thanks for replying, any example or any link where to get information about 
how to do so? I am a bit new to Jenkins

El jueves, 11 de febrero de 2021 a las 19:11:24 UTC+1, venh...@gmail.com 
escribió:

> Try defining it inside the "environment" stage / step.
>
> Regards,
> Venkatesh
>
>
> On Thu, Feb 11, 2021 at 11:26 PM jesus fernandez  
> wrote:
>
>>
>> I have a declarative pipeline with a few steps. at the end I send a message 
>> to slack with some statistics of the compilation times and some more 
>> information. I want to send in case it fails the stage at which it fails. I 
>> have set a global variable but the function does not seem to be able to read 
>> its value. This is a simplified version of what I have: 
>>
>> ```
>> def FAILED_STAGE
>>
>> def sendSlackNotifcation() 
>> {
>> if ( currentBuild.currentResult == "SUCCESS" ) {
>>
>> slackSend message: "${currentBuild.result}", channel: '#jenkins_bot2'
>> }
>> 
>> else {
>>
>> slackSend color : "#FF", message: "${FAILED_STAGE}", channel: 
>> '#jenkins_bot2'
>>
>> }
>> }
>>
>> pipeline {
>> agent any
>>
>> stages {
>> stage('stage1') {
>> steps{
>> echo "stage1"
>> }
>> } 
>> 
>> stage('stage2') {
>> steps{
>> echo "stage2"
>> }
>> }
>> 
>> stage("Stage 3") {
>> steps {
>> script {
>> FAILED_STAGE=env.STAGE_NAME
>> echo "${FAILED_STAGE}"
>> error "failed for some reason."
>> }
>> }
>> }
>> }
>> post {
>> failure {
>> sendSlackNotifcation()
>> }
>> }
>>
>> }
>> ```
>> And this is the output I get:
>> ```
>> 13:38:53  [Pipeline] {
>> 13:38:53  [Pipeline] stage
>> 13:38:53  [Pipeline] { (stage1)
>> 13:38:53  [Pipeline] echo
>> 13:38:53  stage1
>> 13:38:53  [Pipeline] }
>> 13:38:53  [Pipeline] // stage
>> 13:38:53  [Pipeline] stage
>> 13:38:53  [Pipeline] { (stage2)
>> 13:38:53  [Pipeline] echo
>> 13:38:53  stage2
>> 13:38:53  [Pipeline] }
>> 13:38:53  [Pipeline] // stage
>> 13:38:53  [Pipeline] stage
>> 13:38:53  [Pipeline] { (Stage 3)
>> 13:38:53  [Pipeline] script
>> 13:38:53  [Pipeline] {
>> 13:38:53  [Pipeline] echo
>> 13:38:53  Stage 3
>> 13:38:53  [Pipeline] error
>> 13:38:53  [Pipeline] }
>> 13:38:53  [Pipeline] // script
>> 13:38:53  [Pipeline] }
>> 13:38:53  [Pipeline] // stage
>> 13:38:53  [Pipeline] stage
>> 13:38:53  [Pipeline] { (Declarative: Post Actions)
>> 13:38:53  Error when executing failure post condition:
>>
>> 13:38:53  groovy.lang.MissingPropertyException: No such property: 
>> FAILED_STAGE for class: WorkflowScript
>> ```
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/91e7dbcd-c806-4d55-bc31-bc9a9ad4057cn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/91e7dbcd-c806-4d55-bc31-bc9a9ad4057cn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f2756185-f00c-4bf8-a382-f7659da29ca6n%40googlegroups.com.


how can I get the value of a global variable within a function in a pipeline?

2021-02-11 Thread jesus fernandez
I have a declarative pipeline with a few steps. at the end I send a message to 
slack with some statistics of the compilation times and some more information. 
I want to send in case it fails the stage at which it fails. I have set a 
global variable but the function does not seem to be able to read its value. 
This is a simplified version of what I have: 

```
def FAILED_STAGE

def sendSlackNotifcation() 
{
if ( currentBuild.currentResult == "SUCCESS" ) {
slackSend message: "${currentBuild.result}", channel: '#jenkins_bot2'
}

else {
slackSend color : "#FF", message: "${FAILED_STAGE}", channel: 
'#jenkins_bot2'

}
}

pipeline {
agent any

stages {
stage('stage1') {
steps{
echo "stage1"
}
} 

stage('stage2') {
steps{
echo "stage2"
}
}

stage("Stage 3") {
steps {
script {
FAILED_STAGE=env.STAGE_NAME
echo "${FAILED_STAGE}"
error "failed for some reason."
}
}
}
}
post {
failure {
sendSlackNotifcation()
}
}

}
```
And this is the output I get:
```
13:38:53  [Pipeline] {
13:38:53  [Pipeline] stage
13:38:53  [Pipeline] { (stage1)
13:38:53  [Pipeline] echo
13:38:53  stage1
13:38:53  [Pipeline] }
13:38:53  [Pipeline] // stage
13:38:53  [Pipeline] stage
13:38:53  [Pipeline] { (stage2)
13:38:53  [Pipeline] echo
13:38:53  stage2
13:38:53  [Pipeline] }
13:38:53  [Pipeline] // stage
13:38:53  [Pipeline] stage
13:38:53  [Pipeline] { (Stage 3)
13:38:53  [Pipeline] script
13:38:53  [Pipeline] {
13:38:53  [Pipeline] echo
13:38:53  Stage 3
13:38:53  [Pipeline] error
13:38:53  [Pipeline] }
13:38:53  [Pipeline] // script
13:38:53  [Pipeline] }
13:38:53  [Pipeline] // stage
13:38:53  [Pipeline] stage
13:38:53  [Pipeline] { (Declarative: Post Actions)
13:38:53  Error when executing failure post condition:
13:38:53  groovy.lang.MissingPropertyException: No such property: FAILED_STAGE 
for class: WorkflowScript
```

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/91e7dbcd-c806-4d55-bc31-bc9a9ad4057cn%40googlegroups.com.


I get an error when trying to iterate a xml file in jenkins pipeline

2020-11-17 Thread jesus fernandez
I am trying to understand how to iterate a .xml file in Jenkins so I create 
a super simple .xml file:
```


  hello
  bye

  
```
I just want to get acces to a tag value (i.e. tag3) and print it out. I 
have been reading a lot here on SO and I this is the cod I have:
```
import groovy.xml.*

pipeline {
agent any

stages {
stage('find') {
steps {
script{
def xml = readFile "C:\\Users\\anton\\Desktop\\test.xml"
def file = new XmlSlurper().parseTest(xml)

file.'**'.
findAll { it.name() == 'tag1' }
.each {println it.assetId.text()}
}
}
 
}
}
}
```

But I keep getting this error: ```hudson.remoting.ProxyException: 
groovy.lang.MissingMethodException: No signature of method: 
groovy.util.XmlSlurper.parseTest() is applicable for argument types: 
(java.lang.String) values: [``` 
If I try to use XmlParser() method I get the same error too. I have followe 
these links [java.net.MalformedURLException: no protocol: XML][1] and it 
seems to work fine for him I do not find further information from that error


  [1]: 
https://stackoverflow.com/questions/23027382/java-net-malformedurlexception-no-protocol-xml

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/bd695356-0707-42fd-8252-8ab4c5f7ab28n%40googlegroups.com.


how to get the last commiter in jenkins pipeline

2020-11-16 Thread jesus fernandez
I have a Jenkins pipeline setup that it works with Perforce as SCM I have 
been trying to find if it is possible to send a slack message(it is already 
connected to slack to send msgs to a channel on each build) / email to the 
person who commited in case the build fails, I have found information but 
all the information I find it is related to Git. Anyone knows where can I 
find some documentation or examples on how to do this?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b7492feb-0aaf-4376-a981-91eb63272953n%40googlegroups.com.


error indexing C++ .h files on sonarqube with jenkins

2020-11-13 Thread jesus fernandez
It is my first time using sonarqube. I am using 7.9.4 version with the 
community cxx plugin. 

I tried in a super simple project and it worked so I went for a bigger 
project but I keep getting this error everytime I try to build my pipeline 
```Language of file 'Source\age3\abilities.h' can not be decided as the 
file matches patterns of both sonar.lang.patterns.c++ : 
**/*.cxx,**/*.cpp,**/*.cc,**/*.c,**/*.h,**/*.hxx,**/*.hpp,**/*.hh,**/*.h 
and sonar.lang.patterns.c : **/*.c,**/*.h```

I have tried adding the suffixes to the sonar-project.properties as follow:
```
sonar.projectKey=Boston
sonar.projectName=Boston
sonar.dotnet.visualStudio.solution=Age3DE.sln
sonar.scm.disabled=true
sonar.language=c++
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=.cc,.cpp,.cxx,.c++,.hh,.hpp,.hxx,.h++,.ipp,.c,.h

sonar.sources=./Source
sonar.sourceEncoding=UTF-8
```

and also adding this parameters to my pipeline with -D as:
```
 stage('SonarQube analysis') {
steps{
script{
def scannerHome = tool 'SonarMSBuild'
withSonarQubeEnv('Sonar_Server') {
bat """

${scannerHome}\\sonar-scanner-4.4.0.2170\\bin\\sonar-scanner.bat -X 
-Dsonar.cpp.file.suffixes=.cc,.cpp,.cxx,.c++,.hh,.hpp,.hxx,.h++,.ipp,.c,.h 
-Dsonar.projectKey=Boston -Dsonar.projectName=Boston 
-Dsonar.sources=./Source -Dsonar.scm.disabled=true -Dsonar.language=c++ 
-Dsonar.sourceEncoding=UTF-8
"""
}
}
}
}
```

I have also addedh the .h extension on the sonarqune UI under 
administration -> Configuration -> C++ -> Source files suffixes, but none 
of them work

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7fcbb545-975b-4d72-89f8-f3f59cf1968an%40googlegroups.com.


Re: where do I have to set the sonar-project.properties file to make sonar work in Jenkins?

2020-11-12 Thread jesus fernandez
ile in current project
00:00:04.783  11:26:43.809 DEBUG: '[Deprecated] VB.NET Integration Tests 
Coverage Report Import' skipped because there is no related file in current 
project
00:00:04.783  11:26:43.809 DEBUG: 'VB.NET Unit Test Results Import' skipped 
because there is no related file in current project
00:00:04.783  11:26:43.810 DEBUG: 'Java CPD Block Indexer' skipped because 
there is no related file in current project
00:00:04.783  11:26:43.810 DEBUG: Sensors : Zero Coverage Sensor
00:00:04.783  11:26:43.810 INFO: Sensor Zero Coverage Sensor
00:00:04.783  11:26:43.810 INFO: Sensor Zero Coverage Sensor (done) | 
time=0ms
00:00:04.783  11:26:43.811 INFO: SCM Publisher is disabled
00:00:04.783  11:26:43.812 INFO: CPD Executor Calculating CPD for 0 files
00:00:04.783  11:26:43.812 INFO: CPD Executor CPD calculation finished 
(done) | time=0ms
00:00:04.783  11:26:43.865 INFO: Analysis report generated in 52ms, dir 
size=82 KB
00:00:04.783  11:26:43.876 INFO: Analysis report compressed in 11ms, zip 
size=10 KB
00:00:04.783  11:26:43.876 INFO: Analysis report generated in 
C:\Users\anton\.jenkins\workspace\Boston\.scannerwork\scanner-report
00:00:04.783  11:26:43.876 DEBUG: Upload report
00:00:04.783  11:26:43.904 DEBUG: POST 200 
http://localhost:9000/api/ce/submit?projectKey=Test=Test | 
time=27ms
00:00:04.783  11:26:43.905 INFO: Analysis report uploaded in 29ms
00:00:04.783  11:26:43.908 DEBUG: Report metadata written to 
C:\Users\anton\.jenkins\workspace\Boston\.scannerwork\report-task.txt
00:00:04.783  11:26:43.908 INFO: ANALYSIS SUCCESSFUL, you can browse 
http://localhost:9000/dashboard?id=Test
00:00:04.783  11:26:43.908 INFO: Note that you will be able to access the 
updated dashboard once the server has processed the submitted analysis 
report
00:00:04.783  11:26:43.908 INFO: More about the report processing at 
http://localhost:9000/api/ce/task?id=AXW7_kI9-biCFHpn-C-1
00:00:04.784  11:26:43.910 DEBUG: Post-jobs : Final report
00:00:04.784  11:26:43.910 INFO: Executing post-job 'Final report'
00:00:04.784  11:26:43.915 INFO: Analysis total time: 2.280 s
00:00:04.784  11:26:43.916 INFO: 

00:00:04.784  11:26:43.916 INFO: EXECUTION SUCCESS
00:00:04.784  11:26:43.916 INFO: 
--------
00:00:04.784  11:26:43.917 INFO: Total time: 3.517s
00:00:04.784  11:26:43.989 INFO: Final Memory: 21M/542M
00:00:04.784  11:26:43.989 INFO: 

El jueves, 12 de noviembre de 2020 a las 11:26:26 UTC+1, jesus fernandez 
escribió:

> Thanks both for answering, David I have tried both with "-D" with and 
> without spaces. Geoffroy I was running a 8++ version I just downloaded 7.9 
> but still the same. One question which might be silly (I had used 
> SonarQuebe ever before) does the pipeline needs to pull from a SCM for 
> sonarqube to test the code? I understood it is not necessary at the moment 
> I am just building a c++ project in local and then running the sonarqube 
> step. Is that correct?  
>
> El jueves, 12 de noviembre de 2020 a las 9:51:20 UTC+1, 
> geoffroy...@gmail.com escribió:
>
>> Hello
>>
>> i would recommend to remove extra-spaces for "-D" options, this is 
>> incorrect syntax, and also enable debug mode (-X).
>>
>> As you are providing information using the scanner option, maybe it is 
>> normal to see "Project root configuration file: NONE " log. Maybe setting 
>> sonar.projectBaseDir option could help...
>>
>> Also, sonar-cxx plugin (if this is the one you are trying to use) is not 
>> compatible with SonarQube 8.X: 
>> https://github.com/SonarOpenCommunity/sonar-cxx/wiki/SonarQube-compatibility-matrix
>>
>> Regards
>>
>> On Thu, 12 Nov 2020 at 01:00, David Karr  wrote:
>>
>>> I have never seen the "-D" command-line option used with a space between 
>>> the option and the provided value, and the documentation never shows that 
>>> example.
>>>
>>> On Wed, Nov 11, 2020 at 1:13 PM jesus fernandez  
>>> wrote:
>>>
>>>> and this is the log:
>>>> ```
>>>> *00:00:00.901* Injecting SonarQube environment variables using the 
>>>> configuration: SonarQube2 [Pipeline] { 
>>>> <http://localhost:8080/job/Boston/37/console#> [Pipeline] bat 
>>>> <http://localhost:8080/job/Boston/37/console#> 
>>>> *00:00:01.175* *00:00:01.175* 
>>>> C:\Users\anton\.jenkins\workspace\Boston>C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\sonar-scanner.bat
>>>>  
>>>> -D sonar.projectKey=Test -D sonar.projectName=Test -D sonar.sources=. -D 
>>>

Re: where do I have to set the sonar-project.properties file to make sonar work in Jenkins?

2020-11-12 Thread jesus fernandez
Thanks both for answering, David I have tried both with "-D" with and 
without spaces. Geoffroy I was running a 8++ version I just downloaded 7.9 
but still the same. One question which might be silly (I had used 
SonarQuebe ever before) does the pipeline needs to pull from a SCM for 
sonarqube to test the code? I understood it is not necessary at the moment 
I am just building a c++ project in local and then running the sonarqube 
step. Is that correct?  

El jueves, 12 de noviembre de 2020 a las 9:51:20 UTC+1, 
geoffroy...@gmail.com escribió:

> Hello
>
> i would recommend to remove extra-spaces for "-D" options, this is 
> incorrect syntax, and also enable debug mode (-X).
>
> As you are providing information using the scanner option, maybe it is 
> normal to see "Project root configuration file: NONE " log. Maybe setting 
> sonar.projectBaseDir option could help...
>
> Also, sonar-cxx plugin (if this is the one you are trying to use) is not 
> compatible with SonarQube 8.X: 
> https://github.com/SonarOpenCommunity/sonar-cxx/wiki/SonarQube-compatibility-matrix
>
> Regards
>
> On Thu, 12 Nov 2020 at 01:00, David Karr  wrote:
>
>> I have never seen the "-D" command-line option used with a space between 
>> the option and the provided value, and the documentation never shows that 
>> example.
>>
>> On Wed, Nov 11, 2020 at 1:13 PM jesus fernandez  
>> wrote:
>>
>>> and this is the log:
>>> ```
>>> *00:00:00.901* Injecting SonarQube environment variables using the 
>>> configuration: SonarQube2 [Pipeline] { 
>>> <http://localhost:8080/job/Boston/37/console#> [Pipeline] bat 
>>> <http://localhost:8080/job/Boston/37/console#> 
>>> *00:00:01.175* *00:00:01.175* 
>>> C:\Users\anton\.jenkins\workspace\Boston>C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\sonar-scanner.bat
>>>  
>>> -D sonar.projectKey=Test -D sonar.projectName=Test -D sonar.sources=. -D 
>>> sonar.scm.disabled=true -D sonar.language=c++ -D sonar.sourceEncoding=UTF-8 
>>>  *00:00:01.175* INFO: Scanner configuration file: 
>>> C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
>>> *00:00:01.175* INFO: Project root configuration file: NONE 
>>> *00:00:01.175* INFO: SonarScanner 4.4.0.2170 
>>> *00:00:01.175* INFO: Java 1.8.0_261 Oracle Corporation (64-bit) 
>>> *00:00:01.175* INFO: Windows 10 10.0 amd64 
>>> *00:00:02.090* INFO: User cache: 
>>> C:\WINDOWS\system32\config\systemprofile\.sonar\cache 
>>> *00:00:02.090* INFO: Scanner configuration file: 
>>> C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
>>>  
>>> *00:00:02.090* INFO: Project root configuration file: NONE 
>>> *00:00:02.090* INFO: Analyzing on SonarQube server 8.5.1 
>>> *00:00:02.090* INFO: Default locale: "es_ES", source code encoding: 
>>> "UTF-8" 
>>> *00:00:02.343* WARN: SonarScanner will require Java 11 to run starting 
>>> in SonarQube 8.x *00:00:02.343* INFO: Load global settings 
>>> *00:00:02.343* INFO: Load global settings (done) | time=42ms 
>>> *00:00:02.343* INFO: Server id: BF41A1F2-AXWnoupqHjnRwWgEnmvK 
>>> *00:00:02.343* INFO: User cache: 
>>> C:\WINDOWS\system32\config\systemprofile\.sonar\cache 
>>> *00:00:02.343* INFO: Load/download plugins 
>>> *00:00:02.343* INFO: Load plugins index 
>>> *00:00:02.343* INFO: Load plugins index (done) | time=26ms 
>>> *00:00:02.594* INFO: Load/download plugins (done) | time=50ms 
>>> *00:00:02.846* INFO: Process project properties 
>>> *00:00:02.846* INFO: Process project properties (done) | time=7ms 
>>> *00:00:02.846* INFO: Execute project builders 
>>> *00:00:02.846* INFO: Execute project builders (done) | time=1ms 
>>> *00:00:02.846* INFO: Project key: Test 
>>> *00:00:02.846* INFO: Base dir: C:\Users\anton\.jenkins\workspace\Boston 
>>> *00:00:02.846* INFO: Working dir: 
>>> C:\Users\anton\.jenkins\workspace\Boston\.scannerwork 
>>> *00:00:03.097* INFO: Load project settings for component key: 'Test' 
>>> *00:00:03.097* INFO: Load project settings for component key: 'Test' 
>>> (done) | time=9ms
>>> *00:00:03.097* INFO: Load quality profiles 
>>> *00:00:03.097* INFO: Load quality profiles (done) | time=38ms 
>>> *00:00:03.097* 

Re: where do I have to set the sonar-project.properties file to make sonar work in Jenkins?

2020-11-12 Thread Jesus Fernandez
Thanks both for answering, David I have tried both with "-D" with and 
without spaces. Geoffroy I was running a 8++ version I just downloaded 7.9 
but still the same. One question which might be silly (I had used 
SonarQuebe ever before) does the pipeline needs to pull from a SCM for 
sonarqube to test the code? I understood it is not necessary at the moment 
I am just building a c++ project in local and then running the sonarqube 
step. Is that correct?

On Thursday, November 12, 2020 at 9:51:20 AM UTC+1 geoffroy...@gmail.com 
wrote:

> Hello
>
> i would recommend to remove extra-spaces for "-D" options, this is 
> incorrect syntax, and also enable debug mode (-X).
>
> As you are providing information using the scanner option, maybe it is 
> normal to see "Project root configuration file: NONE " log. Maybe setting 
> sonar.projectBaseDir option could help...
>
> Also, sonar-cxx plugin (if this is the one you are trying to use) is not 
> compatible with SonarQube 8.X: 
> https://github.com/SonarOpenCommunity/sonar-cxx/wiki/SonarQube-compatibility-matrix
>
> Regards
>
> On Thu, 12 Nov 2020 at 01:00, David Karr  wrote:
>
>> I have never seen the "-D" command-line option used with a space between 
>> the option and the provided value, and the documentation never shows that 
>> example.
>>
>> On Wed, Nov 11, 2020 at 1:13 PM jesus fernandez  
>> wrote:
>>
>>> and this is the log:
>>> ```
>>> *00:00:00.901* Injecting SonarQube environment variables using the 
>>> configuration: SonarQube2 [Pipeline] { 
>>> <http://localhost:8080/job/Boston/37/console#> [Pipeline] bat 
>>> <http://localhost:8080/job/Boston/37/console#> 
>>> *00:00:01.175* *00:00:01.175* 
>>> C:\Users\anton\.jenkins\workspace\Boston>C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\sonar-scanner.bat
>>>  
>>> -D sonar.projectKey=Test -D sonar.projectName=Test -D sonar.sources=. -D 
>>> sonar.scm.disabled=true -D sonar.language=c++ -D sonar.sourceEncoding=UTF-8 
>>>  *00:00:01.175* INFO: Scanner configuration file: 
>>> C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
>>> *00:00:01.175* INFO: Project root configuration file: NONE 
>>> *00:00:01.175* INFO: SonarScanner 4.4.0.2170 
>>> *00:00:01.175* INFO: Java 1.8.0_261 Oracle Corporation (64-bit) 
>>> *00:00:01.175* INFO: Windows 10 10.0 amd64 
>>> *00:00:02.090* INFO: User cache: 
>>> C:\WINDOWS\system32\config\systemprofile\.sonar\cache 
>>> *00:00:02.090* INFO: Scanner configuration file: 
>>> C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
>>>  
>>> *00:00:02.090* INFO: Project root configuration file: NONE 
>>> *00:00:02.090* INFO: Analyzing on SonarQube server 8.5.1 
>>> *00:00:02.090* INFO: Default locale: "es_ES", source code encoding: 
>>> "UTF-8" 
>>> *00:00:02.343* WARN: SonarScanner will require Java 11 to run starting 
>>> in SonarQube 8.x *00:00:02.343* INFO: Load global settings 
>>> *00:00:02.343* INFO: Load global settings (done) | time=42ms 
>>> *00:00:02.343* INFO: Server id: BF41A1F2-AXWnoupqHjnRwWgEnmvK 
>>> *00:00:02.343* INFO: User cache: 
>>> C:\WINDOWS\system32\config\systemprofile\.sonar\cache 
>>> *00:00:02.343* INFO: Load/download plugins 
>>> *00:00:02.343* INFO: Load plugins index 
>>> *00:00:02.343* INFO: Load plugins index (done) | time=26ms 
>>> *00:00:02.594* INFO: Load/download plugins (done) | time=50ms 
>>> *00:00:02.846* INFO: Process project properties 
>>> *00:00:02.846* INFO: Process project properties (done) | time=7ms 
>>> *00:00:02.846* INFO: Execute project builders 
>>> *00:00:02.846* INFO: Execute project builders (done) | time=1ms 
>>> *00:00:02.846* INFO: Project key: Test 
>>> *00:00:02.846* INFO: Base dir: C:\Users\anton\.jenkins\workspace\Boston 
>>> *00:00:02.846* INFO: Working dir: 
>>> C:\Users\anton\.jenkins\workspace\Boston\.scannerwork 
>>> *00:00:03.097* INFO: Load project settings for component key: 'Test' 
>>> *00:00:03.097* INFO: Load project settings for component key: 'Test' 
>>> (done) | time=9ms
>>> *00:00:03.097* INFO: Load quality profiles 
>>> *00:00:03.097* INFO: Load quality profiles (done) | time=38ms 
>>> *00:00:03.097* INFO: Aut

Re: where do I have to set the sonar-project.properties file to make sonar work in Jenkins?

2020-11-11 Thread jesus fernandez
 *00:00:05.178* INFO: Note that you 
will be able to access the updated dashboard once the server has processed 
the submitted analysis report 
*00:00:05.178* INFO: More about the report processing at 
http://localhost:9000/api/ce/task?id=AXW4OGqF0bymGINu8Ui8 
*00:00:05.178* INFO: Executing post-job 'Final report'
*00:00:05.178* INFO: Turn debug info on to get more details (sonar-scanner 
-X -Dsonar.verbose=true ...). 
*00:00:05.178* INFO: Analysis total time: 2.676 s 
*00:00:05.178* INFO: 
 
*00:00:05.178* INFO: EXECUTION SUCCESS 
*00:00:05.178* INFO: 

*00:00:05.178* INFO: Total time: 4.015s 
*00:00:05.178* INFO: Final Memory: 24M/545M 
*00:00:05.178* INFO: 
  
```
But then on the SonarQube UI it says: "The main branch has no lines of 
code." even though on activity I can see the task has been executed each 
time I run the pipeline
El miércoles, 11 de noviembre de 2020 a las 22:09:21 UTC+1, jesus fernandez 
escribió:

> Thanks Geofrroy for your answer,
>
> I had posted the question in the sonarsource community with no answer 
> already. I am using the free version with the C++ plugin which works fine 
> in many tutorials and videos you can find online. This is my pipeline:
> ```
> pipeline
> {   
> agent any
> 
> options { timestamps () }
> stages{
> 
> stage('Build'){
> steps{
> retry(2){
> script {
> bat """
> "C:\\Program Files (x86)\\Microsoft Visual 
> Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe" 
> "C:\\Users\\anton\\source\\repos\\WindowsProject1\\WindowsProject1.sln"
> """
> } 
> }
> }
> }
> 
>   stage('SonarQube analysis') {
> steps{
> script{
> def scannerHome = tool 'Sonnar_scanner'
> withSonarQubeEnv('SonarQube2') {
> bat """
> 
> ${scannerHome}\\sonar-scanner-4.4.0.2170\\bin\\sonar-scanner.bat -D 
> sonar.projectKey=Test -D sonar.projectName=Test -D sonar.sources=. -D 
> sonar.scm.disabled=true -D sonar.language=c++ -D sonar.sourceEncoding=UTF-8
> """
> }
> }
> }
> }
> }
> }
>
> ```
>
> Thanks!
>
> El miércoles, 11 de noviembre de 2020 a las 20:45:45 UTC+1, 
> geoffroy...@gmail.com escribió:
>
>> Hello
>> you should probably ask here: https://community.sonarsource.com/ 
>> Are you using the paid version of SonarQube, to get C/C++ analysis 
>> feature?
>> Also, from experience, before running any new tool analysis from Jenkins, 
>> it is better to first run (and debug) it locally. Sonar scanner local 
>> analysis is quite easy to execute, it could help you troubleshoot your 
>> issue.
>> Last, please post your pipeline code so we can check you are properly 
>> running the analysis from the source folder actually containing the sonar 
>> properties file
>> Regards
>>
>> On Wednesday, 11 November 2020 at 17:29:54 UTC+1 jesusfern...@gmail.com 
>> wrote:
>>
>>> Hi David,
>>>
>>> Thanks for your answer but I get the same result when adding the 
>>> parameters with -D I get the "*00:00:01.529* *INFO: Project root 
>>> configuration file: NONE"  *message at the beginning of the log. I have 
>>> tried to create the helloworld simplest c++ project just to test, but I get 
>>> the same error, what am I missing?
>>> El martes, 10 de noviembre de 2020 a las 20:41:32 UTC+1, 
>>> davidmic...@gmail.com escribió:
>>>
>>>> I believe that the mistake that most people make with running the 
>>>> sonarqube scan from a CI build is TRYING to define a sonarqube properties 
>>>> file. It's best to simply provide all of the required options on the 
>>>> sonar-scanner command line, using "-D".
>>>>
>>>> On Tue, Nov 10, 2020 at 3:44 AM jesus fernandez  
>>>> wrote:
>>>>
>>>>> I am trying to learn the basics of sonarqube, I have set it up on my 
>>>>> jenkins pipeline (which uses MSBuild to compile the project) and the set 
>>>>> a 
>>>>> ste

Re: where do I have to set the sonar-project.properties file to make sonar work in Jenkins?

2020-11-11 Thread jesus fernandez
Thanks Geofrroy for your answer,

I had posted the question in the sonarsource community with no answer 
already. I am using the free version with the C++ plugin which works fine 
in many tutorials and videos you can find online. This is my pipeline:
```
pipeline
{   
agent any

options { timestamps () }
stages{

stage('Build'){
steps{
retry(2){
script {
bat """
"C:\\Program Files (x86)\\Microsoft Visual 
Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe" 
"C:\\Users\\anton\\source\\repos\\WindowsProject1\\WindowsProject1.sln"
"""
} 
}
}
}

  stage('SonarQube analysis') {
steps{
script{
def scannerHome = tool 'Sonnar_scanner'
withSonarQubeEnv('SonarQube2') {
bat """

${scannerHome}\\sonar-scanner-4.4.0.2170\\bin\\sonar-scanner.bat -D 
sonar.projectKey=Test -D sonar.projectName=Test -D sonar.sources=. -D 
sonar.scm.disabled=true -D sonar.language=c++ -D sonar.sourceEncoding=UTF-8
"""
}
}
}
}
}
}

```

Thanks!

El miércoles, 11 de noviembre de 2020 a las 20:45:45 UTC+1, 
geoffroy...@gmail.com escribió:

> Hello
> you should probably ask here: https://community.sonarsource.com/ 
> Are you using the paid version of SonarQube, to get C/C++ analysis feature?
> Also, from experience, before running any new tool analysis from Jenkins, 
> it is better to first run (and debug) it locally. Sonar scanner local 
> analysis is quite easy to execute, it could help you troubleshoot your 
> issue.
> Last, please post your pipeline code so we can check you are properly 
> running the analysis from the source folder actually containing the sonar 
> properties file
> Regards
>
> On Wednesday, 11 November 2020 at 17:29:54 UTC+1 jesusfern...@gmail.com 
> wrote:
>
>> Hi David,
>>
>> Thanks for your answer but I get the same result when adding the 
>> parameters with -D I get the "*00:00:01.529* *INFO: Project root 
>> configuration file: NONE"  *message at the beginning of the log. I have 
>> tried to create the helloworld simplest c++ project just to test, but I get 
>> the same error, what am I missing?
>> El martes, 10 de noviembre de 2020 a las 20:41:32 UTC+1, 
>> davidmic...@gmail.com escribió:
>>
>>> I believe that the mistake that most people make with running the 
>>> sonarqube scan from a CI build is TRYING to define a sonarqube properties 
>>> file. It's best to simply provide all of the required options on the 
>>> sonar-scanner command line, using "-D".
>>>
>>> On Tue, Nov 10, 2020 at 3:44 AM jesus fernandez  
>>> wrote:
>>>
>>>> I am trying to learn the basics of sonarqube, I have set it up on my 
>>>> jenkins pipeline (which uses MSBuild to compile the project) and the set a 
>>>> step to execute SonarQube but after reading and watching a few tutorials 
>>>> and the documentation itself I think I got a bit lost as when my pipeline 
>>>> finishes executing I go to my SonarQube server and I my project says 
>>>> ```The 
>>>> main branch has no lines of code.```. I get the following log when running 
>>>> the sonarqube step on my jenkins:
>>>> ```
>>>> 00:10:43.369  Injecting SonarQube environment variables using the 
>>>> configuration: SonarQube
>>>> [Pipeline] {
>>>> [Pipeline] bat
>>>> 00:10:43.653  
>>>> 00:10:43.653  
>>>> C:\Users\anton\.jenkins\workspace\Boston>C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\sonar-scanner.bat
>>>>   
>>>>  
>>>> 00:10:43.653  INFO: Scanner configuration file: 
>>>> C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
>>>> 00:10:43.653  INFO: Project root configuration file: NONE
>>>> 00:10:43.653  INFO: SonarScanner 4.4.0.2170
>>>> 00:10:43.653  INFO: Java 1.8.0_261 Oracle Corporation (64-bit)
>>>> 00:10:43.653  INFO: Windows 10 10.0 amd64
>>>> 00:10:44.230  INFO: User cache: 
>>>> C:\WINDOWS\system32\config\systemprofile\.sonar\cache
>>>> 00:10:44.230  INFO: Scanner configuration 

Re: where do I have to set the sonar-project.properties file to make sonar work in Jenkins?

2020-11-11 Thread jesus fernandez
Hi David,

Thanks for your answer but I get the same result when adding the parameters 
with -D I get the "*00:00:01.529* *INFO: Project root configuration file: 
NONE"  *message at the beginning of the log. I have tried to create the 
helloworld simplest c++ project just to test, but I get the same error, 
what am I missing?
El martes, 10 de noviembre de 2020 a las 20:41:32 UTC+1, 
davidmic...@gmail.com escribió:

> I believe that the mistake that most people make with running the 
> sonarqube scan from a CI build is TRYING to define a sonarqube properties 
> file. It's best to simply provide all of the required options on the 
> sonar-scanner command line, using "-D".
>
> On Tue, Nov 10, 2020 at 3:44 AM jesus fernandez  
> wrote:
>
>> I am trying to learn the basics of sonarqube, I have set it up on my 
>> jenkins pipeline (which uses MSBuild to compile the project) and the set a 
>> step to execute SonarQube but after reading and watching a few tutorials 
>> and the documentation itself I think I got a bit lost as when my pipeline 
>> finishes executing I go to my SonarQube server and I my project says ```The 
>> main branch has no lines of code.```. I get the following log when running 
>> the sonarqube step on my jenkins:
>> ```
>> 00:10:43.369  Injecting SonarQube environment variables using the 
>> configuration: SonarQube
>> [Pipeline] {
>> [Pipeline] bat
>> 00:10:43.653  
>> 00:10:43.653  
>> C:\Users\anton\.jenkins\workspace\Boston>C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\sonar-scanner.bat
>>   
>>  
>> 00:10:43.653  INFO: Scanner configuration file: 
>> C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
>> 00:10:43.653  INFO: Project root configuration file: NONE
>> 00:10:43.653  INFO: SonarScanner 4.4.0.2170
>> 00:10:43.653  INFO: Java 1.8.0_261 Oracle Corporation (64-bit)
>> 00:10:43.653  INFO: Windows 10 10.0 amd64
>> 00:10:44.230  INFO: User cache: 
>> C:\WINDOWS\system32\config\systemprofile\.sonar\cache
>> 00:10:44.230  INFO: Scanner configuration file: 
>> C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
>> 00:10:44.230  INFO: Project root configuration file: NONE
>> 00:10:44.230  INFO: Analyzing on SonarQube server 8.5.1
>> 00:10:44.230  INFO: Default locale: "es_ES", source code encoding: "UTF-8"
>> 00:10:44.783  WARN: SonarScanner will require Java 11 to run starting in 
>> SonarQube 8.x
>> 00:10:44.784  INFO: Load global settings
>> 00:10:44.784  INFO: Load global settings (done) | time=40ms
>> 00:10:44.784  INFO: Server id: BF41A1F2-AXWnoupqHjnRwWgEnmvK
>> 00:10:44.784  INFO: User cache: 
>> C:\WINDOWS\system32\config\systemprofile\.sonar\cache
>> 00:10:44.784  INFO: Load/download plugins
>> 00:10:44.784  INFO: Load plugins index
>> 00:10:44.784  INFO: Load plugins index (done) | time=26ms
>> 00:10:44.784  INFO: Load/download plugins (done) | time=48ms
>> 00:10:45.037  INFO: Process project properties
>> 00:10:45.037  INFO: Process project properties (done) | time=6ms
>> 00:10:45.037  INFO: Execute project builders
>> 00:10:45.037  INFO: Execute project builders (done) | time=1ms
>> 00:10:45.037  INFO: Project key: Boston
>> 00:10:45.037  INFO: Base dir: C:\Users\anton\.jenkins\workspace\Boston
>> 00:10:45.037  INFO: Working dir: 
>> C:\Users\anton\.jenkins\workspace\Boston\.scannerwork
>> 00:10:45.301  INFO: Load project settings for component key: 'Boston'
>> 00:10:45.301  INFO: Load project settings for component key: 'Boston' 
>> (done) | time=10ms
>> 00:10:45.301  INFO: Load quality profiles
>> 00:10:45.301  INFO: Load quality profiles (done) | time=27ms
>> 00:10:45.301  INFO: Auto-configuring with CI 'Jenkins'
>> 00:10:45.301  INFO: Load active rules
>> 00:10:46.241  INFO: Load active rules (done) | time=787ms
>> 00:10:46.241  INFO: Indexing files...
>> 00:10:46.241  INFO: Project configuration:
>> 00:10:46.241  INFO: 0 files indexed
>> 00:10:46.241  INFO: - Run sensors on module Boston
>> 00:10:46.241  INFO: Load metrics repository
>> 00:10:46.241  INFO: Load metrics repository (done) | time=12ms
>> 00:10:46.807  INFO: Sensor CSS Rules [cssfamily]
>> 00:10:46.807  INFO: No CSS, PHP, HTML or VueJS files are found in the 
>> project. CSS analysis is skipped.
>> 00:10:46.807  INFO: Sensor CSS Rules [cssfamily] (

where do I have to set the sonar-project.properties file to make sonar work in Jenkins?

2020-11-10 Thread jesus fernandez
I am trying to learn the basics of sonarqube, I have set it up on my 
jenkins pipeline (which uses MSBuild to compile the project) and the set a 
step to execute SonarQube but after reading and watching a few tutorials 
and the documentation itself I think I got a bit lost as when my pipeline 
finishes executing I go to my SonarQube server and I my project says ```The 
main branch has no lines of code.```. I get the following log when running 
the sonarqube step on my jenkins:
```
00:10:43.369  Injecting SonarQube environment variables using the 
configuration: SonarQube
[Pipeline] {
[Pipeline] bat
00:10:43.653  
00:10:43.653  
C:\Users\anton\.jenkins\workspace\Boston>C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\sonar-scanner.bat
  
 
00:10:43.653  INFO: Scanner configuration file: 
C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
00:10:43.653  INFO: Project root configuration file: NONE
00:10:43.653  INFO: SonarScanner 4.4.0.2170
00:10:43.653  INFO: Java 1.8.0_261 Oracle Corporation (64-bit)
00:10:43.653  INFO: Windows 10 10.0 amd64
00:10:44.230  INFO: User cache: 
C:\WINDOWS\system32\config\systemprofile\.sonar\cache
00:10:44.230  INFO: Scanner configuration file: 
C:\Users\anton\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Sonnar_scanner\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
00:10:44.230  INFO: Project root configuration file: NONE
00:10:44.230  INFO: Analyzing on SonarQube server 8.5.1
00:10:44.230  INFO: Default locale: "es_ES", source code encoding: "UTF-8"
00:10:44.783  WARN: SonarScanner will require Java 11 to run starting in 
SonarQube 8.x
00:10:44.784  INFO: Load global settings
00:10:44.784  INFO: Load global settings (done) | time=40ms
00:10:44.784  INFO: Server id: BF41A1F2-AXWnoupqHjnRwWgEnmvK
00:10:44.784  INFO: User cache: 
C:\WINDOWS\system32\config\systemprofile\.sonar\cache
00:10:44.784  INFO: Load/download plugins
00:10:44.784  INFO: Load plugins index
00:10:44.784  INFO: Load plugins index (done) | time=26ms
00:10:44.784  INFO: Load/download plugins (done) | time=48ms
00:10:45.037  INFO: Process project properties
00:10:45.037  INFO: Process project properties (done) | time=6ms
00:10:45.037  INFO: Execute project builders
00:10:45.037  INFO: Execute project builders (done) | time=1ms
00:10:45.037  INFO: Project key: Boston
00:10:45.037  INFO: Base dir: C:\Users\anton\.jenkins\workspace\Boston
00:10:45.037  INFO: Working dir: 
C:\Users\anton\.jenkins\workspace\Boston\.scannerwork
00:10:45.301  INFO: Load project settings for component key: 'Boston'
00:10:45.301  INFO: Load project settings for component key: 'Boston' 
(done) | time=10ms
00:10:45.301  INFO: Load quality profiles
00:10:45.301  INFO: Load quality profiles (done) | time=27ms
00:10:45.301  INFO: Auto-configuring with CI 'Jenkins'
00:10:45.301  INFO: Load active rules
00:10:46.241  INFO: Load active rules (done) | time=787ms
00:10:46.241  INFO: Indexing files...
00:10:46.241  INFO: Project configuration:
00:10:46.241  INFO: 0 files indexed
00:10:46.241  INFO: - Run sensors on module Boston
00:10:46.241  INFO: Load metrics repository
00:10:46.241  INFO: Load metrics repository (done) | time=12ms
00:10:46.807  INFO: Sensor CSS Rules [cssfamily]
00:10:46.807  INFO: No CSS, PHP, HTML or VueJS files are found in the 
project. CSS analysis is skipped.
00:10:46.807  INFO: Sensor CSS Rules [cssfamily] (done) | time=1ms
00:10:46.807  INFO: Sensor JaCoCo XML Report Importer [jacoco]
00:10:46.807  INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. 
Using default locations: 
target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
00:10:46.807  INFO: No report imported, no coverage information will be 
imported by JaCoCo XML Report Importer
00:10:46.807  INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | 
time=1ms
00:10:46.807  INFO: Sensor C# Properties [csharp]
00:10:46.807  INFO: Sensor C# Properties [csharp] (done) | time=1ms
00:10:46.807  INFO: Sensor JavaXmlSensor [java]
00:10:46.807  INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
00:10:46.807  INFO: Sensor VB.NET Properties [vbnet]
00:10:46.807  INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
00:10:46.807  INFO: - Run sensors on project
00:10:46.807  INFO: Sensor Zero Coverage Sensor
00:10:46.807  INFO: Sensor Zero Coverage Sensor (done) | time=0ms
00:10:46.807  INFO: SCM Publisher is disabled
00:10:46.807  INFO: CPD Executor Calculating CPD for 0 files
00:10:46.807  INFO: CPD Executor CPD calculation finished (done) | time=0ms
00:10:46.807  INFO: Analysis report generated in 48ms, dir size=82 KB
00:10:46.807  INFO: Analysis report compressed in 10ms, zip size=10 KB
00:10:47.060  INFO: Analysis report uploaded in 26ms
00:10:47.060  INFO: ANALYSIS 

Re: how to add a configuration parameter with spaces on Jenkins

2020-11-10 Thread jesus fernandez
that worked! thanks!

El viernes, 6 de noviembre de 2020 a las 15:55:26 UTC+1, 
victormar...@gmail.com escribió:

> Did you try with escaped double quotes?  Something like:
>
>
>- bat "\"${msbuild}\" AoC/Source/project-GRDK.sln /t:Rebuild 
>/p:configuration=\"Release Steam D3D11\" " 
>
>
> You can also use the multilne approach to avoid the escape of double 
> quotes:
>
>
>- bat """ "${msbuild}" AoC/Source/project-GRDK.sln /t:Rebuild 
>/p:configuration="Release Steam D3D11" """ 
>
>
>
> On Friday, 6 November 2020 at 14:06:47 UTC jfern...@forgottenempires.net 
> wrote:
>
>> I have a pipeline which builds a C++ project for that I am using MSBuild, 
>> untill now we were using the "Final" configuration parameter, but now I 
>> need to switch it to "Release Steam D3D11", when I try to do that I get an 
>> error on Jenkins when building the project I guess it is because of the 
>> spaces, how can I make Jenkins to take this parameter? this is what I have 
>> tried:
>>
>> ```
>> stage('Build'){
>> steps{
>> script {
>> def msbuild = tool name: 'MSBuild', type: 
>> 'hudson.plugins.msbuild.MsBuildInstallation'
>> bat "\"${msbuild}\" AoC/Source/project-GRDK.sln 
>> /t:Rebuild /p:configuration=Release Steam D3D11" 
>> } 
>> }
>> }
>> ```
>>
>> I have also tried adding ' ' to the configuration name such as : 
>> ```
>> bat "\"${msbuild}\" AoC/Source/project-GRDK.sln /t:Rebuild 
>> /p:configuration='Release Steam D3D11'" 
>> ```
>> but it does not work neither
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/878175da-9102-4fa8-9927-c6aee49b061cn%40googlegroups.com.


how to add a configuration parameter with spaces on Jenkins

2020-11-06 Thread Jesus Fernandez
I have a pipeline which builds a C++ project for that I am using MSBuild, 
untill now we were using the "Final" configuration parameter, but now I 
need to switch it to "Release Steam D3D11", when I try to do that I get an 
error on Jenkins when building the project I guess it is because of the 
spaces, how can I make Jenkins to take this parameter? this is what I have 
tried:

```
stage('Build'){
steps{
script {
def msbuild = tool name: 'MSBuild', type: 
'hudson.plugins.msbuild.MsBuildInstallation'
bat "\"${msbuild}\" AoC/Source/project-GRDK.sln 
/t:Rebuild /p:configuration=Release Steam D3D11" 
} 
}
}
```

I have also tried adding ' ' to the configuration name such as : 
```
bat "\"${msbuild}\" AoC/Source/project-GRDK.sln /t:Rebuild 
/p:configuration='Release Steam D3D11'" 
```
but it does not work neither

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2aa3d69f-c5ff-4dd2-9bab-2d1c8a9a5113n%40googlegroups.com.


Re: can I run a stage at a certain time within a pipeline

2020-11-06 Thread jesus fernandez
Gracias Victor!

El viernes, 30 de octubre de 2020 a las 19:48:15 UTC+1, 
victormar...@gmail.com escribió:

> triggeredBy within the stage context should help you: 
> https://www.jenkins.io/doc/book/pipeline/syntax/#when
>
> pipeline {
>...
>triggers {
>  cron 'H H22 * * 1-5'
>}
>stages {
> ...
> stage('deploy') {
>when { triggeredBy 'TimerTrigger' }
>...
> }
> }
> }
> On Saturday, 26 September 2020 at 10:55:14 UTC+1 jesusfern...@gmail.com 
> wrote:
>
>> I have a declarative pipeline with 3 stages and it is using poll SCM 
>> every 10 minutes (checkout, build and deploy), but I need the last step 
>> (deploy) to be executed just once everyday (i.e. 22 o´clock)  so it keeps 
>> checking out and building everytime a change is submitted but it only 
>> deploys once a day. I have tried to use triggers cron directive within the 
>> stage but it does not work. I have thought to use the when directive but as 
>> I am new to groove I do not see how to tell jenkins "when time is 22 
>> o´clock"
>>
>> Thanks
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/320eeae1-a6be-41e3-bea7-1b5854745428n%40googlegroups.com.


Re: why my pipeline creates different workspaces?

2020-11-06 Thread jesus fernandez

Gracias por aclararlo ahora tiene sentido :)
El viernes, 30 de octubre de 2020 a las 19:39:40 UTC+1, 
victormar...@gmail.com escribió:

> Directories with an ampersand (like @tmp, @script, @libs, @2) are 
> specifically created by the pipeline internals, each one got a different 
> context. The ones with number are most likely related to a concurrent build 
> running while other previous build is still running, to avoid clashing with 
> accessing the same workspace
>
> On Thursday, 8 October 2020 at 09:50:26 UTC+1 jesusfern...@gmail.com 
> wrote:
>
>> I am quite new to Jenkins. I managed to create a simple pipeline to pull 
>> from perforce and build the project every commit, but I find sometimes it 
>> creates a different workspace such as project@2, project@tmp, project@tmp@2 
>> and so on... why does this happen I have even set the customworkspace. 
>> Sorry if this is an obvious question. Here is my pipeline: 
>>
>>
>> pipeline 
>> {   
>> agent {
>> node {
>> label 'master'
>> customWorkspace 'C:/Users/User/.jenkins/workspace/Project'
>> }
>> }
>> options { timestamps () }
>> 
>> stages{
>> stage('Get latest'){
>> steps{
>> p4sync charset: 'none', credential: 'somecredentials', 
>> populate: syncOnly(force: false, have: true, modtime: 
>> false, 
>> parallel: [enable: false, minbytes: '1024', minfiles: 
>> '1', threads: '4'], 
>> pin: '', quiet: true, revert: false), 
>> source: streamSource('//Project/main')   
>> }
>> }
>> 
>> stage('Build'){
>> steps{
>> script {
>> def msbuild = tool name: 'MSBuild', type: 
>> 'hudson.plugins.msbuild.MsBuildInstallation'
>> bat "\"${msbuild}\" Project/Source/age2-GRDK.sln 
>> /t:Rebuild" 
>> } 
>> }
>> }
>> }
>> 
>> post{
>> changed{
>> mail to: 'somemail',
>> subject: "Status of: ${currentBuild.fullDisplayName}",
>> body: "${env.JOB_NAME} has result ${currentBuild.result}"
>> }
>> }
>>
>> }
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5b498ef0-198c-4565-85e0-a0035608bdfcn%40googlegroups.com.


How to add a configuration parameter with spaces on Jenkins

2020-11-06 Thread jesus fernandez
I have a pipeline which builds a C++ project for that I am using MSBuild, 
untill now we were using the "Final" configuration parameter, but now I 
need to switch it to "Release Steam D3D11", when I try to do that I get an 
error on Jenkins when building the project I guess it is because of the 
spaces, how can I make Jenkins to take this parameter? this is what I have 
tried:

```
stage('Build'){
steps{
script {
def msbuild = tool name: 'MSBuild', type: 
'hudson.plugins.msbuild.MsBuildInstallation'
bat "\"${msbuild}\" AoC/Source/project-GRDK.sln 
/t:Rebuild /p:configuration=Release Steam D3D11" 
} 
}
}
```

I have also tried adding ' ' to the configuration name such as : 
```
bat "\"${msbuild}\" AoC/Source/project-GRDK.sln /t:Rebuild 
/p:configuration='Release Steam D3D11'" 
```
but it does not work neither as I get this error:
```00:00:01.407  MSBUILD : error MSB1008: Only one project can be specif

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/459f5355-2e3f-4925-882e-c297d4f8c7d0n%40googlegroups.com.


How to run a visual studio CMD command in a pipeline?

2020-10-26 Thread jesus fernandez
I need to run a elevated x64 Native Tools Command Prompt fro VS 2019 
command ("vcperf /start session") within my pipeline. I have tried 
different ways but I cannot make it work. This is what I tried last: 
pipeline {
agent any

stages {
stage('test') {
steps {
script{
bat '"C:/ProgramData/Microsoft/Windows/Start 
Menu/Programs/Visual Studio 2019/Visual Studio Tools/VC/x64 Native Tools 
Command Prompt for VS 2019.lnk" -vcperf /start session'

}
}
}
}
}

but I get this output:
*12:44:43* 
C:\Users\User\.jenkins\workspace\test>"C:/ProgramData/Microsoft/Windows/Start 
Menu/Programs/Visual Studio 2019/Visual Studio Tools/VC/x64 Native Tools 
Command Prompt for VS 2019.lnk" vcvarsall.bat x86_amd64 
*12:44:43* [ERROR:vcvarsall.bat] Invalid argument found : vcvarsall.bat 
*12:44:43* [ERROR:vcvarsall.bat] Error in script usage. The correct usage 
is: 
*12:44:43* Syntax: 
*12:44:43* vcvarsall.bat [arch] [platform_type] [winsdk_version] 
[-vcvars_ver=vc_version] [-vcvars_spectre_libs=spectre_mode] 
*12:44:43* where : 
*12:44:43* [arch]: x86 | amd64 | x86_amd64 | x86_arm | x86_arm64 | 
amd64_x86 | amd64_arm | amd64_arm64 
*12:44:43* [platform_type]: {empty} | store | uwp 
*12:44:43* [winsdk_version] : full Windows 10 SDK number (e.g. 
10.0.10240.0) or "8.1" to use the Windows 8.1 SDK. 
*12:44:43* [vc_version] : {none} for latest installed VC++ compiler toolset 
| 
*12:44:43* "14.0" for VC++ 2015 Compiler Toolset | 
*1**2:44:43* "14.xx" for the latest 14.xx.y toolset installed (e.g. 
"14.11") | 
*12:44:43* "14.xx.y" for a specific full version number (e.g. 
"14.11.25503") 
*12:44:43* [spectre_mode] : {none} for libraries without spectre 
mitigations | 
*12:44:43* "spectre" for libraries with spectre mitigations 
*12:44:43* The store parameter sets environment variables to support 
Universal Windows Platform application 
*12:44:43* development and is an alias for 'uwp'. 
*12:44:43* For example: 
*12:44:43* vcvarsall.bat x86_amd64 
*12:44:43* vcvarsall.bat x86_amd64 10.0.10240.0 
*12:44:43* vcvarsall.bat x86_arm uwp 10.0.10240.0 
*12:44:43* vcvarsall.bat x86_arm onecore 10.0.10240.0 -vcvars_ver=14.0 
*12:44:43* vcvarsall.bat x64 8.1 
*12:44:43* vcvarsall.bat x64 store 8.1  

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e6d5397e-076d-406e-8c24-fa23a801a644n%40googlegroups.com.


can I run a stage at a certain time within a pipeline

2020-09-26 Thread jesus fernandez
I have a declarative pipeline with 3 stages and it is using poll SCM every 
10 minutes (checkout, build and deploy), but I need the last step (deploy) 
to be executed just once everyday (i.e. 22 o´clock)  so it keeps checking 
out and building everytime a change is submitted but it only deploys once a 
day. I have tried to use triggers cron directive within the stage but it 
does not work. I have thought to use the when directive but as I am new to 
groove I do not see how to tell jenkins "when time is 22 o´clock"

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/eeebcfd4-e1c9-4c8b-918d-05be60e26c68n%40googlegroups.com.


Re: How to reuse an existing workspace?

2020-09-24 Thread jesus fernandez
Thanks for answering so quickly, I saw this but I got confused as I do not 
use any node I just declared agent any and then the stages, I guess I could 
do it like this? 
pipeline 
{   
agent {
node {
label 'master'
customWorkspace '/MyExistingPath'
}
}
options { timestamps () }
stages{

Thanks
El jueves, 24 de septiembre de 2020 a las 16:44:23 UTC+2, Gianluca escribió:

> I think you can use the "customWorkspace" option.
> https://www.jenkins.io/doc/book/pipeline/syntax/
>
> I use the declarative and scripted pipelines, so I don't know if there is 
> that option in freestyle too.
>
> Cheers,
> Gianluca.
>
>
> Il giorno gio 24 set 2020 alle ore 15:33 jesus fernandez <
> jesusfern...@gmail.com> ha scritto:
>
>> I am quite new to Jenkins, I have been learning on my own, I have a 
>> working freestyle project that I want to convert to pipeline now, I have 
>> the script (at least I think) but I do not know what to add to make it use 
>> the existing workspace from the freestyle job so when pulling from the SCM 
>> does not have to download the whole project again as it is 150gb. I have 
>> look into the declarative pipeline documentation what I have not found 
>> anything on this regard 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/2b593d9a-b949-4b81-a0a7-4b3272a01c60n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/2b593d9a-b949-4b81-a0a7-4b3272a01c60n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/43103af6-3747-4db0-a4c6-c6c9915cbfdan%40googlegroups.com.


How to reuse an existing workspace?

2020-09-24 Thread jesus fernandez
I am quite new to Jenkins, I have been learning on my own, I have a working 
freestyle project that I want to convert to pipeline now, I have the script 
(at least I think) but I do not know what to add to make it use the 
existing workspace from the freestyle job so when pulling from the SCM does 
not have to download the whole project again as it is 150gb. I have look 
into the declarative pipeline documentation what I have not found anything 
on this regard

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2b593d9a-b949-4b81-a0a7-4b3272a01c60n%40googlegroups.com.


Re: how to execute a bash script in a jenkins declarative pipeline

2020-09-24 Thread jesus fernandez
but what you suggested worked! probaly I need to improve my batch scripting 
knowledge as it is none at the moment. THANKS A LOT! 
El jueves, 24 de septiembre de 2020 a las 16:19:09 UTC+2, jesus fernandez 
escribió:

> I also tried with call  but I get this error:
> ```
> *16:18:43* C:\Users\User\.jenkins\workspace\pipeline_test>call 
> C:/Users/User/.jenkins/workspace/Age_2_DE/Steam Build 
> Scripts/scripts/build_dev.bat *16:18:43* 
> 'C:/Users/User/.jenkins/workspace/Age_2_DE/Steam' is not recognized as an 
> internal or external command, *16:18:43* operable program or batch file.  
> ```
>
> El jueves, 24 de septiembre de 2020 a las 16:07:28 UTC+2, Jérôme Godbout 
> escribió:
>
>> Hi,
>>
>> make sure to escape the path if it has spaces:
>>
>> bat('start “C:/Users/User/.jenkins/workspace/Project/Steam 
>> Build Scripts/scripts/build_dev.bat”');
>>
>>  
>>
>> Why do you need the start? Is the command return before completion or 
>> something?
>>
>>  
>>
>>  
>>
>> *From:* jenkins...@googlegroups.com  *On 
>> Behalf Of *jesus fernandez
>> *Sent:* September 24, 2020 8:24 AM
>> *To:* Jenkins Users 
>> *Subject:* how to execute a bash script in a jenkins declarative pipeline
>>
>>  
>>
>> I have started recently using Jenkins in windows 10. I have a freestyle 
>> job that sync from the SCM, build a C++ solution and then it runs a batch 
>> script to upload to steam. I am trying to convert it to pipeline as I 
>> realized reading the documentation how much more powerful it is. My problem 
>> is that on the step to run the .bat file it gets stuck forever, this is the 
>> step:
>>
>> ```
>>
>> ...
>>
>> Stage('batch script'){
>>
>> steps{
>>
>> bat 'start C:/Users/User/.jenkins/workspace/Project/Steam 
>> Build 
>>
>> Scripts/scripts/build_dev.bat'
>>
>> }
>>
>> }
>>
>> ...
>>
>> ```
>>
>>  
>>
>> and this is the simple .bat file:
>>
>> ```
>>
>> "C:\Users\User\.jenkins\workspace\Project\Steam Build 
>> Scripts\builder\steamcmd.exe" +login "someUser" "somePassword" 
>> +run_app_build "C:\Users\User\.jenkins\workspace\Project\Steam Build 
>> Scripts\scripts\app-build-813780-dev.vdf" +quit
>>
>>  
>>
>> ```
>>
>>  
>>
>> running the same file from the freestyle job works fine like this:
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/e9a2b099-812c-4cb3-a459-f874e455n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/e9a2b099-812c-4cb3-a459-f874e455n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f8b508ad-2d67-49e3-aab7-0451c525cb4en%40googlegroups.com.


Re: how to execute a bash script in a jenkins declarative pipeline

2020-09-24 Thread jesus fernandez
I also tried with call  but I get this error:
```
*16:18:43* C:\Users\User\.jenkins\workspace\pipeline_test>call 
C:/Users/User/.jenkins/workspace/Age_2_DE/Steam Build 
Scripts/scripts/build_dev.bat *16:18:43* 
'C:/Users/User/.jenkins/workspace/Age_2_DE/Steam' is not recognized as an 
internal or external command, *16:18:43* operable program or batch file.  
```

El jueves, 24 de septiembre de 2020 a las 16:07:28 UTC+2, Jérôme Godbout 
escribió:

> Hi,
>
> make sure to escape the path if it has spaces:
>
> bat('start “C:/Users/User/.jenkins/workspace/Project/Steam 
> Build Scripts/scripts/build_dev.bat”');
>
>  
>
> Why do you need the start? Is the command return before completion or 
> something?
>
>  
>
>  
>
> *From:* jenkins...@googlegroups.com  *On 
> Behalf Of *jesus fernandez
> *Sent:* September 24, 2020 8:24 AM
> *To:* Jenkins Users 
> *Subject:* how to execute a bash script in a jenkins declarative pipeline
>
>  
>
> I have started recently using Jenkins in windows 10. I have a freestyle 
> job that sync from the SCM, build a C++ solution and then it runs a batch 
> script to upload to steam. I am trying to convert it to pipeline as I 
> realized reading the documentation how much more powerful it is. My problem 
> is that on the step to run the .bat file it gets stuck forever, this is the 
> step:
>
> ```
>
> ...
>
> Stage('batch script'){
>
> steps{
>
> bat 'start C:/Users/User/.jenkins/workspace/Project/Steam 
> Build 
>
> Scripts/scripts/build_dev.bat'
>
> }
>
> }
>
> ...
>
> ```
>
>  
>
> and this is the simple .bat file:
>
> ```
>
> "C:\Users\User\.jenkins\workspace\Project\Steam Build 
> Scripts\builder\steamcmd.exe" +login "someUser" "somePassword" 
> +run_app_build "C:\Users\User\.jenkins\workspace\Project\Steam Build 
> Scripts\scripts\app-build-813780-dev.vdf" +quit
>
>  
>
> ```
>
>  
>
> running the same file from the freestyle job works fine like this:
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/e9a2b099-812c-4cb3-a459-f874e455n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/e9a2b099-812c-4cb3-a459-f874e455n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c8fe5bae-54a6-4512-aa09-c2846b0c59bcn%40googlegroups.com.


how to execute a bash script in a jenkins declarative pipeline

2020-09-24 Thread jesus fernandez
I have started recently using Jenkins in windows 10. I have a freestyle job 
that sync from the SCM, build a C++ solution and then it runs a batch 
script to upload to steam. I am trying to convert it to pipeline as I 
realized reading the documentation how much more powerful it is. My problem 
is that on the step to run the .bat file it gets stuck forever, this is the 
step:
```
...
Stage('batch script'){
steps{
bat 'start C:/Users/User/.jenkins/workspace/Project/Steam 
Build 
Scripts/scripts/build_dev.bat'
}
}
...
```

and this is the simple .bat file:
```
"C:\Users\User\.jenkins\workspace\Project\Steam Build 
Scripts\builder\steamcmd.exe" +login "someUser" "somePassword" 
+run_app_build "C:\Users\User\.jenkins\workspace\Project\Steam Build 
Scripts\scripts\app-build-813780-dev.vdf" +quit

```

running the same file from the freestyle job works fine like this:[image: 
10IC9 (1).png]

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e9a2b099-812c-4cb3-a459-f874e455n%40googlegroups.com.