From 8020015f50d13d138a4903ce65a803fb7995e7d1 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Wed, 11 Dec 2024 19:53:14 -0500 Subject: [PATCH] [CI] Ensure auto update processes all files --- content/en/docs/zero-code/java/_index.md | 4 +-- scripts/auto-update/all-versions.sh | 41 ++++++++++++++++-------- scripts/auto-update/version-in-file.sh | 26 ++++++++++----- 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/content/en/docs/zero-code/java/_index.md b/content/en/docs/zero-code/java/_index.md index f6723a6ef0ca..665b772fb067 100644 --- a/content/en/docs/zero-code/java/_index.md +++ b/content/en/docs/zero-code/java/_index.md @@ -6,8 +6,8 @@ aliases: - /docs/languages/java/automatic_instrumentation cascade: vers: - instrumentation: 2.6.0 - otel: 1.40.0 + instrumentation: 2.10.0 + otel: 1.45.0 --- Zero-code instrumentation with Java uses a Java agent JAR or Spring Boot diff --git a/scripts/auto-update/all-versions.sh b/scripts/auto-update/all-versions.sh index f440a3afdd68..9ed93fc348b9 100755 --- a/scripts/auto-update/all-versions.sh +++ b/scripts/auto-update/all-versions.sh @@ -2,21 +2,36 @@ function auto_update_versions() { local cmd="./scripts/auto-update/version-in-file.sh" - local updates=( - "opentelemetry-collector-releases vers content/en/docs/collector/_index.md" - "opentelemetry-collector-releases collector_vers content/en/docs/security/_index.md" - "opentelemetry-java otel content/en/docs/languages/java/_index.md" - "opentelemetry-java otel content/en/docs/zero-code/java/_index.md" - "opentelemetry-java-instrumentation instrumentation content/en/docs/languages/java/_index.md" - "opentelemetry-java-instrumentation instrumentation content/en/docs/zero-code/java/_index.md" - "opentelemetry-java-contrib contrib content/en/docs/languages/java/_index.md" - "opentelemetry-specification spec scripts/content-modules/adjust-pages.pl .gitmodules" - "opentelemetry-proto otlp scripts/content-modules/adjust-pages.pl .gitmodules" - "semantic-conventions semconv scripts/content-modules/adjust-pages.pl .gitmodules" - "semantic-conventions-java semconv content/en/docs/languages/java/_index.md" + local repo_and_files_to_update=( + + # Format of an entry is + # "repo-name regex file-name [regex file-name...]" + + "opentelemetry-collector-releases + vers content/en/docs/collector/_index.md + collector_vers content/en/docs/security/_index.md" + "opentelemetry-java + otel content/en/docs/languages/java/_index.md + otel content/en/docs/zero-code/java/_index.md" + "opentelemetry-java-instrumentation + instrumentation content/en/docs/languages/java/_index.md + instrumentation content/en/docs/zero-code/java/_index.md" + "opentelemetry-java-contrib + contrib content/en/docs/languages/java/_index.md" + "opentelemetry-specification + spec scripts/content-modules/adjust-pages.pl + spec .gitmodules" + "opentelemetry-proto + otlp scripts/content-modules/adjust-pages.pl + otlp .gitmodules" + "semantic-conventions + semconv scripts/content-modules/adjust-pages.pl + semconv .gitmodules" + "semantic-conventions-java + semconv content/en/docs/languages/java/_index.md" ) - for args in "${updates[@]}"; do + for args in "${repo_and_files_to_update[@]}"; do echo "> $cmd $args" $cmd $args echo diff --git a/scripts/auto-update/version-in-file.sh b/scripts/auto-update/version-in-file.sh index 96c4e2d93f42..1a6662cfd36e 100755 --- a/scripts/auto-update/version-in-file.sh +++ b/scripts/auto-update/version-in-file.sh @@ -17,18 +17,22 @@ else shift fi -repo=$1 -variable_name=$2 -file_names=("${@:3}") # remaining args - +repo=$1; shift; latest_version=$(gh api -q .tag_name "repos/open-telemetry/$repo/releases/latest") latest_vers_no_v="${latest_version#v}" # Remove leading 'v' echo "REPO: $repo" echo "LATEST VERSION: $latest_version" -for file_name in "${file_names[@]}" -do +function process_file() { + local name="$1" + local file_path="$2" + + if [[ -z "$file_path" ]]; then + echo "ERROR: Missing name or file path for processing." >&2 + return 1 + fi + # Version line regex `vers_match_regex` to match version specifier -- works under Linux and macOS. if [[ $file_name == ".gitmodules" ]]; then vers_match_regex="$variable_name-pin =" @@ -50,6 +54,12 @@ do if [[ -e "$file_name".bak ]]; then rm "$file_name".bak fi +} + +while [[ $# -gt 0 ]]; do + variable_name=$1; shift; + file_name=$1; shift; + process_file $variable_name $file_name done if git diff --quiet "${file_names[@]}"; then @@ -76,8 +86,8 @@ if [ "$existing_pr_count" -gt 0 ]; then fi if [[ "$repo" == "opentelemetry-specification" - || "$repo" == "opentelemetry-proto" - || "$repo" == "semantic-conventions" ]]; then + || "$repo" == "opentelemetry-proto" + || "$repo" == "semantic-conventions" ]]; then echo "Switching to $repo at tag $latest_version" ( set -x; npm run get:submodule -- content-modules/$repo &&