From 33631af6765b5a0cc10f2fa27b0c709bba4bce66 Mon Sep 17 00:00:00 2001 From: Carlos M <99293320+carlosmuvi-stripe@users.noreply.github.com> Date: Wed, 12 Apr 2023 14:59:31 -0700 Subject: [PATCH] [FC] notify failure endpoint script on Maestro failures (#6519) * [skip ci] Start PR * Pass entire failure url to job. * Update Maestro tests to report to RUN_BANKCON_MOBILE. * Revert finicity change. * Just run if build fails. * Updates bitrise file. * Test pipeline (revert) * Updates bitrise file. * Fix pipeline * Fix pipeline * Test - Make maestro tests fail. * Removes duplicated deploy to bitrise. * Revert test changes. * Revert deploy to bitrise. --- .github/workflows/end_to_end_tests.yml | 2 +- .github/workflows/instrumentation_tests.yml | 4 ++-- bitrise.yml | 16 ++++++++++++++++ scripts/notify_failure_endpoint.rb | 13 +++++++------ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/end_to_end_tests.yml b/.github/workflows/end_to_end_tests.yml index cd8f5dfdb26..c04fbe796ea 100644 --- a/.github/workflows/end_to_end_tests.yml +++ b/.github/workflows/end_to_end_tests.yml @@ -28,5 +28,5 @@ jobs: ./scripts/notify_failure_endpoint.rb \ ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT }} \ ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY }} \ - ${{ github.run_id }} \ + "https://github.com/stripe/stripe-android/actions/runs/${{ github.run_id }}" \ RUN_MOBILESDK diff --git a/.github/workflows/instrumentation_tests.yml b/.github/workflows/instrumentation_tests.yml index 23f46ce1667..859f2319583 100644 --- a/.github/workflows/instrumentation_tests.yml +++ b/.github/workflows/instrumentation_tests.yml @@ -32,7 +32,7 @@ jobs: ./scripts/notify_failure_endpoint.rb \ ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT }} \ ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY }} \ - ${{ github.run_id }} \ + "https://github.com/stripe/stripe-android/actions/runs/${{ github.run_id }}" \ RUN_MOBILESDK screenshot-regression-tests: @@ -66,5 +66,5 @@ jobs: # ./scripts/notify_failure_endpoint.rb \ # ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT }} \ # ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY }} \ -# ${{ github.run_id }} \ +# "https://github.com/stripe/stripe-android/actions/runs/${{ github.run_id }}" \ # RUN_MOBILESDK diff --git a/bitrise.yml b/bitrise.yml index 81ebe48e4da..40081b7c508 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -63,6 +63,22 @@ workflows: inputs: - webhook_url: $WEBHOOK_SLACK_CARLOSMUVI_MAESTRO - webhook_url_on_error: $WEBHOOK_SLACK_CARLOSMUVI_MAESTRO + - script@1: + title: Notify failure endpoint + inputs: + - content: | + #!/usr/bin/env bash + set -e + set -o pipefail + set -x + + ruby ./scripts/notify_failure_endpoint.rb \ + $SDK_FAILURE_NOTIFICATION_ENDPOINT \ + $SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY \ + $BITRISE_BUILD_URL \ + RUN_BANKCON_MOBILE + is_always_run: true + run_if: ".IsBuildFailed" - custom-test-results-export@0: inputs: - search_pattern: '*/maestroReport.xml' diff --git a/scripts/notify_failure_endpoint.rb b/scripts/notify_failure_endpoint.rb index da4eddd2647..4072117b92f 100755 --- a/scripts/notify_failure_endpoint.rb +++ b/scripts/notify_failure_endpoint.rb @@ -7,20 +7,21 @@ env_sdk_failure_notif_endpoint = ARGV[0] env_sdk_failure_notif_endpoint_hmac_key = ARGV[1] -github_run_id = ARGV[2] -jira_project = ARGV[3] - if !env_sdk_failure_notif_endpoint || !env_sdk_failure_notif_endpoint_hmac_key puts "SDK_FAILURE_NOTIFICATION_ENDPOINT` or `SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY` not found" exit 102 end -if !github_run_id - puts "github_run_id not found" +failing_run_url = ARGV[2] + +if !failing_run_url + puts "failing_run_url not found" exit 102 end +jira_project = ARGV[3] + if !jira_project puts "jira_project not found" exit 102 @@ -39,7 +40,7 @@ } params[:summary] = "stripe-android E2E test failed" -params[:description] = "Please ACK this ticket and investigate the failure. See https://github.com/stripe/stripe-android/actions/runs/#{github_run_id}" +params[:description] = "Please ACK this ticket and investigate the failure. See %s" % failing_run_url params[:components] = %w[Android] req.body = params.to_json