-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (56 loc) · 2.04 KB
/
cluster_scanner.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Cluster Scanner
on:
# For test purposes. Trigger it on pushes to the cluster-scanner branch.
push:
branches:
- cluster-scanner
# It runs every Friday, 9:30 UTC. The schedule job only works if the workflow is available in the main branch.
#schedule:
# - cron: "30 9 * * 5"
workflow_dispatch:
env:
PALETTE_API_KEY: ${{ secrets.PALETTE_API_KEY }}
PALETTE_HOST: ${{ secrets.PALETTE_HOST }}
PALETTE_PROJECT_UID: ${{ secrets.PALETTE_PROJECT_UID }}
jobs:
scan-clusters:
name: cluster-scan
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set Up Go
uses: actions/setup-go@v5
with:
go-version-file: "scripts/cluster-scanner/go.mod"
- name: Install dependencies
working-directory: scripts/cluster-scanner
run: go get ./...
- name: Execute tests
working-directory: scripts/cluster-scanner
run: go test ./...
- name: Execute the cluster scanner application
id: run_cluster_scanner
working-directory: scripts/cluster-scanner
run: go run . | tee result.log
- name: Check if clusters have been running for more than 24 hours
id: check_running_clusters
working-directory: scripts/cluster-scanner
run: |
if grep -q "The following clusters have been running for more than 24 hours" result.log; then
echo "CLUSTERS_FOUND=true" >> $GITHUB_ENV
fi
- name: Send Slack notification
if: env.CLUSTERS_FOUND == 'true'
uses: rtCamp/[email protected]
with:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_TOKEN: ${{ secrets.SLACK_PRIVATE_TEAM_TOKEN }}
#SLACK_WEBHOOK: ${{ secrets.SLACK_PRIVATE_TEAM_WEBHOOK }}
SLACK_USERNAME: "spectromate"
SLACK_ICON_EMOJI: ":robot_face:"
SLACK_COLOR: "good"
SLACKIFY_MARKDOWN: true
ENABLE_ESCAPES: true
MESSAGE: |
$(cat scripts/cluster-scanner/result.log)