Add report directive
ClosedPublic

Authored by mkrizek on Jan 29 2016, 8:00 PM.

Details

Summary

For now, the directive is for demo purposes and a good start for future enhancements. Fixes T693

Test Plan

Run a check (I tested with rpmlint and upgradepath). Usage is included in the directive's documentation. Simple unittest included.

Diff Detail

Repository
rLTRN libtaskotron
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mkrizek retitled this revision from to Add report directive.Jan 29 2016, 8:00 PM
mkrizek updated this object.
mkrizek edited the test plan for this revision. (Show Details)
mkrizek added reviewers: tflink, kparal, jskladan.
jskladan accepted this revision.Feb 3 2016, 1:17 PM
This revision is now accepted and ready to land.Feb 3 2016, 1:17 PM
kparal added a comment.Feb 3 2016, 3:23 PM

@tflink said that it would be useful for tasks to be able to provide their own jinja template, so that's a feature you might want to add.

libtaskotron/directives/report_directive.py
19–22 ↗(On Diff #1888)

I got confused a little when I first read the description, because it says what the value is, but not what it is for. Also, we talked about some changes in behavior in person. Last but not least, we should use default: value statement here so that it's rendered in the documentation matrix in the same way as the other directives are. So what about:

path:
  required: false
  description: |
    A path and a filename of the generated HTML report. You should always use relative
    paths, and ``${artifactsdir}`` is considered to be the base directory. All missing directories 
    will be created automatically. Example: ``reports/overview.html``
  type: str
  default: report.html
25 ↗(On Diff #1888)

We now have this in executor.py:

self.arg_data['checkname'] = self.task_data['name']

So it should never happen we don't know the check name.

But we might want to extend this error to cases when directory creation fails for custom path.

42 ↗(On Diff #1888)

I'm a bit worried that people will understand this not as a noun "report" (as in create a report) but as a verb "report" (as in report results), and confuse this directive with resultsdb directive. I'd rather call this create_report, generate_report, create_html, generate_html, pretty_report, something along those lines.

44 ↗(On Diff #1888)

Since with the proposed change we base it off of ${arfifactsdir}, I would not include ../ here, maybe skip it completely for the trivial example (use the default name).

60 ↗(On Diff #1888)

Thoughts whether we want to have this in /usr/lib/python/site-packages/ or somewhere else? @tflink?

66–67 ↗(On Diff #1888)

As said above, I think this is not needed anymore. And we can remove this from resultsdb_directive as well.

80 ↗(On Diff #1888)

Again, should not be needed.

mkrizek updated this revision to Diff 1895.Feb 5 2016, 12:52 PM
  • Address issues from the review
tflink accepted this revision.Feb 6 2016, 11:22 AM

Can you post/paste the example you used to test this somewhere? I'm thinking about adding it to the workshop tomorrow.

Also, we should file an RFE to have the output file name not be hardcoded

In D735#14065, @tflink wrote:

Can you post/paste the example you used to test this somewhere? I'm thinking about adding it to the workshop tomorrow.

Well the example in the examples section of the docs should do it, right?

This revision was automatically updated to reflect the committed changes.