-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add terraform setup retry mechanism
Signed-off-by: Yang Chiu <[email protected]>
- Loading branch information
Showing
10 changed files
with
92 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
# terminate any terraform processes | ||
TERRAFORM_PIDS=( `ps aux | grep -i terraform | grep -v grep | awk '{printf("%s ",$1)}'` ) | ||
if [[ -n ${TERRAFORM_PIDS[@]} ]] ; then | ||
for PID in "${TERRAFORM_PIDS[@]}"; do | ||
kill "${TERRAFORM_PIDS}" | ||
done | ||
fi | ||
cleanup(){ | ||
# terminate any terraform processes | ||
TERRAFORM_PIDS=( `ps aux | grep -i terraform | grep -v grep | grep -v terraform-setup | awk '{printf("%s ",$1)}'` ) | ||
if [[ -n ${TERRAFORM_PIDS[@]} ]] ; then | ||
for PID in "${TERRAFORM_PIDS[@]}"; do | ||
kill "${TERRAFORM_PIDS}" | ||
done | ||
fi | ||
|
||
# wait 30 seconds for graceful terraform termination | ||
sleep 30 | ||
# wait 30 seconds for graceful terraform termination | ||
sleep 30 | ||
|
||
if [[ ${TF_VAR_k8s_distro_name} == "aks" ]] || [[ ${TF_VAR_k8s_distro_name} == "eks" ]]; then | ||
DISTRO=${TF_VAR_k8s_distro_name} | ||
fi | ||
if [[ ${TF_VAR_k8s_distro_name} == "aks" ]] || [[ ${TF_VAR_k8s_distro_name} == "eks" ]]; then | ||
DISTRO=${TF_VAR_k8s_distro_name} | ||
fi | ||
|
||
terraform -chdir=${TF_VAR_tf_workspace}/terraform/${LONGHORN_TEST_CLOUDPROVIDER}/${DISTRO} destroy -auto-approve -no-color | ||
terraform -chdir=${TF_VAR_tf_workspace}/terraform/${LONGHORN_TEST_CLOUDPROVIDER}/${DISTRO} destroy -auto-approve -no-color | ||
} | ||
|
||
if [[ "${BASH_SOURCE[0]}" -ef "$0" ]]; then | ||
cleanup | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set_kubeconfig(){ | ||
if [[ "${TF_VAR_k8s_distro_name}" == "rke" ]]; then | ||
export KUBECONFIG="test_framework/kube_config_rke.yml" | ||
elif [[ "${TF_VAR_k8s_distro_name}" == "rke2" ]]; then | ||
export KUBECONFIG="test_framework/terraform/${LONGHORN_TEST_CLOUDPROVIDER}/${DISTRO}/rke2.yaml" | ||
elif [[ "${TF_VAR_k8s_distro_name}" == "k3s" ]]; then | ||
export KUBECONFIG="test_framework/terraform/${LONGHORN_TEST_CLOUDPROVIDER}/${DISTRO}/k3s.yaml" | ||
elif [[ ${TF_VAR_k8s_distro_name} == "aks" ]]; then | ||
export KUBECONFIG="test_framework/aks.yml" | ||
elif [[ ${TF_VAR_k8s_distro_name} == "eks" ]]; then | ||
export KUBECONFIG="test_framework/eks.yml" | ||
fi | ||
} |
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
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
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
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