Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Add support for standalone reporting command #108

Merged
merged 3 commits into from
Jul 23, 2018

Conversation

veruu
Copy link
Contributor

@veruu veruu commented Jul 13, 2018

Test with commands like sktm -vv --mail-from me --mail-to someone report --assets dir-with-results

where dir-with-results is a directory containing stage results (which are not yet implemented in skt, so you'll need to create your own ones for testing purposes).
Examples of content:
build.log build.report build.result merge.report merge.result
or applied.patch merge.report merge.result s390/ x86/ where s390/ contains build.report build.result config.gz kitty and x86/ contains build.report build.result useless-file

From the examples, useless-file is not referenced in the report text so it's not added, config.gz, applied.patch and kitty are referenced and added as attachments.

I'll add a proper directory structure definition to meta/pull6 so it's less confusing but I wanted to publish the code here before the weekend.

@coveralls
Copy link

coveralls commented Jul 13, 2018

Pull Request Test Coverage Report for Build 390

  • 129 of 175 (73.71%) changed or added relevant lines in 2 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+8.9%) to 37.976%

Changes Missing Coverage Covered Lines Changed/Added Lines %
sktm/reporter.py 125 143 87.41%
sktm/executable.py 4 32 12.5%
Files with Coverage Reduction New Missed Lines %
sktm/executable.py 3 16.24%
Totals Coverage Status
Change from base Build 382: 8.9%
Covered Lines: 463
Relevant Lines: 1095

💛 - Coveralls

@veruu veruu force-pushed the reporting branch 4 times, most recently from dec3fdd to 6647787 Compare July 17, 2018 16:18
@veruu
Copy link
Contributor Author

veruu commented Jul 17, 2018

This is more or less ready to review.

@veruu veruu force-pushed the reporting branch 2 times, most recently from 639cbe7 to a99a841 Compare July 18, 2018 17:20
Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Copy link
Contributor

@dzickusrh dzickusrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this seems fine in general as it is opt-in and won't cause issues with current pipeline.
I just had some concerns about input. Everything else seems straightforward.

sktm/reporter.py Outdated
for header in headers:
key, value = header.split(':', 1)
self.report[key] = value

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who sanitizes the input? If I type --header foo --header bar:blah, I think things will go bad? Or is the input files verified?
Not that many non-scripts will touch those cli options, but in case things get fat fingered..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is taken from skt (but can be changed if needed). Missing space as in your second example is not a problem, only missing : is (as per your first example). The format is described in the help string if someone wants to use the command manually. IMHO, things should "go bad" if you pass invalid option. The error thrown should show the line which tries to split the header so it should be obvious what is the problem but if you would feel more comfortable with it, I can add a custom error message saying that the header passed doesn't conform to the required format.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. If this is more-or-less a copy-n-paste of skt, then it is probably fine. Eventually, it would be nice to have some checking going on to avoid silly bugs. I wonder if a simple 'if not value: raise Exception()' works here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, since the assignment itself will throw the exception. But I added a custom message to it, please check if that's what you meant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. thanks.

Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
Copy link
Contributor

@dzickusrh dzickusrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me.

sktm/reporter.py Outdated
for header in headers:
key, value = header.split(':', 1)
self.report[key] = value

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. thanks.

@veruu veruu merged commit 7a05856 into cki-project:master Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants