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 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-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
  
 
 .



>>> -- 
>>> 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 t

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

2021-04-14 Thread Ullrich Hafner
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 
 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-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
  
 .
>>> 
>>> 
>>> -- 
>>> 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

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 )
>>> 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-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
>>> 
>>> .
>>>
>>>
>>>
>> --
>> 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
>> 
>> .
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups

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

2021-04-14 Thread Ullrich Hafner
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 
>>> 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-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
>>>  
>>> .
>> 
>> 
>> -- 
>> 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
>>  
>> .
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe fr

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 )
>> 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-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
>>  
>> 
>> .
>>
>>
>>
> -- 
> 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
>  
> 
> .
>
>
>

-- 
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 Ullrich Hafner
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
>>  )
>> 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-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
>>  
>> .
> 
> 
> -- 
> 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
>  
> .

-- 
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/AB50-0B55-4A65-9095-CB657D802B4F%40gmail.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 )
> 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-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
>  
> 
> .
>
>
>

-- 
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.


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

2021-04-11 Thread Ullrich Hafner
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
>  )
> 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
>  
> .

-- 
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/E399BE39-02DE-44AC-9851-7BC0CA0A9456%40gmail.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.