From 36ccc0e4253b0b7e0b3f8dc8a47619eee086a98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Dr=C3=A1pela?= Date: Mon, 9 Dec 2024 09:22:39 +0100 Subject: [PATCH] Fix bash --- .ibm/pipelines/cluster/aks/az.sh | 3 ++- .ibm/pipelines/cluster/aks/deployment.sh | 4 ++-- .ibm/pipelines/cluster/gke/deployment.sh | 4 ++-- .ibm/pipelines/cluster/gke/gcloud.sh | 3 ++- .ibm/pipelines/jobs/aks.sh | 1 + .ibm/pipelines/jobs/gke.sh | 1 + 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.ibm/pipelines/cluster/aks/az.sh b/.ibm/pipelines/cluster/aks/az.sh index aa9f315931..b0fbbde84a 100644 --- a/.ibm/pipelines/cluster/aks/az.sh +++ b/.ibm/pipelines/cluster/aks/az.sh @@ -21,7 +21,8 @@ az_aks_approuting_enable() { local name=$1 local resource_group=$2 set +xe - local output=$(az aks approuting enable --name $name --resource-group $resource_group 2>&1 | sed 's/^ERROR: //') + local output + output=$(az aks approuting enable --name $name --resource-group $resource_group 2>&1 | sed 's/^ERROR: //') set -xe exit_status=$? diff --git a/.ibm/pipelines/cluster/aks/deployment.sh b/.ibm/pipelines/cluster/aks/deployment.sh index 84412b7570..e40e5cc67d 100644 --- a/.ibm/pipelines/cluster/aks/deployment.sh +++ b/.ibm/pipelines/cluster/aks/deployment.sh @@ -7,7 +7,7 @@ initiate_aks_deployment() { # Renable when namespace termination issue is solved # install_tekton_pipelines uninstall_helmchart "${NAME_SPACE_K8S}" "${RELEASE_NAME}" - cd "${DIR}" + cd "${DIR}" || exit apply_yaml_files "${DIR}" "${NAME_SPACE_K8S}" yq_merge_value_files "${DIR}/value_files/${HELM_CHART_VALUE_FILE_NAME}" "${DIR}/value_files/${HELM_CHART_AKS_DIFF_VALUE_FILE_NAME}" "/tmp/${HELM_CHART_K8S_MERGED_VALUE_FILE_NAME}" mkdir -p "${ARTIFACT_DIR}/${NAME_SPACE_K8S}" @@ -27,7 +27,7 @@ initiate_rbac_aks_deployment() { # Renable when namespace termination issue is solved # install_tekton_pipelines uninstall_helmchart "${NAME_SPACE_RBAC_K8S}" "${RELEASE_NAME_RBAC}" - cd "${DIR}" + cd "${DIR}" || exit apply_yaml_files "${DIR}" "${NAME_SPACE_RBAC_K8S}" yq_merge_value_files "${DIR}/value_files/${HELM_CHART_RBAC_VALUE_FILE_NAME}" "${DIR}/value_files/${HELM_CHART_RBAC_AKS_DIFF_VALUE_FILE_NAME}" "/tmp/${HELM_CHART_RBAC_K8S_MERGED_VALUE_FILE_NAME}" mkdir -p "${ARTIFACT_DIR}/${NAME_SPACE_RBAC_K8S}" diff --git a/.ibm/pipelines/cluster/gke/deployment.sh b/.ibm/pipelines/cluster/gke/deployment.sh index 43a3ce63d7..831edb204e 100644 --- a/.ibm/pipelines/cluster/gke/deployment.sh +++ b/.ibm/pipelines/cluster/gke/deployment.sh @@ -8,7 +8,7 @@ initiate_gke_deployment() { # Renable when namespace termination issue is solved # install_tekton_pipelines uninstall_helmchart "${NAME_SPACE_K8S}" "${RELEASE_NAME}" - cd "${DIR}" + cd "${DIR}" || exit apply_yaml_files "${DIR}" "${NAME_SPACE_K8S}" oc apply -f "${DIR}/cluster/gke/frontend-config.yaml" --namespace="${project}" yq_merge_value_files "${DIR}/value_files/${HELM_CHART_VALUE_FILE_NAME}" "${DIR}/value_files/${HELM_CHART_GKE_DIFF_VALUE_FILE_NAME}" "/tmp/${HELM_CHART_K8S_MERGED_VALUE_FILE_NAME}" @@ -31,7 +31,7 @@ initiate_rbac_gke_deployment() { # Renable when namespace termination issue is solved # install_tekton_pipelines uninstall_helmchart "${NAME_SPACE_RBAC_K8S}" "${RELEASE_NAME_RBAC}" - cd "${DIR}" + cd "${DIR}" || exit apply_yaml_files "${DIR}" "${NAME_SPACE_RBAC_K8S}" yq_merge_value_files "${DIR}/value_files/${HELM_CHART_RBAC_VALUE_FILE_NAME}" "${DIR}/value_files/${HELM_CHART_RBAC_GKE_DIFF_VALUE_FILE_NAME}" "/tmp/${HELM_CHART_RBAC_K8S_MERGED_VALUE_FILE_NAME}" mkdir -p "${ARTIFACT_DIR}/${NAME_SPACE_RBAC_K8S}" diff --git a/.ibm/pipelines/cluster/gke/gcloud.sh b/.ibm/pipelines/cluster/gke/gcloud.sh index 98277180e5..1156f6b7b5 100755 --- a/.ibm/pipelines/cluster/gke/gcloud.sh +++ b/.ibm/pipelines/cluster/gke/gcloud.sh @@ -20,7 +20,8 @@ gcloud_ssl_cert_create() { # Capture both stdout and stderr set +xe - local output=$(gcloud compute ssl-certificates create "${cert_name}" --domains="${domain}" --project="${project}" --global 2>&1) + local output + output=$(gcloud compute ssl-certificates create "${cert_name}" --domains="${domain}" --project="${project}" --global 2>&1) set -xe # Check the return status diff --git a/.ibm/pipelines/jobs/aks.sh b/.ibm/pipelines/jobs/aks.sh index 506b345b76..a8fc472ae0 100644 --- a/.ibm/pipelines/jobs/aks.sh +++ b/.ibm/pipelines/jobs/aks.sh @@ -20,6 +20,7 @@ handle_aks() { API_SERVER_URL=$(oc whoami --show-server) ENCODED_API_SERVER_URL=$(echo "${API_SERVER_URL}" | base64) ENCODED_CLUSTER_NAME=$(echo "my-cluster" | base64) + export API_SERVER_URL ENCODED_API_SERVER_URL ENCODED_CLUSTER_NAME set_github_app_3_credentials diff --git a/.ibm/pipelines/jobs/gke.sh b/.ibm/pipelines/jobs/gke.sh index 9a67078d5b..842ae7e4d0 100644 --- a/.ibm/pipelines/jobs/gke.sh +++ b/.ibm/pipelines/jobs/gke.sh @@ -16,6 +16,7 @@ handle_gke() { API_SERVER_URL=$(oc whoami --show-server) ENCODED_API_SERVER_URL=$(echo "${API_SERVER_URL}" | base64) ENCODED_CLUSTER_NAME=$(echo "my-cluster" | base64) + export API_SERVER_URL ENCODED_API_SERVER_URL ENCODED_CLUSTER_NAME set_github_app_3_credentials