From 49e6828688c3f86abc97d5aa482b546359a2af27 Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Fri, 12 Feb 2021 15:00:53 -0600 Subject: [PATCH 1/9] Nightly build posts results to slack app --- .github/workflows/nightly.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cedec8aa6..f264faaa9 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -33,3 +33,12 @@ jobs: env: SSH_AUTH_SOCK: /tmp/ssh_agent.sock run: tox -e nightly # Run tox using latest master branch from py42/c42eventextractor + - name: Notify Slack Action + uses: ravsamhq/notify-slack-action@v1.1 + if: always() + with: + status: ${{ job.status }} + notify_when: 'success,failure,warnings' + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + From 4a108a533cdf345599e1b2426b465d85d4a5108d Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Fri, 12 Feb 2021 15:21:07 -0600 Subject: [PATCH 2/9] Only notify on failure; make a change to trigger a test failure --- .github/workflows/nightly.yml | 3 +-- tests/test_bulk.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index f264faaa9..26a1fe032 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -38,7 +38,6 @@ jobs: if: always() with: status: ${{ job.status }} - notify_when: 'success,failure,warnings' + notify_when: 'failure' env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - diff --git a/tests/test_bulk.py b/tests/test_bulk.py index 6f7c56281..18c443c74 100644 --- a/tests/test_bulk.py +++ b/tests/test_bulk.py @@ -70,7 +70,7 @@ def test_generate_template_cmd_factory_when_using_defaults_returns_expected_comm def test_run_bulk_process_calls_run(bulk_processor, bulk_processor_factory): errors.ERRORED = False run_bulk_process(func_with_one_arg, None) - assert bulk_processor.run.call_count + assert bulk_processor.run.call_count == 5 def test_run_bulk_process_creates_processor(bulk_processor_factory): From 12577473e5037e1735de3b139d5d07181f723587 Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Tue, 16 Feb 2021 12:14:55 -0600 Subject: [PATCH 3/9] Try out a different action --- .github/workflows/nightly.yml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 26a1fe032..9c7c6813c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -33,11 +33,27 @@ jobs: env: SSH_AUTH_SOCK: /tmp/ssh_agent.sock run: tox -e nightly # Run tox using latest master branch from py42/c42eventextractor - - name: Notify Slack Action - uses: ravsamhq/notify-slack-action@v1.1 - if: always() - with: - status: ${{ job.status }} - notify_when: 'failure' + # - name: Notify Slack Action + # uses: ravsamhq/notify-slack-action@v1.1 + # if: always() + # with: + # status: ${{ job.status }} + # notify_when: 'failure' + # env: + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + # - name: Notify Slack Action (v2) + # uses: rtCamp/action-slack-notify@v2 + # env: + # SLACK_CHANNEL: ls-cloudwatch-alerts + # SLACK_TITLE: This is the post title :) + # SLACK_MESSAGE: this is a message hello + - name: Slack for Github actions + uses: Ilshidur/action-slack@2.0.2 env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_CHANNEL: ls-cloudwatch-alerts + SLACK_AVATAR: repository + with: + args: 'Action called: {{ GITHUB_ACTION }}' + + From 69016fd8905399bd552603133be0a4cd51f885ed Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Tue, 16 Feb 2021 12:26:48 -0600 Subject: [PATCH 4/9] Change action again --- .github/workflows/nightly.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 9c7c6813c..87ceb1093 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -41,19 +41,29 @@ jobs: # notify_when: 'failure' # env: # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + # # - name: Notify Slack Action (v2) # uses: rtCamp/action-slack-notify@v2 # env: # SLACK_CHANNEL: ls-cloudwatch-alerts # SLACK_TITLE: This is the post title :) # SLACK_MESSAGE: this is a message hello - - name: Slack for Github actions - uses: Ilshidur/action-slack@2.0.2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} - SLACK_CHANNEL: ls-cloudwatch-alerts - SLACK_AVATAR: repository + # - name: Slack for Github actions + # uses: Ilshidur/action-slack@2.0.2 + # env: + # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + # SLACK_CHANNEL: ls-cloudwatch-alerts + # SLACK_AVATAR: repository + # if: failure() + # with: + # args: 'Action called: {{ GITHUB_ACTION }}' + - name: ACTION-SLACK + uses: 8398a7/action-slack@v3 with: - args: 'Action called: {{ GITHUB_ACTION }}' + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: always() From 3a9c12ddffe7bbe6d5d2205e888594263768b257 Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Tue, 16 Feb 2021 12:33:00 -0600 Subject: [PATCH 5/9] Tweak the fields displayed in slack message --- .github/workflows/nightly.yml | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 87ceb1093..576652286 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -33,35 +33,11 @@ jobs: env: SSH_AUTH_SOCK: /tmp/ssh_agent.sock run: tox -e nightly # Run tox using latest master branch from py42/c42eventextractor - # - name: Notify Slack Action - # uses: ravsamhq/notify-slack-action@v1.1 - # if: always() - # with: - # status: ${{ job.status }} - # notify_when: 'failure' - # env: - # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - # - # - name: Notify Slack Action (v2) - # uses: rtCamp/action-slack-notify@v2 - # env: - # SLACK_CHANNEL: ls-cloudwatch-alerts - # SLACK_TITLE: This is the post title :) - # SLACK_MESSAGE: this is a message hello - # - name: Slack for Github actions - # uses: Ilshidur/action-slack@2.0.2 - # env: - # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} - # SLACK_CHANNEL: ls-cloudwatch-alerts - # SLACK_AVATAR: repository - # if: failure() - # with: - # args: 'Action called: {{ GITHUB_ACTION }}' - - name: ACTION-SLACK + - name: Notify Slack Action uses: 8398a7/action-slack@v3 with: status: ${{ job.status }} - fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + fields: repo,message,commit,author,action,workflow env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} if: always() From cdfbe5a32aae3f79546fce93a0e3c077c2b91d91 Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Tue, 16 Feb 2021 12:37:29 -0600 Subject: [PATCH 6/9] Only post to slack on action failure, remove failing test --- .github/workflows/nightly.yml | 2 +- tests/test_bulk.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 576652286..fbb83ca91 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -40,6 +40,6 @@ jobs: fields: repo,message,commit,author,action,workflow env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: always() + if: failure() diff --git a/tests/test_bulk.py b/tests/test_bulk.py index 18c443c74..6f7c56281 100644 --- a/tests/test_bulk.py +++ b/tests/test_bulk.py @@ -70,7 +70,7 @@ def test_generate_template_cmd_factory_when_using_defaults_returns_expected_comm def test_run_bulk_process_calls_run(bulk_processor, bulk_processor_factory): errors.ERRORED = False run_bulk_process(func_with_one_arg, None) - assert bulk_processor.run.call_count == 5 + assert bulk_processor.run.call_count def test_run_bulk_process_creates_processor(bulk_processor_factory): From 4653a5b25140845ed7158beac4a6fbdbf15d42e2 Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Tue, 16 Feb 2021 12:40:12 -0600 Subject: [PATCH 7/9] Make test fail again just to verify that we are still posting failures to slack --- tests/test_bulk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_bulk.py b/tests/test_bulk.py index 6f7c56281..18c443c74 100644 --- a/tests/test_bulk.py +++ b/tests/test_bulk.py @@ -70,7 +70,7 @@ def test_generate_template_cmd_factory_when_using_defaults_returns_expected_comm def test_run_bulk_process_calls_run(bulk_processor, bulk_processor_factory): errors.ERRORED = False run_bulk_process(func_with_one_arg, None) - assert bulk_processor.run.call_count + assert bulk_processor.run.call_count == 5 def test_run_bulk_process_creates_processor(bulk_processor_factory): From 8af85fbb6a43e2ad81eac9e5292f27cd2436496b Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Tue, 16 Feb 2021 12:42:16 -0600 Subject: [PATCH 8/9] Roll back test failure --- tests/test_bulk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_bulk.py b/tests/test_bulk.py index 18c443c74..6f7c56281 100644 --- a/tests/test_bulk.py +++ b/tests/test_bulk.py @@ -70,7 +70,7 @@ def test_generate_template_cmd_factory_when_using_defaults_returns_expected_comm def test_run_bulk_process_calls_run(bulk_processor, bulk_processor_factory): errors.ERRORED = False run_bulk_process(func_with_one_arg, None) - assert bulk_processor.run.call_count == 5 + assert bulk_processor.run.call_count def test_run_bulk_process_creates_processor(bulk_processor_factory): From 7865851f83dcd4dc6b5dc09cdcca82b836d7fe5b Mon Sep 17 00:00:00 2001 From: Peter Briggs Date: Tue, 16 Feb 2021 12:47:43 -0600 Subject: [PATCH 9/9] Fix whitespace --- .github/workflows/nightly.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index fbb83ca91..7208ee10b 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -41,5 +41,3 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} if: failure() - -