Re: Override Label parameter in Freestyle job

2021-04-19 Thread David Drum
The Groovy Label Assignment plugin 
 does what I want.

On Friday, April 16, 2021 at 8:50:43 PM UTC-5 David Drum wrote:

> Thanks; that is the exact plugin whose Label parameter value I am trying 
> to override and have Jenkins use the updated value to determine node 
> selection. I can update the value and have it propagate to the build, but 
> Jenkins still picks a node from the original value.
>
> On Friday, April 16, 2021 at 5:41:53 PM UTC-5 Mark Waite wrote:
>
>> You might investigate the Node and Label Parameters plugin 
>> .  I don't know that it 
>> allows Groovy script evaluation to select the label or node, but it does 
>> have many options for node and label usage with Freestyle jobs.
>>
>> On Friday, April 16, 2021 at 4:35:17 PM UTC-6 david...@sciplay.com wrote:
>>
>>> Hello, I am at wit's end trying to make Jenkins run a freestyle job 
>>> build on a node based on a Label parameter I set using a Groovy script in 
>>> the job, rather than the value provided by the user who started the build.
>>>
>>> I will be deeply grateful for (a link to) a working example. Below are 
>>> things I have tried which do not work.
>>>
>>> I am using the same Groovy script everywhere, so I will post it first 
>>> (noting that in some contexts, I replace build with currentBuild):
>>> def map = build.getBuildVariables()
>>> if (map.XcodeVersion ==~ /^12\..*$/) { map.Label = map.Label + ' && 
>>> xcode12' }
>>> return map
>>>
>>> I have tried the Environment Injector plugin's “Prepare an environment 
>>> for the run” *with* the Override Build Parameters checkbox checked. I 
>>> have tried “Run buildstep before SCM runs”. I have tried “Execute system 
>>> Groovy script”. In none of these cases have I checked the sandbox script 
>>> option. And, in none of the cases does Jenkins use the new Label expression 
>>> to decide where to run the build.
>>>
>>> I understand that I could trigger a downstream build, etc., but those 
>>> workarounds each have their downsides. I also would like to avoid telling 
>>> people that they have to remember to use boolean label expressions like 
>>> unity 
>>> && xcode12 when they start a build.
>>>
>>> If any developers are reading this, I feel Jenkins is peculiarly 
>>> inflexible about label/node selection. For example, it is not possible to 
>>> pass a parameter $FOO to the “Restrict where this project can be run” 
>>> field. Nor is it possible to define labels which expand to a label 
>>> expression. Depending on people to remember boolean expressions to use is 
>>> not really good UX.
>>>
>>> If I am going about this all wrong, none of my Google searches on the 
>>> topic have hinted at the right way to do it, except perhaps for Pipeline, 
>>> which would not be my first choice of a solution, given its intrusiveness. 
>>> Thank you for reading to the end and I hope someone can help me out. David
>>>
>>

-- 
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/339d7dc0-60b1-4ef0-8bf9-1fa162b7f118n%40googlegroups.com.


Re: Updates site down?

2021-04-19 Thread Slide
Yes, it is a known issue. The Infra team is looking into it.

On Mon, Apr 19, 2021 at 12:50 PM Alan Sparks 
wrote:

> Seems like the Jenkins update site is throwing 503 errors… known issue?
> Thanks.
>
> -Alan
>
> --
> 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/DM6PR18MB3306D84C4F55E0F143EF15C6C5499%40DM6PR18MB3306.namprd18.prod.outlook.com
> 
> .
>


-- 
Website: http://earl-of-code.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/CAPiUgVea2yarOPHB-s8U6Pvcxh9Pudf4RXFmymkJm1HD97H5qg%40mail.gmail.com.


Updates site down?

2021-04-19 Thread Alan Sparks
Seems like the Jenkins update site is throwing 503 errors... known issue?  
Thanks.
-Alan

-- 
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/DM6PR18MB3306D84C4F55E0F143EF15C6C5499%40DM6PR18MB3306.namprd18.prod.outlook.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.


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

2021-04-19 Thread David Karr
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/93d32032-bf4d-4889-9377-7c7f1f39d322n%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.


email-ext report with detailed pipeline steps

2021-04-19 Thread jksuser

Hello,

I would like to generate a mail-report that contains the log excerpts of 
the failed steps

of a pipeline.
The scenario is that a pipeline job runs a compilation on different 
nodes (e.g.

Ubuntu, Windows, ...).
In case on of the steps fails I would like to include the success/failed 
markers of the pipeline steps
in the mail-report as well as an excerpt of the console log of the 
particular step (say, compilation on Windows).


I started by trying to understand the following email-ext example template:
https://github.com/jenkinsci/email-ext-plugin/blob/master/docs/templates/jenkins-matrix-email-html.template
... which seems to do a similar thing for a matrix job.

So far I don't really know how to get the information I need in the 
template.

Is this what I need?
https://javadoc.jenkins.io/plugin/workflow-api/org/jenkinsci/plugins/workflow/flow/package-summary.html

Or how can I loop through the pipeline steps and get their console-log?

David



--
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/384df83c-d922-553d-cd15-f57aab9ae553%40sourco.de.


How to get rid of noisy warning "No suitable checks publisher found"

2021-04-19 Thread Amedee Van Gasse
One of the Jenkins plugins dragged in the *Checks API* as a dependency and 
now *EVERY* build has this annoying message at the bottom:

[Checks API] No suitable checks publisher found.

This does not fail any build by itself. It's just annoying noise and I 
don't want it.

And now each time a build fails for any other reason, my developers tell me 
*"It seems that we have problems with build on foobar machine with 'No 
suitable checks publisher found' error again"*
which is incorrect, the actual error is just above or below that warning.

This is a waste of time, I never want to see that warning again. How do I 
get rid of it?

I can't uninstall *Checks API*, it's grayed out. *JUnit* and *Warnings Next 
Generation* need it as a dependency.

* Jenkins: 2.277.2
* Checks API: 1.7.0

-- 
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/bc4c4a56-a6ab-4ae2-a945-e219ec4ef49an%40googlegroups.com.


Push Lighthouse report data from Jenkins to Splunk

2021-04-19 Thread Swetha Gorantla
HI,

By using Puppeteer and Lighthouse tools we developed a script to test the 
front end web performance. These scripts are scheduled in Jenkins such that 
it runs regularly. We are doing Lighthouse test for multiple pages of a web 
application like Homepage --> signin --> search --> add item to basket --> 
checkout. For all these pages we are getting separate HTML report with 
performance details in Jenkins work space. Now we wanted to send these 
performance metrics of each and every page for every built to splunk. Can 
someone help me on below...
1) How to extract required field data of HTML which is in Jenkins workspace?
2) After extracting the values how can we send that data to splunk?

Please let me know if you need any more details.

Thanks in advance.

-- 
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/11484f28-104a-4263-b6bd-2b1ce14408e3n%40googlegroups.com.