From a66597e7131c51d4e817849e14480f152caeea36 Mon Sep 17 00:00:00 2001 From: Jacob Shandling Date: Tue, 24 Dec 2024 15:25:03 -0800 Subject: [PATCH 1/4] generate Slack notfication if any of the 3 verify fleetd-base steps fail --- .github/workflows/verify-fleetd-base.yml | 90 ++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 6 deletions(-) diff --git a/.github/workflows/verify-fleetd-base.yml b/.github/workflows/verify-fleetd-base.yml index 7a129b7cb0ef..ef84d679dbc9 100644 --- a/.github/workflows/verify-fleetd-base.yml +++ b/.github/workflows/verify-fleetd-base.yml @@ -4,19 +4,19 @@ on: workflow_dispatch: # Manual inputs: base-url: - description: 'The base URL to download the files from' + description: "The base URL to download the files from" required: false - default: 'https://download.fleetdm.com' + default: "https://download.fleetdm.com" type: string workflow_call: inputs: base-url: - description: 'The base URL to download the files from' + description: "The base URL to download the files from" required: false - default: 'https://download.fleetdm.com' + default: "https://download.fleetdm.com" type: string schedule: - - cron: '0 5 * * *' # Nightly 5AM UTC, not at the same time as release-fleetd-base workflow + - cron: "0 5 * * *" # Nightly 5AM UTC, not at the same time as release-fleetd-base workflow # This workflow is called by release-fleetd-base workflow, so it does not have its own concurrency group. @@ -63,6 +63,31 @@ jobs: diff fleetd-base.msi fleetd-base-permalink.msi curl -o fleetd-base-permalink.pkg "$(jq --raw-output '.fleetd_base_pkg_url' meta.json)" diff fleetd-base.pkg fleetd-base-permalink.pkg + - name: Slack Notification + if: failure() + uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0 + with: + payload: | + { + "text": "${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Verify fleetd-base files > ${{ github.job}} result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ + github.run_id }}\n${{ github.event.pull_request.html_url || + github.event.head.html_url }}" + } + } + ] + } + env: + JOB_STATUS: ${{ job.status }} + EVENT_URL: ${{ github.event.pull_request.html_url || github.event.head.html_url }} + RUN_URL: https://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_G_HELP_ENGINEERING_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK verify-fleetd-base-msi: runs-on: windows-latest @@ -89,7 +114,34 @@ jobs: Start-Sleep -Seconds 5 cd "C:\Windows\System32\config\systemprofile\AppData\Local\FleetDM\Orbit\Logs" Get-ChildItem - if (!(Test-Path "C:\Windows\System32\config\systemprofile\AppData\Local\FleetDM\Orbit\Logs\orbit-osquery.log" -PathType Leaf)) { exit 1 } + if (!(Test-Path + "C:\Windows\System32\config\systemprofile\AppData\Local\FleetDM\Orbit\Logs\orbit-osquery.log" + -PathType Leaf)) { exit 1 } + - name: Slack Notification + if: failure() + uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0 + with: + payload: | + { + "text": "${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Verify fleetd-base files > ${{ github.job}} result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ + github.run_id }}\n${{ github.event.pull_request.html_url || + github.event.head.html_url }}" + } + } + ] + } + env: + JOB_STATUS: ${{ job.status }} + EVENT_URL: ${{ github.event.pull_request.html_url || github.event.head.html_url }} + RUN_URL: https://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_G_HELP_ENGINEERING_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK verify-fleetd-base-pkg: runs-on: macos-latest @@ -108,3 +160,29 @@ jobs: - name: Install fleetd-base.pkg run: | sudo installer -pkg fleetd-base.pkg -target / + + - name: Slack Notification + if: failure() + uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0 + with: + payload: | + { + "text": "${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Verify fleetd-base files > ${{ github.job}} result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ + github.run_id }}\n${{ github.event.pull_request.html_url || + github.event.head.html_url }}" + } + } + ] + } + env: + JOB_STATUS: ${{ job.status }} + EVENT_URL: ${{ github.event.pull_request.html_url || github.event.head.html_url }} + RUN_URL: https://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_G_HELP_ENGINEERING_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK From 14527e6945dcf65e0a54714fe25d3d30ac389829 Mon Sep 17 00:00:00 2001 From: Jacob Shandling Date: Tue, 24 Dec 2024 15:29:12 -0800 Subject: [PATCH 2/4] add testing failure + copy --- .github/workflows/verify-fleetd-base.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verify-fleetd-base.yml b/.github/workflows/verify-fleetd-base.yml index ef84d679dbc9..28084da6279d 100644 --- a/.github/workflows/verify-fleetd-base.yml +++ b/.github/workflows/verify-fleetd-base.yml @@ -41,6 +41,7 @@ jobs: - name: Verify checksums run: | + exit 1 curl -O ${{ env.BASE_URL }}/stable/meta.json curl -O ${{ env.BASE_URL }}/stable/fleetd-base.msi fleetd_base_msi_sha256=$(shasum -a 256 fleetd-base.msi | cut -d ' ' -f 1) @@ -75,7 +76,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "Verify fleetd-base files > ${{ github.job}} result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ + "text": " Verify fleetd-base files > ${{ github.job}} result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}" } From 11afbdeff1f3a8f59017b3953c2090ab644782c2 Mon Sep 17 00:00:00 2001 From: Jacob Shandling Date: Tue, 24 Dec 2024 15:33:10 -0800 Subject: [PATCH 3/4] trigger on pushing this branch --- .github/workflows/verify-fleetd-base.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/verify-fleetd-base.yml b/.github/workflows/verify-fleetd-base.yml index 28084da6279d..470040327448 100644 --- a/.github/workflows/verify-fleetd-base.yml +++ b/.github/workflows/verify-fleetd-base.yml @@ -1,6 +1,9 @@ name: Verify fleetd-base files at https://download.fleetdm.com on: + push: + branches: + - 24531-verify-fleetd-failure-slack-notifier workflow_dispatch: # Manual inputs: base-url: From 9221cb4e0afddd27f722cdb669a92a71608e68ac Mon Sep 17 00:00:00 2001 From: Jacob Shandling Date: Tue, 24 Dec 2024 15:34:25 -0800 Subject: [PATCH 4/4] remove test triggering, failure, and copy --- .github/workflows/verify-fleetd-base.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/verify-fleetd-base.yml b/.github/workflows/verify-fleetd-base.yml index 470040327448..ef84d679dbc9 100644 --- a/.github/workflows/verify-fleetd-base.yml +++ b/.github/workflows/verify-fleetd-base.yml @@ -1,9 +1,6 @@ name: Verify fleetd-base files at https://download.fleetdm.com on: - push: - branches: - - 24531-verify-fleetd-failure-slack-notifier workflow_dispatch: # Manual inputs: base-url: @@ -44,7 +41,6 @@ jobs: - name: Verify checksums run: | - exit 1 curl -O ${{ env.BASE_URL }}/stable/meta.json curl -O ${{ env.BASE_URL }}/stable/fleetd-base.msi fleetd_base_msi_sha256=$(shasum -a 256 fleetd-base.msi | cut -d ' ' -f 1) @@ -79,7 +75,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": " Verify fleetd-base files > ${{ github.job}} result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ + "text": "Verify fleetd-base files > ${{ github.job}} result: ${{ job.status }}\nhttps://github.com/fleetdm/fleet/actions/runs/${{ github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head.html_url }}" }