Bug 1918247 - Minor adjustments to slack_notifier.py script for milestone releases r=aaronmt

Differential Revision: https://phabricator.services.mozilla.com/D222016
This commit is contained in:
Jackie Johnson 2024-09-12 18:26:00 +00:00
parent f4bdb58b5a
commit fa431c5bb0
3 changed files with 16 additions and 6 deletions

View File

@ -41,8 +41,8 @@ task-defaults:
'3':
- queue:route:notify.slack-channel.G016BC5FUHJ # notify mobile-alerts-sandbox on failure
- notify:slack-channel:G016BC5FUHJ
- queue:route:notify.slack-channel.C02KDDS9QM9 # notify mobile-testeng on success
- notify:slack-channel:C02KDDS9QM9
- queue:route:notify.slack-channel.C07HUFVU2UD # notify mobile-testeng-releases on success
- notify:slack-channel:C07HUFVU2UD
default: []
tasks:
@ -62,7 +62,7 @@ tasks:
env:
SHIPPING_PRODUCT: focus
TESTRAIL_PRODUCT_TYPE: Focus
TESTRAIL_PROJECT_ID: '48' # Focus Browser
TESTRAIL_PROJECT_ID: '48' # Focus for Android
TESTRAIL_TEST_SUITE_ID: '49386' # Test Automation Release Milestone - Focus
create-milestone-fenix:

View File

@ -66,7 +66,7 @@ SLACK_SUCCESS_MESSAGE_TEMPLATE = Template(
"type": "header",
"text": {
"type": "plain_text",
"text": "New Release: :firefox: $SHIPPING_PRODUCT-v$RELEASE_VERSION :star:"
"text": "New Release: :android: $PRODUCT_ICON $SHIPPING_PRODUCT-v$RELEASE_VERSION :star:"
}
},
{
@ -76,7 +76,7 @@ SLACK_SUCCESS_MESSAGE_TEMPLATE = Template(
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Testrail Release*: $TESTRAIL_PRODUCT_TYPE $RELEASE_TYPE $RELEASE_VERSION <https://testrail.stage.mozaws.net/index.php?/projects/overview/$TESTRAIL_PROJECT_ID|Milestone> has been created:testrail:"
"text": "*Testrail Release*: $TESTRAIL_PRODUCT_TYPE $RELEASE_TYPE $RELEASE_VERSION <https://mozilla.testrail.io/index.php?/projects/overview/$TESTRAIL_PROJECT_ID|Milestone> has been created:testrail:"
}
},
{
@ -192,3 +192,8 @@ def send_success_notification(success_values, channel_id, options):
send_slack_notification(
SLACK_SUCCESS_MESSAGE_TEMPLATE, success_values, channel_id, options
)
def get_product_icon(product):
product_map = {"fenix": ":firefox:", "focus": ":firefox_focus:"}
return product_map.get(product.lower(), ":firefox:")

View File

@ -26,13 +26,14 @@ from lib.testrail_utils import (
load_testrail_credentials,
)
from slack_notifier import (
get_product_icon,
get_taskcluster_options,
send_error_notification,
send_success_notification,
)
# Constants
SUCCESS_CHANNEL_ID = "C02KDDS9QM9" # mobile-testeng
SUCCESS_CHANNEL_ID = "C07HUFVU2UD" # mobile-testeng-releases
ERROR_CHANNEL_ID = "G016BC5FUHJ" # mobile-alerts-sandbox
@ -82,6 +83,9 @@ def main():
testrail_project_id, milestone["id"], device, testrail_test_suite_id
)
testrail.update_test_run_tests(test_run["id"], 1) # 1 = Passed
product_icon = get_product_icon(shipping_product)
# Send success notification
success_values = {
"RELEASE_TYPE": release_type,
@ -89,6 +93,7 @@ def main():
"SHIPPING_PRODUCT": shipping_product,
"TESTRAIL_PROJECT_ID": testrail_project_id,
"TESTRAIL_PRODUCT_TYPE": testrail_product_type,
"PRODUCT_ICON": product_icon,
}
send_success_notification(success_values, SUCCESS_CHANNEL_ID, options)