Skip to content

Commit

Permalink
Merge branch 'more_git_meta_fields' of 'https://github.com/zhquan/Gri…
Browse files Browse the repository at this point in the history
…moireELK'

Merges #1087
Closes #1087
  • Loading branch information
sduenas authored Oct 27, 2022
2 parents dda0623 + 48a31b5 commit ab9edaf
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
5 changes: 3 additions & 2 deletions grimoire_elk/enriched/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ class GitEnrich(Enrich):
GIT_AOC_ENRICHED = "git_aoc-enriched"

roles = ['Author', 'Commit']
meta_fields = ['acked_by_multi', 'co_developed_by_multi', 'reported_by_multi', 'reviewed_by_multi',
'signed_off_by_multi', 'suggested_by_multi', 'tested_by_multi']
meta_fields = ['acked_by_multi', 'approved_by_multi', 'co_authored_by_multi', 'co_developed_by_multi',
'merged_by_multi', 'reported_by_multi', 'reviewed_by_multi', 'signed_off_by_multi',
'suggested_by_multi', 'tested_by_multi']
meta_fields_suffixes = ['_bots', '_domains', '_names', '_org_names', '_uuids']
meta_non_authored_prefix = 'non_authored_'

Expand Down
23 changes: 23 additions & 0 deletions releases/unreleased/git-extracts-more-authors-meta-info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Development and reviewing contributors fields for Git items
category: added
author: Quan Zhou <[email protected]>
issue: null
notes: >
New information about the participants during the development and the
reviewing processes are available in `Git` items. The Git backend extracts
these data from `Approved-by`, `Co-authored-by`, and `Merged-by`
trailers that some commit messages might include. For each one of these
trailers, new fields will be available with the suffixes: `_bots`, `_domains`,
`_names`, `_org_names`, and `_uuids`. Also for each one of these suffixes,
there will be extra fields with the prefix `non_authored_`.
This is an example of the fields available for the the trailer `Merged-by`:
- merged_by_multi_bots
- merged_by_multi_domains
- merged_by_multi_names
- merged_by_multi_org_names
- merged_by_multi_uuids
- non_authored_merged_by_multi_bots
- non_authored_merged_by_multi_domains
- non_authored_merged_by_multi_names
- non_authored_merged_by_multi_org_names
2 changes: 1 addition & 1 deletion tests/data/git.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@
"removed": "0"
}
],
"message": "Merge branch 'lzp'\n\nConflicts:\n\taaa/otherthing\nSigned-off-by: Owl Capone <[email protected]>\nReviewed-by: Owl Capone <[email protected]>\nSigned-off-by: Owl Second <[email protected]>",
"message": "Merge branch 'lzp'\n\nConflicts:\n\taaa/otherthing\nSigned-off-by: Owl Capone <[email protected]>\nReviewed-by: Owl Capone <[email protected]>\nSigned-off-by: Owl Second <[email protected]>\nMerged-by: Owl Third <[email protected]>\nCo-authored-by: OwlBot <[email protected]>\nApproved-by: Owl Third <[email protected]>",
"parents": [
"ce8e0b86a1e9877f42fe9453ede418519115f367",
"51a3b654f252210572297f47597b31527c475fb8"
Expand Down
30 changes: 30 additions & 0 deletions tests/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,21 @@ def test_raw_to_enrich(self):
self.assertListEqual(eitem['suggested_by_multi_names'], [])
self.assertListEqual(eitem['tested_by_multi_names'], [])
self.assertListEqual(eitem['non_authored_signed_off_by_multi_names'], [])
self.assertListEqual(eitem['approved_by_multi_names'], [])
self.assertListEqual(eitem['approved_by_multi_domains'], [])
self.assertListEqual(eitem['approved_by_multi_bots'], [])
self.assertListEqual(eitem['approved_by_multi_org_names'], [])
self.assertListEqual(eitem['approved_by_multi_uuids'], [])
self.assertListEqual(eitem['co_authored_by_multi_names'], [])
self.assertListEqual(eitem['co_authored_by_multi_domains'], [])
self.assertListEqual(eitem['merged_by_multi_names'], [])
self.assertListEqual(eitem['merged_by_multi_domains'], [])
self.assertListEqual(eitem['non_authored_approved_by_multi_names'], [])
self.assertListEqual(eitem['non_authored_approved_by_multi_domains'], [])
self.assertListEqual(eitem['non_authored_co_authored_by_multi_names'], [])
self.assertListEqual(eitem['non_authored_co_authored_by_multi_domains'], [])
self.assertListEqual(eitem['non_authored_merged_by_multi_names'], [])
self.assertListEqual(eitem['non_authored_merged_by_multi_domains'], [])

item = self.items[8]
eitem = enrich_backend.get_rich_item(item)
Expand All @@ -148,6 +163,21 @@ def test_raw_to_enrich(self):
self.assertListEqual(eitem['suggested_by_multi_names'], [])
self.assertListEqual(eitem['tested_by_multi_names'], [])
self.assertListEqual(eitem['non_authored_signed_off_by_multi_names'], ['Owl Second'])
self.assertListEqual(eitem['approved_by_multi_names'], ['Owl Third'])
self.assertListEqual(eitem['approved_by_multi_domains'], ['third.io'])
self.assertListEqual(eitem['approved_by_multi_bots'], [False])
self.assertListEqual(eitem['approved_by_multi_org_names'], ['Unknown'])
self.assertListEqual(eitem['approved_by_multi_uuids'], ['1bdac6c64760c1027a3777c9ba22adddb0e97c5e'])
self.assertListEqual(eitem['co_authored_by_multi_names'], ['OwlBot'])
self.assertListEqual(eitem['co_authored_by_multi_domains'], ['boss.io'])
self.assertListEqual(eitem['merged_by_multi_names'], ['Owl Third'])
self.assertListEqual(eitem['merged_by_multi_domains'], ['third.io'])
self.assertListEqual(eitem['non_authored_approved_by_multi_names'], ['Owl Third'])
self.assertListEqual(eitem['non_authored_approved_by_multi_domains'], ['third.io'])
self.assertListEqual(eitem['non_authored_co_authored_by_multi_names'], ['OwlBot'])
self.assertListEqual(eitem['non_authored_co_authored_by_multi_domains'], ['boss.io'])
self.assertListEqual(eitem['non_authored_merged_by_multi_names'], ['Owl Third'])
self.assertListEqual(eitem['non_authored_merged_by_multi_domains'], ['third.io'])

aliases = self.enrich_backend.elastic.list_aliases()
self.assertListEqual(self.enrich_aliases, list(aliases.keys()))
Expand Down

0 comments on commit ab9edaf

Please sign in to comment.