示例#1
0
def test_add_attachment_to_card():
    card = Card()
    card.add_attachment("Pipeline failure !!!")
    card.add_attachment("Pipeline success !!!")
    assert len(card.attachments) == 2
    assert card.attachments[0][
        "contentType"] == "application/vnd.microsoft.card.hero"
    assert card.attachments[0]["content"]["subtitle"] == "Pipeline failure !!!"
    assert card.type == "message"
示例#2
0
 def _hook(context: HookContext):
     text = message_fn(context)
     if dagit_base_url:
         text += "<a href='{base_url}/instance/runs/{run_id}'>View in Dagit</a>".format(
             base_url=dagit_base_url,
             run_id=context.run_id,
         )
     card = Card()
     card.add_attachment(text_message=text)
     context.resources.msteams.post_message(payload=card.payload)
示例#3
0
    def teams_on_pipeline_failure(context: PipelineFailureSensorContext):

        text = message_fn(context)
        if dagit_base_url:
            text += "<a href='{base_url}/instance/runs/{run_id}'>View in Dagit</a>".format(
                base_url=dagit_base_url,
                run_id=context.pipeline_run.run_id,
            )
        card = Card()
        card.add_attachment(text_message=text)
        teams_client.post_message(payload=card.payload)