Repository: fedora-infra/bodhi

Issue:
Side tag updates are not automatically pushed to testing 
When I create a side tag update for a stable Fedora, it sits in pending until I manually click "push to testing". This is inconsistent with regular updates and a tad confusing.

See also https://pagure.io/fedora-infrastructure/issue/8930


Discussion:
This issue is related to the builds of the update not being marked as signed by Bodhi. I think there is an issue with the Signed consumer and side tag updates that are coming from no rawhide release.

Resolving patch:
diff --git a/bodhi/server/consumers/signed.py b/bodhi/server/consumers/signed.py
--- a/bodhi/server/consumers/signed.py
+++ b/bodhi/server/consumers/signed.py
@@ -89,7 +89,9 @@ def __call__(self, message: fedora_messaging.api.Message):
                 log.info('Build is not assigned to release, skipping')
                 return
 
-            if build.update and build.update.from_tag:
+            if build.update \
+               and build.update.from_tag \
+               and not build.update.release.composed_by_bodhi:
                 koji_testing_tag = build.release.get_testing_side_tag(build.update.from_tag)
                 if tag != koji_testing_tag:
                     log.info("Tag is not testing side tag, skipping")


Test patch:
diff --git a/bodhi/tests/server/consumers/test_signed.py b/bodhi/tests/server/consumers/test_signed.py
--- a/bodhi/tests/server/consumers/test_signed.py
+++ b/bodhi/tests/server/consumers/test_signed.py
@@ -62,6 +62,20 @@ def setup_method(self, method):
                 'release': '1.fc17'
             },
         )
+        self.sample_side_tag_message_2 = api.Message(
+            topic='',
+            body={
+                'build_id': 442562,
+                'name': 'bodhi',
+                'tag_id': 214,
+                'instance': 's390',
+                'tag': 'f30-testing-pending',
+                'user': 'sharkcz',
+                'version': '2.0',
+                'owner': 'sharkcz',
+                'release': '1.fc17'
+            },
+        )
         self.handler = signed.SignedHandler()
 
     @mock.patch('bodhi.server.consumers.signed.Build')
@@ -159,9 +173,27 @@ def test_consume_from_tag_wrong_tag(self, mock_build_model, mock_log):
 
         self.handler(self.sample_side_tag_message)
         mock_log.info.assert_called_with(
-            "Tag is not testing side tag, skipping")
+            "Tag is not pending_testing tag, skipping")
         assert mock_log.info.call_count == 2
 
+    @mock.patch('bodhi.server.consumers.signed.Build')
+    def test_consume_from_tag_build_signed(self, mock_build_model):
+        """
+        Assert that messages about builds from side tag updates coming from
+        normal releases are marked as signed.
+        """
+        build = mock_build_model.get.return_value
+        build.signed = False
+        build.release = mock.MagicMock()
+        build.release.pending_testing_tag = "f30-testing-pending"
+        update = mock.MagicMock()
+        update.from_tag = "f30-side-tag"
+        update.release.composed_by_bodhi = True
+        build.update = update
+
+        self.handler(self.sample_side_tag_message_2)
+        assert build.signed == True
+
     @mock.patch('bodhi.server.consumers.signed.Build')
     def test_consume_from_tag_not_signed(self, mock_build_model):
         """
@@ -173,8 +205,9 @@ def test_consume_from_tag_not_signed(self, mock_build_model):
         build.release = mock.MagicMock()
         build.release.get_testing_side_tag.return_value = "f30-side-tag-testing-pending"
         update = mock.MagicMock()
+        update.release.composed_by_bodhi = False
         update.from_tag = "f30-side-tag"
-        update.signed.return_value = False
+        update.signed = False
         update.status = UpdateStatus.pending
         build.update = update