This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[skip ci] Add rendered and modified Helm chart
- Loading branch information
1 parent
32bc3da
commit d2611b7
Showing
1 changed file
with
99 additions
and
0 deletions.
There are no files selected for viewing
99 changes: 99 additions & 0 deletions
99
stakater-validate-environment/rendered/stakater-validate-environment-0.0.8.yaml
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
# Source: stakater-validate-environment/templates/clustertask.yaml | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: stakater-validate-environment-0.0.8 | ||
annotations: | ||
description: | | ||
Validate HelmRelease Status of Tronodor Environment | ||
spec: | ||
workspaces: | ||
- name: source | ||
params: | ||
- name: ENVIRONMENT_NAME | ||
description: Time in seconds to wait for environment | ||
default: "NA" | ||
- name: TIMEOUT | ||
description: Time in seconds to wait for environment | ||
default: "120" | ||
- name: RETRY_INTERVAL | ||
description: Time in seconds to get environment and check statuses | ||
default: "5" | ||
- name: PR_NUMBER | ||
description: pr number | ||
default: "NA" | ||
steps: | ||
- name: validate-environment | ||
image: stakater/pipeline-toolbox:v0.0.36 | ||
command: ["/bin/bash"] | ||
workingDir: $(workspaces.source.path) | ||
args: | ||
- -c | ||
- | | ||
if [ $(params.PR_NUMBER) != "NA" ]; then | ||
if [ $(params.ENVIRONMENT_NAME) != "NA" ]; then | ||
# Get Environment from task param | ||
environment_name="$(params.ENVIRONMENT_NAME)" | ||
else | ||
# Get Environment Name from environment file generated by create environment task | ||
environment_name=$(yq .metadata.name $(workspaces.source.path)/environment/environment.yaml ) | ||
fi | ||
echo "Checking Environment $environment_name" | ||
# Wait Until Timeout | ||
for (( t=1; t < $(params.TIMEOUT); )) | ||
do | ||
# Get Environment Status | ||
environment_status=$(oc get environment $environment_name -o jsonpath='{.status}') | ||
# Get Fields to check Environment Reconcilation | ||
condition_type=$(echo $environment_status | jq -r '.conditions[0].type') | ||
condition_status=$(echo $environment_status | jq -r '.conditions[0].status') | ||
# Check Environment Reconcilation | ||
if ([ $condition_type == "Ready" ] && [ $condition_status == "True" ]); then | ||
echo "--Environment Reconciled" | ||
echo " Checking HelmRelease" | ||
# Get Fields to check HelmRelease status | ||
helmrelease_type=$(echo $environment_status | jq -r '.helmReleaseStatus.latestCondition.type') | ||
helmrelease_status=$(echo $environment_status | jq -r '.helmReleaseStatus.latestCondition.status') | ||
gitrepository_status_type=$(echo $environment_status | jq -r '.gitRepoStatus.latestCondition.type') | ||
gitrepository_status_status=$(echo $environment_status | jq -r '.gitRepoStatus.latestCondition.status') | ||
# Check HelmRelease & GitRepository status | ||
if ([ $helmrelease_type == "Released" ] && [ $helmrelease_status == "True" ]) && ([ $gitrepository_status_type == "ArtifactInStorage" ] && [ $gitrepository_status_status == "True" ]); then | ||
echo "---HelmRelease" | ||
echo " Status:" "$helmrelease_status" | ||
echo " Type:" "$helmrelease_type" | ||
echo " Message" "$(echo $environment_status | jq '.helmReleaseStatus.latestCondition.message')" | ||
echo " Reason" "$(echo $environment_status | jq '.helmReleaseStatus.latestCondition.reason')" | ||
echo "---GitRepository" | ||
echo " Status:" "$gitrepository_status_status" | ||
echo " Type:" "$gitrepository_status_type" | ||
break | ||
else | ||
echo "---HelmRelease" | ||
echo " Status:" "$helmrelease_status" | ||
echo " Type:" "$helmrelease_type" | ||
echo " Message" "$(echo $environment_status | jq '.helmReleaseStatus.latestCondition.message')" | ||
echo " Reason" "$(echo $environment_status | jq '.helmReleaseStatus.latestCondition.reason')" | ||
echo "---GitRepository" | ||
echo " Status:" "$gitrepository_status_status" | ||
echo " Type:" "$gitrepository_status_type" | ||
fi | ||
else | ||
echo " Environment Not Reconciled" | ||
fi | ||
sleep $(params.RETRY_INTERVAL) && echo "" | ||
((t+=$(params.RETRY_INTERVAL))) | ||
done | ||
else | ||
echo "Not a PR, Environment not created" | ||
fi |