Repository: fedora-infra/bodhi

Issue:
Bugzilla: Provide the build version being pushed to testing/stable
There's the message Bodhi sends to bugs:

    FEDORA-2023-a8da4c264f has been pushed to the Fedora 39 testing repository.
    Soon you'll be able to install the update with the following command:
    `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-a8da4c264f`
    You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-a8da4c264f

    See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Would you mind modifying this message a bit to provide the package version
that is being pushed?  Something like

    FEDORA-2023-a8da4c264f (kernel-6.6.0-0.rc6.47.fc40, foo-1.0-2.fc40,
    ..., other packages) has been pushed to the Fedora 40 testing
    repository. ...

Similar this one:

    FEDORA-2023-a8da4c264f has been submitted as an update to Fedora 39.
    https://bodhi.fedoraproject.org/updates/FEDORA-2023-a8da4c264f

This is a small convenience I miss while receiving and reading automatic
e-mails from Bodhi.



Discussion:

Resolving patch:
diff --git a/bodhi-server/bodhi/server/config.py b/bodhi-server/bodhi/server/config.py
--- a/bodhi-server/bodhi/server/config.py
+++ b/bodhi-server/bodhi/server/config.py
@@ -404,7 +404,8 @@ class BodhiConfig(dict):
                       'bodhiadmin'],
             'validator': _generate_list_validator()},
         'initial_bug_msg': {
-            'value': '%s has been submitted as an update to %s. %s',
+            'value': ('{update_alias} ({update_beauty_title}) has been submitted as '
+                      'an update to {update_release}.\n{update_url}'),
             'validator': str},
         'greenwave_api_url': {
             'value': 'https://greenwave-web-greenwave.app.os.fedoraproject.org/api/v1.0',
@@ -568,7 +569,8 @@ class BodhiConfig(dict):
             'value': 'postgresql://localhost/bodhi',
             'validator': str},
         'stable_bug_msg': {
-            'value': ('{update_alias} has been pushed to the {repo} repository.\n'
+            'value': ('{update_alias} ({update_beauty_title}) has been pushed to '
+                      'the {repo} repository.\n'
                       'If problem still persists, please make note of it in this bug report.'),
             'validator': str},
         'stats_blacklist': {
diff --git a/bodhi-server/bodhi/server/models.py b/bodhi-server/bodhi/server/models.py
--- a/bodhi-server/bodhi/server/models.py
+++ b/bodhi-server/bodhi/server/models.py
@@ -4756,7 +4756,7 @@ def default_message(self, update: Update) -> str:
                     'update_alias': update.alias,
                     'repo': f'{update.release.long_name} {update.status.description}',
                     'install_instructions': install_msg,
-                    'update_url': f'{config.get("base_address")}{update.get_url()}'}
+                    'update_url': update.abs_url()}
 
         if update.status is UpdateStatus.stable:
             message = config['stable_bug_msg'].format(**msg_data)
diff --git a/bodhi-server/bodhi/server/tasks/work_on_bugs.py b/bodhi-server/bodhi/server/tasks/work_on_bugs.py
--- a/bodhi-server/bodhi/server/tasks/work_on_bugs.py
+++ b/bodhi-server/bodhi/server/tasks/work_on_bugs.py
@@ -76,8 +76,11 @@ def main(alias: str, bugs: typing.List[int]):
                     update.type = UpdateType.security
 
                 log.info(f'Commenting on {bug.bug_id}')
-                comment = config['initial_bug_msg'] % (
-                    update.alias, update.release.long_name, update.abs_url())
+                msg_data = {'update_alias': update.alias,
+                            'update_beauty_title': update.get_title(beautify=True, nvr=True),
+                            'update_release': update.release.long_name,
+                            'update_url': update.abs_url()}
+                comment = config['initial_bug_msg'].format(**msg_data)
 
                 log.info(f'Modifying {bug.bug_id}')
                 bug.modified(update, comment)


Test patch:
diff --git a/bodhi-server/tests/tasks/test_composer.py b/bodhi-server/tests/tasks/test_composer.py
--- a/bodhi-server/tests/tasks/test_composer.py
+++ b/bodhi-server/tests/tasks/test_composer.py
@@ -1880,8 +1880,8 @@ def test_modify_stable_bugs(self, close, comment, *args):
         close.assert_called_with(
             12345,
             versions=dict(bodhi='bodhi-2.0-1.fc17'),
-            comment=(f'FEDORA-{time.strftime("%Y")}-a3bbe1a8f2 has been pushed to the '
-                     f'Fedora 17 stable repository.\nIf problem still persists, '
+            comment=(f'FEDORA-{time.strftime("%Y")}-a3bbe1a8f2 (bodhi-2.0-1.fc17) has been '
+                     f'pushed to the Fedora 17 stable repository.\nIf problem still persists, '
                      f'please make note of it in this bug report.'))
 
     @mock.patch(**mock_taskotron_results)
diff --git a/bodhi-server/tests/test_models.py b/bodhi-server/tests/test_models.py
--- a/bodhi-server/tests/test_models.py
+++ b/bodhi-server/tests/test_models.py
@@ -325,7 +325,7 @@ def test_epel_without_testing_bug_epel_msg(self, warning):
         message = bug.default_message(update)
 
         warning.assert_called_once_with("No 'testing_bug_epel_msg' found in the config.")
-        assert 'cool fedora stuff {}'.format(config['base_address'] + update.get_url()) == message
+        assert f'cool fedora stuff {update.abs_url()}' == message
 
 
 class TestBugModified(BasePyTestCase):