diff --git a/image/cli/app-root/src/junit-xml-generator.py b/image/cli/app-root/src/junit-xml-generator.py new file mode 100644 index 0000000000..8c0570e50e --- /dev/null +++ b/image/cli/app-root/src/junit-xml-generator.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +# ***************************************************************************** +# Copyright (c) 2024 IBM Corporation and other Contributors. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# ***************************************************************************** +import argparse +import os +from junit_xml import TestSuite, TestCase + +# +# The test-cases is a command seperated list of testcasename:timetaken +# Execute: +# `python junit-xml-generator.py --test-suite-name testsuite1 --test-cases operator-catalog:54,secret-update:9 --output-dir .` +# +# +if __name__ == "__main__": + # Initialize the properties we need + parser = argparse.ArgumentParser() + + # Primary Options + parser.add_argument("--test-suite-name", required=True) + parser.add_argument("--test-cases", required=True) + parser.add_argument("--output-dir", required=True) + + args, unknown = parser.parse_known_args() + + test_cases_dict = [] + test_case_list = args.test_cases.split(',') + for test_case in test_case_list: + test_case_name = test_case.split(':')[0] + test_case_time = int(test_case.split(':')[1]) + print(f"Adding test_case: {test_case_name} with elapsed time {test_case_time}") + test_cases_dict.append(TestCase(test_case_name, test_case_name, test_case_time)) + + print(f"Creating testsuite : {args.test_suite_name}") + ts = TestSuite(args.test_suite_name, test_cases_dict) + + with open(os.path.join(args.output_dir, 'output.xml'), 'w') as f: + TestSuite.to_file(f, [ts], prettyprint=False) \ No newline at end of file diff --git a/image/cli/app-root/src/register-start.py b/image/cli/app-root/src/register-start.py index b3ba156b77..5914753515 100644 --- a/image/cli/app-root/src/register-start.py +++ b/image/cli/app-root/src/register-start.py @@ -25,11 +25,12 @@ instanceId = os.getenv("DEVOPS_ENVIRONMENT", "none") build = os.getenv("DEVOPS_BUILD_NUMBER") suite = os.getenv("DEVOPS_SUITE_NAME", "") + productId = os.getenv("PRODUCT_ID", "ibm-mas-devops") - productId = "ibm-mas-devops" channelId = "n/a" cliVersion = os.getenv("VERSION", "unknown") ansibleDevopsVersion = os.getenv("ANSIBLE_DEVOPS_VERSION", "unknown") + gitopsVersion = os.getenv("GITOPS_VERSION", "unknown") if suite == "": print ("Results not recorded because DEVOPS_SUITE_NAME is not defined") @@ -52,6 +53,7 @@ print(f"CLI Version ............ {cliVersion}") print(f"mas_devops Version ..... {ansibleDevopsVersion}") + print(f"gitops Version ......... {gitopsVersion}") print(f"Run ID ................. {runId}") print(f"Result ID .............. {resultId}") @@ -84,11 +86,12 @@ } }, '$set': { - f"products.ibm-mas-devops.productId": productId, - f"products.ibm-mas-devops.channelId": channelId, - f"products.ibm-mas-devops.version": cliVersion, - f"products.ibm-mas-devops.ansibleDevopsVersion": ansibleDevopsVersion, - f"products.ibm-mas-devops.results.{suite}": suiteSummary + f"products.{productId}.productId": productId, + f"products.{productId}.channelId": channelId, + f"products.{productId}.version": cliVersion, + f"products.{productId}.ansibleDevopsVersion": ansibleDevopsVersion, + f"products.{productId}.gitopsVersion": gitopsVersion, + f"products.{productId}.results.{suite}": suiteSummary } }, upsert=True diff --git a/image/cli/app-root/src/save-junit-to-mongo.py b/image/cli/app-root/src/save-junit-to-mongo.py index ef32ebf91f..1a3057bc83 100644 --- a/image/cli/app-root/src/save-junit-to-mongo.py +++ b/image/cli/app-root/src/save-junit-to-mongo.py @@ -26,8 +26,8 @@ build = os.getenv("DEVOPS_BUILD_NUMBER") suite = os.getenv("DEVOPS_SUITE_NAME", "") junitOutputDir = os.getenv("JUNIT_OUTPUT_DIR", "/tmp") + productId = os.getenv("PRODUCT_ID", "ibm-mas-devops") - productId = "ibm-mas-devops" channelId = "n/a" cliVersion = os.getenv("VERSION", "unknown") ansibleDevopsVersion = os.getenv("ANSIBLE_DEVOPS_VERSION", "unknown") @@ -71,7 +71,18 @@ bf = Yahoo(dict_type=dict) resultDoc = bf.data(root) - for testcase in resultDoc["testsuites"]["testsuite"]["testcase"]: + if isinstance(resultDoc["testsuites"]["testsuite"]["testcase"], list) : + for testcase in resultDoc["testsuites"]["testsuite"]["testcase"]: + testcase["name"] = testcase["name"].replace("[localhost] localhost: ", "") + # Playbooks don't have ibm/mas_devops in the classname but do have /opt/app-root. + # Roles have both ibm/mas_devops and /opt/app-root. + # Guard against both and remove when required. + if "/opt/app-root/" in testcase["classname"]: + testcase["classname"] = testcase["classname"].split("/opt/app-root/")[1] + if "ibm/mas_devops/" in testcase["classname"]: + testcase["classname"] = testcase["classname"].split("ibm/mas_devops/")[1] + else: + testcase = resultDoc["testsuites"]["testsuite"]["testcase"] testcase["name"] = testcase["name"].replace("[localhost] localhost: ", "") # Playbooks don't have ibm/mas_devops in the classname but do have /opt/app-root. # Roles have both ibm/mas_devops and /opt/app-root. @@ -121,11 +132,11 @@ } }, '$set': { - f"products.ibm-mas-devops.productId": productId, - f"products.ibm-mas-devops.channelId": channelId, - f"products.ibm-mas-devops.version": cliVersion, - f"products.ibm-mas-devops.ansibleDevopsVersion": ansibleDevopsVersion, - f"products.ibm-mas-devops.results.{suite}": suiteSummary + f"products.{productId}.productId": productId, + f"products.{productId}.channelId": channelId, + f"products.{productId}.version": cliVersion, + f"products.{productId}.ansibleDevopsVersion": ansibleDevopsVersion, + f"products.{productId}.results.{suite}": suiteSummary } }, upsert=True diff --git a/image/cli/mascli/functions/gitops_cluster b/image/cli/mascli/functions/gitops_cluster index 252fbbaf26..b51adb7868 100644 --- a/image/cli/mascli/functions/gitops_cluster +++ b/image/cli/mascli/functions/gitops_cluster @@ -58,8 +58,12 @@ Cluster Promotion (Optional): --cluster-promotion-target-pr-title ${COLOR_YELLOW}CLUSTER_PROMOTION_TARGET_PR_TITLE${TEXT_RESET} The title of the PR if a PR is to be created --cluster-promotion-cluster-values ${COLOR_YELLOW}CLUSTER_PROMOTION_CLUSTER_VALUES${TEXT_RESET} A list of values in json format to update in the target git repo. -Notifications: - --slack-channel-id ${COLOR_YELLOW}SLACK_CHANNEL_ID${TEXT_RESET} Slack channel for ArgoCD to notify when an app sync has completed or failed +DevOps Details (Optional): + --devops-build-number ${COLOR_YELLOW}DEVOPS_BUILD_NUMBER${TEXT_RESET} The build number to associate with the junitreporter for each argocd app sync + --devops-mongo-uri ${COLOR_YELLOW}DEVOPS_MONGO_URI${TEXT_RESET} The Mongo uri used by the junitreporter to store test/run records + +Notifications (Optional): + --slack-channel-id ${COLOR_YELLOW}SLACK_CHANNEL_ID${TEXT_RESET} Slack channel for ArgoCD to notify when an app sync has completed or failed Other Commands: -h, --help Show this help message @@ -200,6 +204,15 @@ function gitops_cluster_noninteractive() { export CLUSTER_PROMOTION_CLUSTER_VALUES=$1 && shift ;; + + # DevOps Details + --devops-build-number) + export DEVOPS_BUILD_NUMBER=$1 && shift + ;; + --devops-mongo-uri) + export DEVOPS_MONGO_URI=$1 && shift + ;; + # IBM CIS Cert Manager --dns-provider) export DNS_PROVIDER=$1 && shift @@ -241,6 +254,10 @@ function gitops_cluster_noninteractive() { [[ -z "$SECRETS_PATH" ]] && gitops_cluster_help "SECRETS_PATH is not set" + if [[ -n "$DEVOPS_MONGO_URI" ]]; then + [[ -z "$DEVOPS_BUILD_NUMBER" ]] && gitops_cluster_help "DEVOPS_BUILD_NUMBER is not set" + fi + if [[ "$CLUSTER_PROMOTION" == "true" ]]; then [[ -z "$CLUSTER_PROMOTION_TARGET_GITHUB_PAT" ]] && gitops_cluster_help "CLUSTER_PROMOTION_TARGET_GITHUB_PAT is not set" [[ -z "$CLUSTER_PROMOTION_TARGET_GITHUB_HOST" ]] && gitops_cluster_help "CLUSTER_PROMOTION_TARGET_GITHUB_HOST is not set" @@ -354,6 +371,12 @@ function gitops_cluster() { reset_colors fi + echo "${TEXT_DIM}" + echo_h2 "DevOps Details" " " + echo_reset_dim "Devops Build Number ............. ${COLOR_MAGENTA}${DEVOPS_BUILD_NUMBER}" + echo_reset_dim "Devops Mongo Uri ................ ${COLOR_MAGENTA}${DEVOPS_MONGO_URI:0:8}" + reset_colors + # Set up secrets # --------------------------------------------------------------------------- echo @@ -367,6 +390,15 @@ function gitops_cluster() { export SECRET_NAME_CIS=${ACCOUNT_ID}${SM_DELIM}${CLUSTER_ID}${SM_DELIM}cis export SECRET_KEY_IBM_APIKEY=${SECRET_NAME_CIS}#ibm_apikey + export SECRET_NAME_DEVOPS_MONGO=${ACCOUNT_ID}${SM_DELIM}${CLUSTER_ID}${SM_DELIM}devops + export SECRET_KEY_DEVOPS_MONGO=${SECRET_NAME_DEVOPS_MONGO}#devops_mongo_uri + + if [ -n "$DEVOPS_MONGO_URI" ];then + echo "- Update DEVOPS_MONGO_URI secret" + TAGS="[{\"Key\": \"source\", \"Value\": \"gitops_cluster\"}, {\"Key\": \"account\", \"Value\": \"${ACCOUNT_ID}\"}, {\"Key\": \"cluster\", \"Value\": \"${CLUSTER_ID}\"}]" + sm_update_secret $SECRET_NAME_DEVOPS_MONGO "{\"devops_mongo_uri\": \"${DEVOPS_MONGO_URI}\"}" "${TAGS}" + fi + if [ -z $GIT_SSH ]; then export GIT_SSH="false" fi diff --git a/image/cli/mascli/functions/gitops_db2u b/image/cli/mascli/functions/gitops_db2u index 67d8db2977..a5dec9a8ce 100644 --- a/image/cli/mascli/functions/gitops_db2u +++ b/image/cli/mascli/functions/gitops_db2u @@ -127,7 +127,7 @@ function gitops_db2u_noninteractive() { [[ -z "$ACCOUNT_ID" ]] && gitops_db2u_help "ACCOUNT_ID is not set" [[ -z "$REGION" ]] && gitops_db2u_help "REGION is not set" [[ -z "$CLUSTER_ID" ]] && gitops_db2u_help "CLUSTER_ID is not set" - [[ -z "$MAS_INSTANCE_ID" ]] && gitops_cluster_help "MAS_INSTANCE_ID is not set" + [[ -z "$MAS_INSTANCE_ID" ]] && gitops_db2u_help "MAS_INSTANCE_ID is not set" if [[ "$GITHUB_PUSH" == "true" ]]; then diff --git a/image/cli/mascli/functions/gitops_dro b/image/cli/mascli/functions/gitops_dro index 8e5d92cf31..a578d209a2 100644 --- a/image/cli/mascli/functions/gitops_dro +++ b/image/cli/mascli/functions/gitops_dro @@ -140,7 +140,7 @@ function gitops_dro_noninteractive() { [[ -z "$GITOPS_WORKING_DIR" ]] && gitops_dro_help "GITOPS_WORKING_DIR is not set" [[ -z "$ACCOUNT_ID" ]] && gitops_dro_help "ACCOUNT_ID is not set" [[ -z "$CLUSTER_ID" ]] && gitops_dro_help "CLUSTER_ID is not set" - [[ -z "$REGION_ID" && -z "$SM_AWS_REGION" ]] && gitops_cluster_help "REGION_ID or SM_AWS_REGION is not set" + [[ -z "$REGION_ID" && -z "$SM_AWS_REGION" ]] && gitops_dro_help "REGION_ID or SM_AWS_REGION is not set" if [[ "$GITHUB_PUSH" == "true" ]]; then [[ -z "$GITHUB_HOST" ]] && gitops_dro_help "GITHUB_HOST is not set" diff --git a/image/cli/mascli/functions/gitops_utils b/image/cli/mascli/functions/gitops_utils index a3e078e2b9..495aea32c2 100644 --- a/image/cli/mascli/functions/gitops_utils +++ b/image/cli/mascli/functions/gitops_utils @@ -833,10 +833,14 @@ function check_argo_app_synced() { function check_argo_app_healthy() { APPLICATION=$1 - CLUSTER_WATCHER=$2 + MAX_CHECKS=$2 COUNT=0 while true; do - echo "argo:check_argo_app_healthy : Checking health status for $APPLICATION" + if [[ -n "$MAX_CHECKS" ]]; then + echo "argo:check_argo_app_healthy : Checking health status for $APPLICATION up to $MAX_CHECKS times" + else + echo "argo:check_argo_app_healthy : Checking health status for $APPLICATION with no timeout" + fi HEALTH_STATUS=$(argocd app get $APPLICATION -o json 2> /dev/null | jq -r .status.health.status) if [ "$HEALTH_STATUS" == "Healthy" ]; then echo "Health Status is Healthy" @@ -845,10 +849,10 @@ function check_argo_app_healthy() { ((COUNT++)) echo "argo:check_argo_app_healthy : Health Status is $HEALTH_STATUS, Waiting 30s before checking status again - $COUNT" sleep 30 - if ! (( $COUNT % 5 )) ; then - if [[ -n "$CLUSTER_WATCHER" ]]; then - # sync watcher as sometimes current application health status not reflected rightly (like returned empty status) - argocd_sync $CLUSTER_WATCHER + if [[ -n "$MAX_CHECKS" ]]; then + if [[ $COUNT -eq $MAX_CHECKS ]]; then + echo "argo:check_argo_app_healthy : App not healthy after $MAX_CHECKS checks, exiting" + exit 1 fi fi fi diff --git a/image/cli/mascli/templates/gitops/appset-configs/cluster/phase1/ibm-mas-cluster-base.yaml.j2 b/image/cli/mascli/templates/gitops/appset-configs/cluster/phase1/ibm-mas-cluster-base.yaml.j2 index ced34f101d..f38d23c48e 100644 --- a/image/cli/mascli/templates/gitops/appset-configs/cluster/phase1/ibm-mas-cluster-base.yaml.j2 +++ b/image/cli/mascli/templates/gitops/appset-configs/cluster/phase1/ibm-mas-cluster-base.yaml.j2 @@ -21,3 +21,9 @@ notifications: custom_labels: {{ CUSTOM_LABELS | indent(2) }} {% endif %} + +{% if DEVOPS_MONGO_URI is defined and DEVOPS_MONGO_URI !='' %} +devops: + mongo_uri: "" + build_number: {{ DEVOPS_BUILD_NUMBER }} +{% endif %} diff --git a/image/cli/mascli/templates/gitops/bootstrap/configmap.yaml b/image/cli/mascli/templates/gitops/bootstrap/configmap.yaml index 5063799856..3b4f369660 100644 --- a/image/cli/mascli/templates/gitops/bootstrap/configmap.yaml +++ b/image/cli/mascli/templates/gitops/bootstrap/configmap.yaml @@ -18,6 +18,11 @@ data: - sh - "-c" - "find . -name 'Chart.yaml' && find . -name 'values.yaml'" + init: + command: + - sh + - "-c" + - helm dependency update; generate: command: - bash diff --git a/tekton/src/pipelines/gitops/deprovision-mas-deps.yml.j2 b/tekton/src/pipelines/gitops/deprovision-mas-deps.yml.j2 index b58a533d5c..1df93d80eb 100644 --- a/tekton/src/pipelines/gitops/deprovision-mas-deps.yml.j2 +++ b/tekton/src/pipelines/gitops/deprovision-mas-deps.yml.j2 @@ -109,11 +109,40 @@ spec: - name: ignore_failure value: $(params.ignore_failure) # fails and exit once the first failure is detected {% endif %} - - name: gitops-deprovision-mongo + + # Deprovision EFS + # ------------------------------------------------------------------------- + - name: gitops-deprovision-efs {% if wait_for_deprovision == true %} runAfter: - wait-for-deprovision {% endif %} + params: + {{ lookup('template', pipeline_src_dir ~ '/taskdefs/gitops/common/secrets-params.yml.j2') | indent(8) }} + - name: cluster_name + value: $(params.cluster_name) + - name: mas_instance_id + value: $(params.mas_instance_id) + - name: cloud_provider + value: $(params.cloud_provider) + - name: avp_aws_secret_key + value: $(params.avp_aws_secret_key) + - name: avp_aws_access_key + value: $(params.avp_aws_access_key) + - name: efs_action + value: $(params.efs_action) + workspaces: + - name: configs + workspace: configs + taskRef: + kind: Task + name: gitops-deprovision-efs + + # Deprovision Mongo + # ------------------------------------------------------------------------- + - name: gitops-deprovision-mongo + runAfter: + - gitops-deprovision-efs params: - name: cluster_name value: $(params.cluster_name) @@ -139,11 +168,12 @@ spec: workspaces: - name: configs workspace: configs + + # Deprovision Kafka + # ------------------------------------------------------------------------- - name: gitops-deprovision-kafka -{% if wait_for_deprovision == true %} runAfter: - - wait-for-deprovision -{% endif %} + - gitops-deprovision-efs params: - name: cluster_name value: $(params.cluster_name) @@ -172,13 +202,11 @@ spec: - name: configs workspace: configs - # 11. Deprovision COS + # Deprovision COS # ------------------------------------------------------------------------- - name: gitops-deprovision-cos -{% if wait_for_deprovision == true %} runAfter: - - wait-for-deprovision -{% endif %} + - gitops-deprovision-efs params: {{ lookup('template', pipeline_src_dir ~ '/taskdefs/gitops/common/secrets-params.yml.j2') | indent(8) }} @@ -186,20 +214,16 @@ spec: - name: github_pat value: $(params.github_pat) - - name: cluster_name value: $(params.cluster_name) - name: account value: $(params.account) - - name: avp_aws_secret_key value: $(params.avp_aws_secret_key) - name: avp_aws_access_key value: $(params.avp_aws_access_key) - - name: mas_instance_id value: $(params.mas_instance_id) - - name: cos_action value: $(params.cos_action) - name: cos_type @@ -210,39 +234,9 @@ spec: value: $(params.ibmcloud_apikey) - name: cos_use_hmac value: $(params.cos_use_hmac) - workspaces: - name: configs workspace: configs taskRef: kind: Task name: gitops-deprovision-cos - - # Uninstall AWS Elastic File Service (EFS) - - name: gitops-deprovision-efs -{% if wait_for_deprovision == true %} - runAfter: - - wait-for-deprovision -{% endif %} - params: - {{ lookup('template', pipeline_src_dir ~ '/taskdefs/gitops/common/secrets-params.yml.j2') | indent(8) }} - - name: cluster_name - value: $(params.cluster_name) - - name: mas_instance_id - value: $(params.mas_instance_id) - - name: cloud_provider - value: $(params.cloud_provider) - - name: avp_aws_secret_key - value: $(params.avp_aws_secret_key) - - name: avp_aws_access_key - value: $(params.avp_aws_access_key) - - name: efs_action - value: $(params.efs_action) - - workspaces: - - name: configs - workspace: configs - - taskRef: - kind: Task - name: gitops-deprovision-efs diff --git a/tekton/src/pipelines/gitops/gitops-mas-cluster.yml.j2 b/tekton/src/pipelines/gitops/gitops-mas-cluster.yml.j2 index 6b705e7f42..da10aa7105 100644 --- a/tekton/src/pipelines/gitops/gitops-mas-cluster.yml.j2 +++ b/tekton/src/pipelines/gitops/gitops-mas-cluster.yml.j2 @@ -107,6 +107,9 @@ spec: - name: cluster_promotion_cluster_values type: string default: '' + - name: devops_build_number + type: string + default: '' - name: dns_provider type: string default: cis @@ -169,6 +172,9 @@ spec: - name: cluster_promotion_cluster_values value: $(params.cluster_promotion_cluster_values) + - name: devops_build_number + value: $(params.devops_build_number) + - name: ocp_cluster_domain value: $(params.ocp_cluster_domain) - name: dns_provider diff --git a/tekton/src/pipelines/gitops/gitops-mas-fvt-preparer-pipeline.yml.j2 b/tekton/src/pipelines/gitops/gitops-mas-fvt-preparer-pipeline.yml.j2 index 9fbd6e33ba..7587cae095 100644 --- a/tekton/src/pipelines/gitops/gitops-mas-fvt-preparer-pipeline.yml.j2 +++ b/tekton/src/pipelines/gitops/gitops-mas-fvt-preparer-pipeline.yml.j2 @@ -38,6 +38,8 @@ spec: type: string - name: artifactory_generic_release_url type: string + - name: artifactory_generic_logs_url + type: string - name: fvt_ansible_version type: string @@ -188,6 +190,8 @@ spec: - name: artifactory_generic_release_url value: $(params.artifactory_generic_release_url) + - name: artifactory_generic_logs_url + value: $(params.artifactory_generic_logs_url) - name: fvt_ansible_version value: $(params.fvt_ansible_version) diff --git a/tekton/src/tasks/gitops/gitops-cluster.yml.j2 b/tekton/src/tasks/gitops/gitops-cluster.yml.j2 index b2144d16a1..2eb9e93e35 100644 --- a/tekton/src/tasks/gitops/gitops-cluster.yml.j2 +++ b/tekton/src/tasks/gitops/gitops-cluster.yml.j2 @@ -63,6 +63,10 @@ spec: type: string default: '' + - name: devops_build_number + type: string + default: '' + - name: dns_provider type: string default: cis @@ -122,6 +126,9 @@ spec: value: $(params.cluster_promotion_target_pr_title) - name: CLUSTER_PROMOTION_CLUSTER_VALUES value: $(params.cluster_promotion_cluster_values) + + - name: DEVOPS_BUILD_NUMBER + value: $(params.devops_build_number) - name: DNS_PROVIDER value: $(params.dns_provider) diff --git a/tekton/src/tasks/gitops/gitops-mas-fvt-preparer.yml.j2 b/tekton/src/tasks/gitops/gitops-mas-fvt-preparer.yml.j2 index 82be77fbbe..30f63ee06e 100644 --- a/tekton/src/tasks/gitops/gitops-mas-fvt-preparer.yml.j2 +++ b/tekton/src/tasks/gitops/gitops-mas-fvt-preparer.yml.j2 @@ -69,6 +69,8 @@ spec: - name: artifactory_generic_release_url type: string + - name: artifactory_generic_logs_url + type: string - name: fvt_ansible_version type: string @@ -196,6 +198,8 @@ spec: value: $(params.fvt_image_registry) - name: ARTIFACTORY_GENERIC_RELEASE_URL value: $(params.artifactory_generic_release_url) + - name: ARTIFACTORY_GENERIC_LOGS_URL + value: $(params.artifactory_generic_logs_url) - name: FVT_ANSIBLE_VERSION value: $(params.fvt_ansible_version) - name: MAS_WORKSPACE_ID @@ -292,6 +296,12 @@ spec: - args: - |- + set -o pipefail + trap '[[ $? -eq 1 ]] && mas must-gather --directory /workspace/mustgather --extra-namespaces selenium' ERR EXIT + + export ARTIFACTORY_TOKEN=${FVT_ARTIFACTORY_TOKEN} + export ARTIFACTORY_UPLOAD_DIR=${ARTIFACTORY_GENERIC_LOGS_URL}/mas-fvt/${MAS_INSTANCE_ID}/${DEVOPS_BUILD_NUMBER} + CLI_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $CLI_DIR/functions/gitops_utils @@ -360,55 +370,84 @@ spec: SUITE_APP_NAME="suite.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" WORKSPACE_APP="${MAS_WORKSPACE_ID}.suite.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" - check_argo_app_healthy "${MONGO_CONFIG_APP}" - check_argo_app_healthy "${SLS_CONFIG_APP}" - check_argo_app_healthy "${BAS_CONFIG_APP}" - check_argo_app_healthy "${SLS_APP_NAME}" - check_argo_app_healthy "${SUITE_APP_NAME}" - check_argo_app_healthy "${WORKSPACE_APP}" + check_argo_app_healthy "${SLS_APP_NAME}" 60 #30 minutes + check_argo_app_healthy "${MONGO_CONFIG_APP}" 30 #15 minutes + check_argo_app_healthy "${SLS_CONFIG_APP}" 30 + check_argo_app_healthy "${BAS_CONFIG_APP}" 30 + check_argo_app_healthy "${SUITE_APP_NAME}" 30 + check_argo_app_healthy "${WORKSPACE_APP}" 30 fi if [[ "$LAUNCHER_ID" == "apps" ]]; then + # The following order is defined by the sync wave order in https://github.com/ibm-mas/gitops/tree/main/root-applications/ibm-mas-instance-root/templates + # First wave (has to include the prereqs cp4d, db2) + if [[ "$LAUNCHFVT_MANAGE" == "true" ]]; then + MASAPP_APP="manage.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" + check_argo_app_healthy "${MASAPP_APP}" 240 + fi + if [[ "$LAUNCHFVT_MOBILE" == "true" ]]; then + MASAPP_APP="manage.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" + check_argo_app_healthy "${MASAPP_APP}" 240 + fi + # Second wave if [[ "$LAUNCHFVT_ASSIST" == "true" ]]; then MASAPP_APP="assist.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" - check_argo_app_healthy "${MASAPP_APP}" - check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" + check_argo_app_healthy "${MASAPP_APP}" 30 + fi + if [[ "$LAUNCHFVT_VISUALINSPECTION" == "true" ]]; then + MASAPP_APP="visualinspection.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" + check_argo_app_healthy "${MASAPP_APP}" 30 fi if [[ "$LAUNCHFVT_IOT" == "true" ]]; then MASAPP_APP="iot.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" - check_argo_app_healthy "${MASAPP_APP}" - check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" + check_argo_app_healthy "${MASAPP_APP}" 240 fi if [[ "$LAUNCHFVT_MANAGE" == "true" ]]; then MASAPP_APP="manage.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" - check_argo_app_healthy "${MASAPP_APP}" - check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" + check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" 840 fi if [[ "$LAUNCHFVT_MOBILE" == "true" ]]; then MASAPP_APP="manage.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" - check_argo_app_healthy "${MASAPP_APP}" - check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" + check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" 840 fi + # Third wave + if [[ "$LAUNCHFVT_ASSIST" == "true" ]]; then + MASAPP_APP="assist.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" + check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" 60 + fi + if [[ "$LAUNCHFVT_VISUALINSPECTION" == "true" ]]; then + MASAPP_APP="visualinspection.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" + check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" 60 + fi + if [[ "$LAUNCHFVT_IOT" == "true" ]]; then + MASAPP_APP="iot.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" + check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" 10 + fi + # Fourth wave if [[ "$LAUNCHFVT_MONITOR" == "true" ]]; then MASAPP_APP="monitor.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" - check_argo_app_healthy "${MASAPP_APP}" - check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" + check_argo_app_healthy "${MASAPP_APP}" 80 fi if [[ "$LAUNCHFVT_OPTIMIZER" == "true" ]]; then MASAPP_APP="optimizer.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" - check_argo_app_healthy "${MASAPP_APP}" - check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" + check_argo_app_healthy "${MASAPP_APP}" 40 + fi + # Fifth wave + if [[ "$LAUNCHFVT_MONITOR" == "true" ]]; then + MASAPP_APP="monitor.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" + check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" 180 fi + if [[ "$LAUNCHFVT_OPTIMIZER" == "true" ]]; then + MASAPP_APP="optimizer.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" + check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" 60 + fi + # Sixth wave if [[ "$LAUNCHFVT_PREDICT" == "true" ]]; then MASAPP_APP="predict.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" - check_argo_app_healthy "${MASAPP_APP}" - check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" - fi - if [[ "$LAUNCHFVT_VISUALINSPECTION" == "true" ]]; then - MASAPP_APP="visualinspection.${CLUSTER_NAME}.${MAS_INSTANCE_ID}" - check_argo_app_healthy "${MASAPP_APP}" - check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" + check_argo_app_healthy "${MASAPP_APP}" 120 + check_argo_app_healthy "${MAS_WORKSPACE_ID}.${MASAPP_APP}" 120 fi + fi echo "argo:argocd proj windows add mas --kind deny --schedule * * * * * --duration 4h --applications *"