[JIRA] (JENKINS-40793) Make errors more easily 'machine parseable'

2 views
Skip to first unread message

kzantow@cloudbees.com (JIRA)

unread,
Jan 3, 2017, 8:57:01 PM1/3/17
to jenkinsc...@googlegroups.com
Keith Zantow created an issue
 
Jenkins / Improvement JENKINS-40793
Make errors more easily 'machine parseable'
Issue Type: Improvement Improvement
Assignee: Andrew Bayer
Components: blueocean-pipeline-editor-plugin, pipeline-model-definition-plugin
Created: 2017/Jan/04 1:56 AM
Priority: Major Major
Reporter: Keith Zantow

Currently errors from pipeline JSON to PMD are returned in a textual way that makes it awkward for tools to consume them and display appropriate contextual errors, for example:

At /pipeline/stages/1/branches/0/steps: Array has 0 entries, requires minimum of 1

It would be helpful if these errors were split somehow into a location and message, e.g.:

{ location: '/pipeline/stages/1/branches/0/steps', message: 'Array has 0 entries, requires minimum of 1' }

or even:

{ location: [ 'pipeline', 'stages', 1, 'branches', 0, 'steps' ], code: 'EMPTY_ARRAY_NOT_ALLOWED', message: 'Array has 0 entries, requires minimum of 1' }

Or maybe something different.

This would make it easier for tools to consume without having to parse a potentially volatile (and localized) text format.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

andrew.bayer@gmail.com (JIRA)

unread,
Jan 3, 2017, 9:24:02 PM1/3/17
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Improvement JENKINS-40793
 
Re: Make errors more easily 'machine parseable'

Yeah, something like that can be done. Let me sleep on it.

andrew.bayer@gmail.com (JIRA)

unread,
Jan 4, 2017, 6:48:01 PM1/4/17
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Improvement JENKINS-40793
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Jan 4, 2017, 6:52:01 PM1/4/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 4, 2017, 6:52:01 PM1/4/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 10, 2017, 10:31:01 AM1/10/17
to jenkinsc...@googlegroups.com
Change By: Andrew Bayer
Status: In Review Resolved
Resolution: Fixed

scm_issue_link@java.net (JIRA)

unread,
Jan 10, 2017, 10:32:03 AM1/10/17
to jenkinsc...@googlegroups.com
SCM/JIRA link daemon commented on Improvement JENKINS-40793
 
Re: Make errors more easily 'machine parseable'

Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTValue.java
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/Converter.groovy
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.groovy
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ErrorCollector.groovy
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/JSONErrorCollector.groovy
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/SourceUnitErrorCollector.groovy
pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/DeclarativeLinterCommand.java
pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/ModelConverterAction.java
pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/ErrorsEndpointOpsTest.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/ModelConverterActionTest.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/SuccessfulEndpointOpsTest.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ConvertRoundTripTest.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ExecuteConvertedTest.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ErrorsJSONParserTest.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/validator/SuccessfulJSONParserTest.java
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/0a9ba67035b0da64e5451ff392ca3ea1220bce0e
Log:
[FIXED JENKINS-40793] Add location information to validation errors

Specifically to the JSON output. This also moves us to not doing
conversion between JSONObject and JsonNode, which is nice. There's
probably some cleanup/optimization that could still be done in
JSONParser.

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:34 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages