From 87ef093a607a8175da59fbe864ac6fb11d4696ec Mon Sep 17 00:00:00 2001 From: Clare So Date: Fri, 18 Aug 2023 11:19:56 -0400 Subject: [PATCH 1/6] Add requirements --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..be2b74d --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +PyYAML==6.0.1 From 39b95d6ebe911e749be733b56c8056af3a1daff6 Mon Sep 17 00:00:00 2001 From: Clare So Date: Fri, 18 Aug 2023 11:28:08 -0400 Subject: [PATCH 2/6] Diagnostics --- .github/workflows/demo-slack.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/demo-slack.yml b/.github/workflows/demo-slack.yml index 14cc5d3..fc62a9f 100644 --- a/.github/workflows/demo-slack.yml +++ b/.github/workflows/demo-slack.yml @@ -21,6 +21,9 @@ jobs: - name: Run telemetry probe expiry check run: python ./check_metrics.py -p focus-ios + - name: Run telemetry probe expiry check + run: cat ./slack-payload.json + - name: Demo Slack Message id: slack uses: slackapi/slack-github-action@v1.24.0 From 194c7a467010cddc1b321a635c4c30dc62919997 Mon Sep 17 00:00:00 2001 From: Clare So Date: Mon, 11 Sep 2023 10:53:40 -0400 Subject: [PATCH 3/6] Path refactor --- .github/workflows/demo-slack.yml | 8 ++++---- check_metrics.ini => telemetry-expiry/check_metrics.ini | 0 check_metrics.py => telemetry-expiry/check_metrics.py | 0 requirements.txt => telemetry-expiry/requirements.txt | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename check_metrics.ini => telemetry-expiry/check_metrics.ini (100%) rename check_metrics.py => telemetry-expiry/check_metrics.py (100%) rename requirements.txt => telemetry-expiry/requirements.txt (100%) diff --git a/.github/workflows/demo-slack.yml b/.github/workflows/demo-slack.yml index fc62a9f..4b50eaa 100644 --- a/.github/workflows/demo-slack.yml +++ b/.github/workflows/demo-slack.yml @@ -16,19 +16,19 @@ jobs: uses: actions/setup-python@v1 - name: Install requirements - run: pip install -r requirements.txt + run: pip install -r ./telemetry-expiry/requirements.txt - name: Run telemetry probe expiry check - run: python ./check_metrics.py -p focus-ios + run: python ./telemetry-expiry/check_metrics.py -p focus-ios - name: Run telemetry probe expiry check - run: cat ./slack-payload.json + run: ls -la - name: Demo Slack Message id: slack uses: slackapi/slack-github-action@v1.24.0 with: - payload-file-path: "./slack-payload.json" + payload-file-path: "./telemetry-expiry/slack-payload.json" env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_TEST_ALERTS_SANDBOX }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK diff --git a/check_metrics.ini b/telemetry-expiry/check_metrics.ini similarity index 100% rename from check_metrics.ini rename to telemetry-expiry/check_metrics.ini diff --git a/check_metrics.py b/telemetry-expiry/check_metrics.py similarity index 100% rename from check_metrics.py rename to telemetry-expiry/check_metrics.py diff --git a/requirements.txt b/telemetry-expiry/requirements.txt similarity index 100% rename from requirements.txt rename to telemetry-expiry/requirements.txt From e4e562b653a427871ff30e92f2dceddd29b881ff Mon Sep 17 00:00:00 2001 From: Clare So Date: Mon, 11 Sep 2023 10:55:41 -0400 Subject: [PATCH 4/6] Fix path --- telemetry-expiry/check_metrics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telemetry-expiry/check_metrics.py b/telemetry-expiry/check_metrics.py index 43e77e0..be0a594 100644 --- a/telemetry-expiry/check_metrics.py +++ b/telemetry-expiry/check_metrics.py @@ -15,7 +15,7 @@ import yaml -CONFIG_INI = 'check_metrics.ini' +CONFIG_INI = 'telemetry-expiry/check_metrics.ini' PAYLOAD_JSON = 'slack-payload.json' WARN_THRESHOLD_DAYS = 7 expired_already = [] From c03381d87d95717abb14249aabf34714de496831 Mon Sep 17 00:00:00 2001 From: Clare So Date: Mon, 11 Sep 2023 10:57:39 -0400 Subject: [PATCH 5/6] Fix slack payload path --- .github/workflows/demo-slack.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/demo-slack.yml b/.github/workflows/demo-slack.yml index 4b50eaa..496e247 100644 --- a/.github/workflows/demo-slack.yml +++ b/.github/workflows/demo-slack.yml @@ -18,6 +18,7 @@ jobs: - name: Install requirements run: pip install -r ./telemetry-expiry/requirements.txt + # Temporary hard code project - name: Run telemetry probe expiry check run: python ./telemetry-expiry/check_metrics.py -p focus-ios @@ -28,7 +29,7 @@ jobs: id: slack uses: slackapi/slack-github-action@v1.24.0 with: - payload-file-path: "./telemetry-expiry/slack-payload.json" + payload-file-path: "./slack-payload.json" env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_TEST_ALERTS_SANDBOX }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK From d8bcb2a188e64ae65795c5976689a66301332a63 Mon Sep 17 00:00:00 2001 From: Clare So Date: Mon, 11 Sep 2023 11:02:50 -0400 Subject: [PATCH 6/6] Set up cron job --- .github/workflows/demo-slack.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo-slack.yml b/.github/workflows/demo-slack.yml index 496e247..ae0458d 100644 --- a/.github/workflows/demo-slack.yml +++ b/.github/workflows/demo-slack.yml @@ -1,9 +1,9 @@ name: Send custom JSON data to Slack workflow +# Tues @4am UTC on: - push: - branches: - - slack-demo + schedule: + - cron: "0 4 * * 2" jobs: build: