diff --git a/content/en/docs/ops/diagnostic-tools/istioctl-analyze/snips.sh b/content/en/docs/ops/diagnostic-tools/istioctl-analyze/snips.sh index fcc6e7fc08..45ddae4d74 100644 --- a/content/en/docs/ops/diagnostic-tools/istioctl-analyze/snips.sh +++ b/content/en/docs/ops/diagnostic-tools/istioctl-analyze/snips.sh @@ -47,7 +47,7 @@ istioctl analyze samples/bookinfo/networking/bookinfo-gateway.yaml samples/booki ! read -r -d '' snip_analyze_sample_destrule_out <<\ENDSNIP Error [IST0101] (VirtualService bookinfo.default samples/bookinfo/networking/bookinfo-gateway.yaml:39) Referenced host not found: "productpage" Error: Analyzers found issues when analyzing namespace: default. -See https://istio.io/v{{< istio_version >}}/docs/reference/config/analysis for more information about causes and resolutions. +See https://istio.io/v1.10/docs/reference/config/analysis for more information about causes and resolutions. ENDSNIP snip_analyze_networking_directory() { @@ -74,7 +74,7 @@ spec: ... status: validationMessages: - - documentation_url: https://istio.io/v{{< istio_version >}}/docs/reference/config/analysis/ist0101/?ref=status-controller + - documentation_url: https://istio.io/v1.10/docs/reference/config/analysis/ist0101/?ref=status-controller level: 3 type: code: IST0101 diff --git a/content/en/docs/ops/diagnostic-tools/istioctl-analyze/test.sh b/content/en/docs/ops/diagnostic-tools/istioctl-analyze/test.sh index 8a56fed0b2..f1b33d5669 100755 --- a/content/en/docs/ops/diagnostic-tools/istioctl-analyze/test.sh +++ b/content/en/docs/ops/diagnostic-tools/istioctl-analyze/test.sh @@ -35,11 +35,7 @@ snip_fix_default_namespace _verify_contains snip_try_with_fixed_namespace "$snip_try_with_fixed_namespace_out" echo '*** istioctl-analyze step 3 ***' -# Pull the Istio version from the docs configuration file. -ISTIO_VERSION=$(yq r "${REPO_ROOT}"/data/args.yml 'version') -# shellcheck disable=SC2001 -verify_string=$(echo "$snip_analyze_sample_destrule_out" | sed "s/{{< istio_version >}}/${ISTIO_VERSION}/") -_verify_contains snip_analyze_sample_destrule "$verify_string" +_verify_contains snip_analyze_sample_destrule "$snip_analyze_sample_destrule_out" # There are multiple DestinationRules, some are valid for the VirtualService, some lack subsets echo '*** istioctl-analyze step 4 ***' @@ -82,10 +78,7 @@ echo '*** istioctl-analyze step 10 ***' get_ratings_virtual_service() { kubectl get vs ratings -o yaml } - -# shellcheck disable=SC2001 -verify_string=$(echo "$snip_vs_yaml_with_status" | sed "s/{{< istio_version >}}/${ISTIO_VERSION}/") -_verify_elided get_ratings_virtual_service "$verify_string" +_verify_elided get_ratings_virtual_service "$snip_vs_yaml_with_status" echo '*** istioctl-analyze step 11 ***' kubectl create ns frod diff --git a/scripts/snip.py b/scripts/snip.py index fcc3b5152d..3a40b64c77 100644 --- a/scripts/snip.py +++ b/scripts/snip.py @@ -87,8 +87,10 @@ with open("data/args.yml", 'r') as stream: try: source_branch_name = docs_config['source_branch_name'] + istio_version = docs_config['version'] + istio_full_version = docs_config['full_version'] except: - sys.stderr.write('"source_branch_name" not defined in "data/args.yml"\n') + sys.stderr.write('failed to retrieve data from "data/args.yml"\n') sys.exit(1) with open(markdown, 'rt', encoding='utf-8') as mdfile: @@ -172,6 +174,8 @@ with open(markdown, 'rt', encoding='utf-8') as mdfile: print(" " + msg) if heredoc.search(line): multiline_cmd = True + line = line.replace("{{< istio_version >}}", istio_version) + line = line.replace("{{< istio_full_version >}}", istio_full_version) current_snip["script"].append(line) if len(boilerplates) > 0: