Skip to content

Commit

Permalink
docs: add slack notification
Browse files Browse the repository at this point in the history
  • Loading branch information
caroldelwing committed Dec 23, 2024
1 parent 9fa04ef commit 1ebb7ec
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
39 changes: 28 additions & 11 deletions .github/workflows/cluster_scanner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,37 @@ jobs:
go-version-file: "scripts/cluster-scanner/go.mod"

- name: Install dependencies
run: |
cd scripts/cluster-scanner/
go get ./...
working-directory: scripts/cluster-scanner
run: go get ./...

- name: Execute tests
run: |
cd scripts/cluster-scanner/
go test ./...
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: |
cd scripts/cluster-scanner/
go 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
# Get the output
# Ignore Slack output if there are no clusters running
# Send slack notification if output is different than what was planned
- 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)
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc

# Ignore secrets
.secrets

0 comments on commit 1ebb7ec

Please sign in to comment.