-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5211 from ministryofjustice/create-one-issue-for-…
…upgrades style: 💄 create one ticket per upgrade
- Loading branch information
Showing
2 changed files
with
58 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,45 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
# get supported versions | ||
VERSIONS=($(aws eks describe-addon-versions | jq -r ".addons[] | .addonVersions[] | .compatibilities[] | .clusterVersion" | sort | uniq)) | ||
|
||
# list clusters | ||
CLUSTERS=(live live-2 manager) | ||
CLUSTER=live | ||
|
||
for CLUSTER in "${CLUSTERS[@]}"; | ||
# get cluster versions | ||
CLUSTER_VERSION=$(aws eks describe-cluster --name "$CLUSTER" | jq -r '.cluster.version') | ||
|
||
for VERSION in "${VERSIONS[@]}"; | ||
do | ||
# get cluster versions | ||
CLUSTER_VERSION=$(aws eks describe-cluster --name "$CLUSTER" | jq -r '.cluster.version') | ||
|
||
for VERSION in "${VERSIONS[@]}"; | ||
do | ||
if [[ "$CLUSTER_VERSION" != "$VERSION" ]]; then | ||
if (( $(echo "$CLUSTER_VERSION < $VERSION" | bc -l) )); then # check if newer version is supported | ||
TITLE="EKS: Upgrade $CLUSTER to Kubernetes v$VERSION"; | ||
BODY=$(cat << END | ||
if [[ "$CLUSTER_VERSION" != "$VERSION" ]]; then | ||
if (( $(echo "$CLUSTER_VERSION < $VERSION" | bc -l) )); then # check if newer version is supported | ||
TITLE="EKS: Upgrade Production Clusters to Kubernetes v$VERSION"; | ||
BODY=$(cat << END | ||
## Background | ||
EKS supports Kubernetes $VERSION. The $CLUSTER cluster needs upgrading to Kubernetes $VERSION. | ||
EKS supports Kubernetes $VERSION. Our Production Clusters need upgrading to Kubernetes $VERSION. | ||
## Production Clusters Checklist: | ||
- [ ] live-2 | ||
- [ ] manager | ||
- [ ] live | ||
See [Amazon EKS Kubernetes versions](https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html) for more details. | ||
END | ||
) | ||
|
||
# get github issues and check if one already exists | ||
GITHUB_ISSUES=$(gh issue list --repo ministryofjustice/cloud-platform --state all --search "in:title \"$TITLE\"" --limit 50 --json title | jq -r "[ .[] | select(.title == \"$TITLE\") ] | length") | ||
# get github issues and check if one already exists | ||
GITHUB_ISSUES=$(gh issue list --repo ministryofjustice/cloud-platform --state all --search "in:title \"$TITLE\"" --limit 50 --json title | jq -r "[ .[] | select(.title == \"$TITLE\") ] | length") | ||
|
||
# if no issues yet, create one | ||
if (( $(echo "0 == $GITHUB_ISSUES" | bc -l) )); then | ||
echo "No issue found for $TITLE, creating one..." | ||
gh issue create --title "$TITLE" --body "$BODY" --label EPIC --repo ministryofjustice/cloud-platform | ||
else | ||
echo "Issue already exists for $TITLE, skipping..." | ||
fi | ||
# if no issues yet, create one | ||
if (( $(echo "0 == $GITHUB_ISSUES" | bc -l) )); then | ||
echo "No issue found for $TITLE, creating one..." | ||
gh issue create --title "$TITLE" --body "$BODY" --label EPIC --repo ministryofjustice/cloud-platform | ||
else | ||
echo "Issue already exists for $TITLE, skipping..." | ||
fi | ||
fi | ||
done | ||
fi | ||
done |