示例#1
0
 def test_check_gocd_subject_pattern_valid(self):
     subjects = ['FW: Stage [proDuct.branch.CI/100/Package/1] passed',
                 'FW: Stage [product.branch.CI/0/Package/2] is fixed',
                 'Stage [product.braNch.Deploy.Test0/212/Package/1] passed',
                 'Stage [product2.branch2.CI/10999/Package/1] failed',
                 'Stage [prod.bch.Deploy.Test0/212/Package/1] is broken']
     for subject in subjects:
         self.assertTrue(is_gocd_pattern(subject))
示例#2
0
def process(service, labels, messages_details):
    for item in messages_details:
        subject = Msg.get_subject(item)

        if Msg.is_gocd_pattern(subject):
            gocd_details = Msg.get_gocd_details(subject)

            if slack.is_matching_send_rule(gocd_details):
                body = Msg.get_body(item)
                changeset = Msg.get_changeset_info(body)
                text = (slack
                        .message_builder(gocd_details,
                                         changeset,
                                         GOCD_DASHBOARD_URL))

                slack.send_to_slack(text, WEBHOOK_URL)

                Gm.add_label(service, Msg.get_id(item),
                             'SENT_TO_SLACK', labels)

        Gm.remove_label(service, Msg.get_id(item),
                        'UNREAD', labels)
示例#3
0
 def test_check_gocd_subject_pattern_invalid(self):
     subjects = ['FW: Stage [product.branch.CI/100/Package/1] unknown',
                 'Stage [product.branch.CI/a/Package/1] passed']
     for subject in subjects:
         self.assertFalse(is_gocd_pattern(subject))