diff options
| author | Trevor Gamblin <tgamblin@baylibre.com> | 2023-11-01 14:08:21 -0400 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-01 19:19:40 +0000 |
| commit | 2bddb6bb97075a2dd8e988867e0ee6e4556d2924 (patch) | |
| tree | be3446bdbab1f5fe7fbadcad3d2dc1163a3eb06e | |
| parent | 3a7b408178439482d49d573113cc61a69fb28147 (diff) | |
| download | poky-2bddb6bb97075a2dd8e988867e0ee6e4556d2924.tar.gz | |
patchtest-send-results: add In-Reply-To
Rework the script for sending results to use send_raw_email and specify
the 'In-Reply-To' field so that patchtest replies to the emails, rather
than sending them standalone to the submitter and mailing list.
(From OE-Core rev: 0c45c92e7f26aea4edf2cfa577b7ba51384e59d3)
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | scripts/patchtest-send-results | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/scripts/patchtest-send-results b/scripts/patchtest-send-results index 01b071159b..1df81f943a 100755 --- a/scripts/patchtest-send-results +++ b/scripts/patchtest-send-results | |||
| @@ -59,7 +59,16 @@ subject_line = f"Patchtest results for {mbox_subject}" | |||
| 59 | 59 | ||
| 60 | # extract the submitter email address and use it as the reply address | 60 | # extract the submitter email address and use it as the reply address |
| 61 | # for the results | 61 | # for the results |
| 62 | reply_address = re.findall("<(.*)>", mbox[0]['from']) | 62 | reply_address = re.findall("<(.*)>", mbox[0]['from'])[0] |
| 63 | |||
| 64 | # extract the message ID and use that as the in-reply-to address | ||
| 65 | in_reply_to = re.findall("<(.*)>", mbox[0]['Message-ID'])[0] | ||
| 66 | |||
| 67 | # the address the results email is sent from | ||
| 68 | from_address = "patchtest@automation.yoctoproject.org" | ||
| 69 | |||
| 70 | # mailing list to CC | ||
| 71 | cc_address = "openembedded-core@lists.openembedded.org" | ||
| 63 | 72 | ||
| 64 | if "FAIL" in testresult: | 73 | if "FAIL" in testresult: |
| 65 | reply_contents = None | 74 | reply_contents = None |
| @@ -70,24 +79,18 @@ if "FAIL" in testresult: | |||
| 70 | reply_contents = greeting + testresult + suggestions | 79 | reply_contents = greeting + testresult + suggestions |
| 71 | 80 | ||
| 72 | ses_client = boto3.client('ses', region_name='us-west-2') | 81 | ses_client = boto3.client('ses', region_name='us-west-2') |
| 73 | response = ses_client.send_email( | 82 | raw_data = 'From: ' + from_address + '\nTo: ' + reply_address + \ |
| 74 | Source='patchtest@automation.yoctoproject.org', | 83 | '\nCC: ' + cc_address + '\nSubject:' + subject_line + \ |
| 75 | Destination={ | 84 | '\nIn-Reply-To:' + in_reply_to + \ |
| 76 | 'CcAddresses': ['openembedded-core@lists.openembedded.org'], | 85 | '\nMIME-Version: 1.0" + \ |
| 86 | "\nContent-type: Multipart/Mixed;boundary="NextPart"\n\n--NextPart\nContent-Type: text/plain\n\n' + \ | ||
| 87 | reply_contents + '\n\n--NextPart' | ||
| 88 | response = ses_client.send_raw_email( | ||
| 89 | Source="patchtest@automation.yoctoproject.org", | ||
| 90 | RawMessage={ | ||
| 91 | "Data": raw_data, | ||
| 77 | }, | 92 | }, |
| 78 | ReplyToAddresses=reply_address, | ||
| 79 | Message={ | ||
| 80 | 'Subject': { | ||
| 81 | 'Data': subject_line, | ||
| 82 | 'Charset': 'utf-8' | ||
| 83 | }, | ||
| 84 | 'Body': { | ||
| 85 | 'Text': { | ||
| 86 | 'Data': reply_contents, | ||
| 87 | 'Charset': 'utf-8' | ||
| 88 | } | ||
| 89 | } | ||
| 90 | } | ||
| 91 | ) | 93 | ) |
| 94 | |||
| 92 | else: | 95 | else: |
| 93 | print(f"No failures identified for {args.patch}.") | 96 | print(f"No failures identified for {args.patch}.") |
