-
Notifications
You must be signed in to change notification settings - Fork 6
47 lines (39 loc) · 1.74 KB
/
check_eks_cluster_update.yml
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
name: Check for EKS cluster updates
on:
workflow_dispatch:
schedule:
- cron: "0 13 * * 1" # 1pm Monday UTC
env:
AWS_DEFAULT_REGION: ca-central-1
EKS_CLUSTER_NAME: notification-canada-ca-staging-eks-cluster
jobs:
check-eks-cluster-update:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
with:
aws-access-key-id: ${{ secrets.STAGING_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Get latest cluster version
id: latest
run: |
LATEST_VERSION="$(aws eks describe-addon-versions \
| jq -r ".addons[] | .addonVersions[] | .compatibilities[] | .clusterVersion" \
| sort -r \
| head -1)"
echo "version=${LATEST_VERSION}" >> "$GITHUB_OUTPUT"
- name: Get Staging cluster version
id: current
run: |
CLUSTER_VERSION="$(aws eks describe-cluster \
--name ${{ env.EKS_CLUSTER_NAME }} \
--query 'cluster.version' --output text)"
echo "version=${CLUSTER_VERSION}" >> "$GITHUB_OUTPUT"
- name: Post to slack
if: steps.latest.outputs.version != steps.current.outputs.version
#checkov:skip=CKV_GHA_3:This is an expected use of curl
run: |
json='{"blocks":[{"type":"section","text":{"type":"mrkdwn","text":":kubernetes: Kubernetes cluster update available: <https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html|${{ steps.latest.outputs.version }}>"}}]}'
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.NOTIFY_DEV_SLACK_WEBHOOK }}