[JIRA] (JENKINS-57098) JSON Exchange format for import/export?

15 views
Skip to first unread message

dev@jmini.fr (JIRA)

unread,
Apr 18, 2019, 2:29:02 AM4/18/19
to jenkinsc...@googlegroups.com
Jeremie Bresson created an issue
 
Jenkins / Improvement JENKINS-57098
JSON Exchange format for import/export?
Issue Type: Improvement Improvement
Assignee: Ulli Hafner
Components: analysis-model
Created: 2019-04-18 06:28
Priority: Major Major
Reporter: Jeremie Bresson

Having the Groovy based warnings parser is a great way to support new tools that reports warnings. It might be useful when you write the report (because you write the static analyser or because you plug something into an existing tool).


Example:

For example I have create an extension for Asciidoctor, that collects the issues reported and put them into a file like this.

/tmp/file.adoc|5|ERROR|include file not found: /tmp/other.adoc
/tmp/file.adoc|7|HIGH|list item index: expected 1, got 8
UNKNOWN|0|HIGH|skipping reference to missing attribute: bla

Thank to the Groovy based warnings parser, I can use a regex ((.)|(\d+)|(.)|(.*)) to parse the log that I have created.

Read more about this: https://jmini.github.io/asciidoctorj-file-logger/

The next step for me would be to contribute the parser to this project, so that it no longer rely on a config in Jenkins.

But before doing this, I would like to challenge the format that is used...
I could not find any discussion about this.

One idea that I have: a collection of JSON structures on each line:

{"fileName": "/tmp/file.adoc", "lineStart": "5", "severity": "ERROR", "message": "include file not found: /tmp/other.adoc"}
{"fileName": "/tmp/file.adoc", "lineStart": "7", "severity": "HIGH", "message": "list item index: expected 1, got 8"}
{"severity": "HIGH", "message": "skipping reference to missing attribute: bla"}

This might be more robust, because the semantic is clearly defined (and not based on a regex config). I think this kind of files are now really common with tools like logstash (using JSON Layout in logger framework).

In comparison to xml based file, this kind of format works with tools that works with an append-only approach.

Thank in advance for your feedback.


Related issue:

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 18, 2019, 2:34:02 PM4/18/19
to jenkinsc...@googlegroups.com
Ulli Hafner commented on Improvement JENKINS-57098
 
Re: JSON Exchange format for import/export?

Providing an additional format as JSON is a good idea. I think it is not hard to implement something that reads the existing Issue properties. It basically should do the same thing that an XML parser in JENKINS-56510 is doing. Then users have the choice to use the format that is better matching.

Is Asciidoctor already a Jenkins Plugin? Note that in this case you can also can consider to directly create the issues using the API rather then working with files at all. Then you do not need to think about flushing of the console log...

dev@jmini.fr (JIRA)

unread,
Apr 20, 2019, 10:41:02 AM4/20/19
to jenkinsc...@googlegroups.com

Thank you for your feedback.

Is Asciidoctor already a Jenkins Plugin? Note that in this case you can also can consider to directly create the issues using the API rather then working with files at all. Then you do not need to think about flushing of the console log...

I have no idea if there is an Asciidoctor plugin.

Like many java developers and I prefer to orchestrate my build with a tool like maven or gradle.
This way I can run it locally and have the CI server (Jenkins) to reproduce it at server side.

So for me having the build tool flushing logs to a file and having Jenkins to read this file is a valid approach.

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 20, 2019, 11:41:03 AM4/20/19
to jenkinsc...@googlegroups.com

Are you planning to integrate such a format in Asciidoctor as well?

dev@jmini.fr (JIRA)

unread,
Apr 23, 2019, 2:13:03 AM4/23/19
to jenkinsc...@googlegroups.com

For the moment Asciidoctor is logging to the console and provide an API to implement a custom Log-Handler.
I think that for the time being, having a small extension that logs to the JSON format is an appropriate way to do it.

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 23, 2019, 2:01:01 PM4/23/19
to jenkinsc...@googlegroups.com
Ulli Hafner assigned an issue to Unassigned
 
Change By: Ulli Hafner
Labels: help-wanted newbie-friendly
Assignee: Ulli Hafner

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 23, 2019, 3:03:03 PM4/23/19
to jenkinsc...@googlegroups.com
Ulli Hafner assigned an issue to Ulli Hafner
Change By: Ulli Hafner
Assignee: Ulli Hafner

dev@jmini.fr (JIRA)

unread,
May 6, 2019, 5:34:03 AM5/6/19
to jenkinsc...@googlegroups.com

ullrich.hafner@gmail.com (JIRA)

unread,
May 29, 2019, 3:41:01 PM5/29/19
to jenkinsc...@googlegroups.com
Change By: Ulli Hafner
Status: Open Fixed but Unreleased
Resolution: Fixed

dev@jmini.fr (JIRA)

unread,
Jun 5, 2019, 2:04:02 AM6/5/19
to jenkinsc...@googlegroups.com
Change By: Jeremie Bresson
Status: Fixed but Unreleased Resolved
Released As: 5.1.0 (analysis-model and warnings-ng)

dev@jmini.fr (JIRA)

unread,
Jun 5, 2019, 2:30:01 AM6/5/19
to jenkinsc...@googlegroups.com

dev@jmini.fr (JIRA)

unread,
Jun 5, 2019, 2:30:02 AM6/5/19
to jenkinsc...@googlegroups.com
Jeremie Bresson updated an issue
Change By: Jeremie Bresson
Released As: 5.1.0 (analysis-model and warnings-ng)

dev@jmini.fr (JIRA)

unread,
Jun 5, 2019, 2:32:01 AM6/5/19
to jenkinsc...@googlegroups.com

dev@jmini.fr (JIRA)

unread,
Jun 5, 2019, 2:42:02 AM6/5/19
to jenkinsc...@googlegroups.com
Jeremie Bresson edited a comment on Improvement JENKINS-57098
This is released in {{edu.hm.hafner:analysis-model:5.1.0}}

In the Jenkins plugin:
* This is
fixed with commit https://github.com/jenkinsci/warnings-ng-plugin/commit/7063463459661cddf65e8e0c1c9b6e6ef6fec05a on the {{master}} branch, but not released yet.
* {{io.jenkins.plugins:warnings-ng:5.1.0}} is using {{edu.hm.hafner:analysis-model:5.0.0}} as dependency.

ullrich.hafner@gmail.com (JIRA)

unread,
Jun 5, 2019, 2:50:02 AM6/5/19
to jenkinsc...@googlegroups.com

Yes, it will be part of the next release 5.2.0.

ullrich.hafner@gmail.com (JIRA)

unread,
Jun 27, 2019, 5:03:05 PM6/27/19
to jenkinsc...@googlegroups.com
Change By: Ulli Hafner
Status: Fixed but Unreleased Resolved
Released As: 5.2.0
Reply all
Reply to author
Forward
0 new messages