From e15f5d9881b5f796914acff2dbc4becbf23c6821 Mon Sep 17 00:00:00 2001 From: ZMiskolci Date: Thu, 15 Sep 2022 13:08:08 -0700 Subject: [PATCH] Jupyter test slack report update (#47) * updated workflow to send slack report as single message * test msg * update * fix * Update uat_associations.txt with new collections * test * removed collection * test * added env variable name * test * remvoed -e * Update uat_associations.txt with new collections * removed http to disable preview * Update uat_associations.txt with new collections * updated to final version Co-authored-by: Zoltan Miskolci Co-authored-by: Phoeneix --- .github/workflows/jupyter_test.yml | 74 +++++++++++------------------- 1 file changed, 28 insertions(+), 46 deletions(-) diff --git a/.github/workflows/jupyter_test.yml b/.github/workflows/jupyter_test.yml index 50b5fdf1..acab4802 100644 --- a/.github/workflows/jupyter_test.yml +++ b/.github/workflows/jupyter_test.yml @@ -26,6 +26,7 @@ jobs: echo "OPS_SUCCESS_FILE=ops_success.txt" >> $GITHUB_ENV echo "UAT_FAILURE_FILE=uat_fail.txt" >> $GITHUB_ENV echo "OPS_FAILURE_FILE=ops_fail.txt" >> $GITHUB_ENV + echo "SLACK_REPORT_CONTENT=" >> $GITHUB_ENV - name: Set environment variables for notebook run: | echo "OPS_USERNAME=${{ secrets.EDL_USER }}" >> $GITHUB_ENV @@ -84,61 +85,42 @@ jobs: echo "Success Content: $(cat ${{ env.OUTPUT_DIR }}/${{ env.OPS_SUCCESS_FILE }} | sed 's/$/,/' | tr '\n' ' ')" echo echo "Failed Content: $(cat ${{ env.OUTPUT_DIR }}/${{ env.OPS_FAILURE_FILE }} | sed 's/$/,/' | tr '\n' ' ')" - - name: Send report for UAT check - SUCCESS - uses: slackapi/slack-github-action@v1.21.0 + - name: Slack Report update - Add info for UAT check - SUCCESS if: | - steps.check_UAT_output_files.outputs.SUCCESS_EXISTS == 'true' - with: - payload: | - { - "status": "Jupyter-test UAT result: SUCCESS\nSuccessfully ran Concise Notebook on the following collections:\n${{ steps.check_UAT_output_files.outputs.SUCCESS_CONTENT }}\n" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BOT_WEBHOOK }} - - name: Send report for UAT check - FAILURE - uses: slackapi/slack-github-action@v1.21.0 + steps.check_UAT_output_files.outputs.SUCCESS_EXISTS == 'true' + run: | + echo "SLACK_REPORT_CONTENT=${{ env.SLACK_REPORT_CONTENT }}\nJupyter-test UAT result: SUCCESS\nSuccessfully ran Concise Notebook on the following collections:\n${{ steps.check_UAT_output_files.outputs.SUCCESS_CONTENT }}\n" >> $GITHUB_ENV + - name: Slack Report update - Add info for UAT check - FAILURE if: | - steps.check_UAT_output_files.outputs.FAIL_EXISTS == 'true' - with: - payload: | - { - "status": "Jupyter-test UAT result: FAILURE\nFailed to run Concise Notebook on the following collections:\n${{ steps.check_UAT_output_files.outputs.FAIL_CONTENT }}\n" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BOT_WEBHOOK }} - - name: Send report for OPS check - SUCCESS - uses: slackapi/slack-github-action@v1.21.0 + steps.check_UAT_output_files.outputs.FAIL_EXISTS == 'true' + run: | + echo "SLACK_REPORT_CONTENT=${{ env.SLACK_REPORT_CONTENT }}\nJupyter-test UAT result: FAILURE\nFailed to run Concise Notebook on the following collections:\n${{ steps.check_UAT_output_files.outputs.FAIL_CONTENT }}\n" >> $GITHUB_ENV + ${{ env.SLACK_REPORT_CONTENT }} += "Jupyter-test UAT result: FAILURE\nFailed to run Concise Notebook on the following collections:\n${{ steps.check_UAT_output_files.outputs.FAIL_CONTENT }}\n" + - name: Slack Report update - Add info for OPS check - SUCCESS if: | - steps.check_OPS_output_files.outputs.SUCCESS_EXISTS == 'true' - with: - payload: | - { - "status": "Jupyter-test OPS result: SUCCESS\nSuccessfully ran Concise Notebook on the following collections:\n${{ steps.check_OPS_output_files.outputs.SUCCESS_CONTENT }}\n" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BOT_WEBHOOK }} - - name: Send report for OPS check - FAILURE - uses: slackapi/slack-github-action@v1.21.0 + steps.check_OPS_output_files.outputs.SUCCESS_EXISTS == 'true' + run: | + echo "SLACK_REPORT_CONTENT=${{ env.SLACK_REPORT_CONTENT }}\nJupyter-test OPS result: SUCCESS\nSuccessfully ran Concise Notebook on the following collections:\n${{ steps.check_OPS_output_files.outputs.SUCCESS_CONTENT }}\n" >> $GITHUB_ENV + - name: Slack Report update - Add info for OPS check - FAILURE if: | - steps.check_OPS_output_files.outputs.FAIL_EXISTS == 'true' - with: - payload: | - { - "status": "Jupyter-test OPS result: FAILURE\nFailed to run Concise Notebook on the following collections:\n${{ steps.check_OPS_output_files.outputs.FAIL_CONTENT }}\n" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BOT_WEBHOOK }} - - name: Add link to slack report + steps.check_OPS_output_files.outputs.FAIL_EXISTS == 'true' + run: | + echo "SLACK_REPORT_CONTENT=${{ env.SLACK_REPORT_CONTENT }}\nJupyter-test OPS result: FAILURE\nFailed to run Concise Notebook on the following collections:\n${{ steps.check_OPS_output_files.outputs.FAIL_CONTENT }}\n" >> $GITHUB_ENV + - name: Slack Report update - Add action link on Failure + if: | + steps.check_UAT_output_files.outputs.FAIL_EXISTS == 'true' || + steps.check_OPS_output_files.outputs.FAIL_EXISTS == 'true' + run: | + echo "SLACK_REPORT_CONTENT=${{ env.SLACK_REPORT_CONTENT }}\nExecution link:\ngithub.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV + echo ${{ env.SLACK_REPORT_CONTENT }} + - name: Send Report to Slack uses: slackapi/slack-github-action@v1.21.0 if: | - steps.check_UAT_output_files.outputs.SUCCESS_EXISTS == 'true' || - steps.check_UAT_output_files.outputs.FAIL_EXISTS == 'true' || - steps.check_OPS_output_files.outputs.SUCCESS_EXISTS == 'true' || - steps.check_OPS_output_files.outputs.FAIL_EXISTS == 'true' + env.SLACK_REPORT_CONTENT != '' with: payload: | { - "status": "Execution link:\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + "status": "${{ env.SLACK_REPORT_CONTENT }}" } env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BOT_WEBHOOK }}