Add a trigger for dist-git commit events.
ClosedPublic

Authored by ralph2 on Dec 5 2016, 8:48 PM.

Details

Summary

This lets us add tests that trigger in response to dist-git commits.

I originally wrote this with a single message_type for all namespaces,
but then found that I didn't have a way in the trigger rules to specify
that a test (like modlint) should be run on all module dist-git
commits but not on all rpm dist-git commits. To fix this, I created
three separate message types, one for each of the namespaces we
currently have.

This of course means that we can write taskotron checks that check our
taskotron checks.

Test Plan

Run the test suite.

Diff Detail

Repository
rTRGR taskotron-trigger
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ralph2 retitled this revision from to Add a trigger for dist-git commit events..Dec 5 2016, 8:48 PM
ralph2 updated this object.
ralph2 edited the test plan for this revision. (Show Details)
ralph2 added reviewers: tflink, mkrizek.

... then found that I didn't have a way in the trigger rules to specify that a test (like modlint) should be run on all module dist-git commits but not on all rpm dist-git commits

Looking at the code (and I hope I understood what you mean), this sure is a solution, that is readable, but you could do it without the different message types, if you wanted to, since you effectively just map namespace 1:1 to mesage_type.

I'll try to suggest the change in code. Although I'm not saying it is the better solution, this is exactly what I designed the trigger config for - in the FedMsg Consumer, you parse and provide data (here the 'relevant' bits are message_type and namespace), and the config then specifies rules based on the combination of values of said data.
It might well be, that this is not what I think you wanted (even thought I think my suggestions end up doing the same), and then I'd like to discuss how to make trigger better.
It might also be just a case of missing documentation... /me sucks with docs...

conf/trigger_rules.yml.example
9
- when:
    message_type: DistGitCommit, 
    namespace: rpms
12
- when:
    message_type: DistGitCommit, 
    namespace: modules
15
- when:
    message_type: DistGitCommit, 
    namespace: docker
jobtriggers/dist_git_commit_msg.py
33

"message_type": "DistGitCommit",

ralph2 updated this revision to Diff 2707.Dec 7 2016, 5:01 PM

Simplify dist-git trigger message type(s), as per review feedback from @jskladan.

jskladan accepted this revision.Dec 8 2016, 10:54 AM

Looks great, thanks!

This revision is now accepted and ready to land.Dec 8 2016, 10:54 AM
Closed by commit rTRGR55a87db1365d: Add a trigger for dist-git commit events. (authored by Ralph Bean <rbean@redhat.com>). · Explain WhyDec 8 2016, 8:02 PM
This revision was automatically updated to reflect the committed changes.