From a1bd433b87a0e4be76c334149990bc468c14e9cc Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 13:41:13 +0200 Subject: [PATCH 01/11] Downgrade versions for testing --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7f49d27b..1ddc3427 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,13 +14,13 @@ opentelemetryJavaagentAlpha = "2.4.0-alpha" # otel contrib # updated from upstream agent with .ci/update-upstream.sh -opentelemetryContribAlpha = "1.36.0-alpha" +opentelemetryContribAlpha = "1.33.0-alpha" # otel semconv # updated from upstream agent with .ci/update-upstream.sh # While the semconv stable artifact is provided transitively by the agent, we still have to explicitly # reference the "incubating" version explicitly -opentelemetrySemconvAlpha = "1.25.0-alpha" +opentelemetrySemconvAlpha = "1.24.0-alpha" [libraries] From b91467c549ba9b646af9937abdb5c5929a66379d Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 11:51:05 +0200 Subject: [PATCH 02/11] Add update-cli config for updateing upstream agent --- .ci/updatecli.d/bump-version.yml | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .ci/updatecli.d/bump-version.yml diff --git a/.ci/updatecli.d/bump-version.yml b/.ci/updatecli.d/bump-version.yml new file mode 100644 index 00000000..37e9469c --- /dev/null +++ b/.ci/updatecli.d/bump-version.yml @@ -0,0 +1,34 @@ +name: Upgrade the upstream agent version and related transitive dependencies + +sources: + + otel-agent-version: + kind: githubrelease + spec: + owner: open-telemetry + repository: opentelemetry-java-instrumentation + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + typefilter: + latest: true + transformers: + - trimprefix: "v" + + semconv-version: + dependson: [otel-agent-version] + kind: file + spec: + file: https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation/v{{ source "otel-agent-version" }}/dependencyManagement/build.gradle.kts + transformers: + - findsubmatch: + pattern: val\s+semConvVersion\s*=\s*"([^"]*) + captureindex: 1 + + contrib-version: + dependson: [otel-agent-version] + kind: file + spec: + file: https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation/v{{ source "otel-agent-version" }}/dependencyManagement/build.gradle.kts + transformers: + - findsubmatch: + pattern: val\s+otelContribVersion\s*=\s*"([^"]*) + captureindex: 1 From 5b3d1e94221d057609a98672362f3a14200d4631 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 13:38:51 +0200 Subject: [PATCH 03/11] Enabled updates --- .ci/updatecli.d/bump-version.yml | 71 +++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/.ci/updatecli.d/bump-version.yml b/.ci/updatecli.d/bump-version.yml index 37e9469c..17b17136 100644 --- a/.ci/updatecli.d/bump-version.yml +++ b/.ci/updatecli.d/bump-version.yml @@ -1,8 +1,20 @@ name: Upgrade the upstream agent version and related transitive dependencies +scms: + githubConfig: + kind: github + spec: + user: '{{ requiredEnv "GITHUB_ACTOR" }}' + owner: JonasKunz + repository: elastic-otel-java + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + username: '{{ requiredEnv "GITHUB_ACTOR" }}' + branch: main + commitusingapi: true + sources: - otel-agent-version: + upstream-agent-version: kind: githubrelease spec: owner: open-telemetry @@ -13,22 +25,71 @@ sources: transformers: - trimprefix: "v" + distro-otel-agent-version: + kind: toml + scmid: githubConfig + spec: + file: gradle/libs.versions.toml + key: versions.opentelemetryJavaagentAlpha + semconv-version: - dependson: [otel-agent-version] + dependson: [upstream-agent-version] kind: file spec: - file: https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation/v{{ source "otel-agent-version" }}/dependencyManagement/build.gradle.kts + file: https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation/v{{ source "upstream-agent-version" }}/dependencyManagement/build.gradle.kts transformers: - findsubmatch: pattern: val\s+semConvVersion\s*=\s*"([^"]*) captureindex: 1 contrib-version: - dependson: [otel-agent-version] + dependson: [upstream-agent-version] kind: file spec: - file: https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation/v{{ source "otel-agent-version" }}/dependencyManagement/build.gradle.kts + file: https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation/v{{ source "upstream-agent-version" }}/dependencyManagement/build.gradle.kts transformers: - findsubmatch: pattern: val\s+otelContribVersion\s*=\s*"([^"]*) captureindex: 1 + +conditions: + update-required: + disablesourceinput: true + kind: shell + spec: + command: test "{{ source "upstream-agent-version" }}-alpha" != "{{ source "distro-otel-agent-version" }}" + +targets: + + update-agent-version: + name: "Update upstream OpenTelemetry agent version" + conditionids: [update-required] + sourceid: upstream-agent-version + kind: file # toml action currently erases comments, so we fallback to regex-replace + scmid: githubConfig + spec: + file: gradle/libs.versions.toml + matchpattern: (opentelemetryJavaagentAlpha\s*=\s*)"(.*)" + replacepattern: $1"{{ source "upstream-agent-version" }}-alpha" + + update-contrib-version: + name: "Update OpenTelemetry Contrib version" + conditionids: [update-required] + sourceid: contrib-version + kind: file # toml action currently erases comments, so we fallback to regex-replace + scmid: githubConfig + spec: + file: gradle/libs.versions.toml + matchpattern: (opentelemetryContribAlpha\s*=\s*)"(.*)" + replacepattern: $1"{{ source "contrib-version" }}" + + update-semconv-version: + name: "Update OpenTelemetry SemConv version" + conditionids: [update-required] + sourceid: semconv-version + kind: file # toml action currently erases comments, so we fallback to regex-replace + scmid: githubConfig + spec: + file: gradle/libs.versions.toml + matchpattern: (opentelemetrySemconvAlpha\s*=\s*)"(.*)" + replacepattern: $1"{{ source "semconv-version" }}" From ab8eab07608aa435c99fe05b6619f2547ff8dc24 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 13:47:37 +0200 Subject: [PATCH 04/11] Change to elastic repo --- .ci/updatecli.d/bump-version.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.ci/updatecli.d/bump-version.yml b/.ci/updatecli.d/bump-version.yml index 17b17136..86acccc7 100644 --- a/.ci/updatecli.d/bump-version.yml +++ b/.ci/updatecli.d/bump-version.yml @@ -1,11 +1,14 @@ name: Upgrade the upstream agent version and related transitive dependencies +# This task +# - checks if the current otel-agent version referenced by the distro is the latest release +# - if not, it will update the agent version AND the semconv and contrib versions to match the upstream scms: githubConfig: kind: github spec: user: '{{ requiredEnv "GITHUB_ACTOR" }}' - owner: JonasKunz + owner: elastic repository: elastic-otel-java token: '{{ requiredEnv "GITHUB_TOKEN" }}' username: '{{ requiredEnv "GITHUB_ACTOR" }}' @@ -93,3 +96,16 @@ targets: file: gradle/libs.versions.toml matchpattern: (opentelemetrySemconvAlpha\s*=\s*)"(.*)" replacepattern: $1"{{ source "semconv-version" }}" + + +actions: + open-pr: + kind: github/pullrequest + scmid: githubConfig + title: 'Update upstream OpenTelemetry agent dependencies to {{ source "upstream-agent-version" }}' + spec: + automerge: false + labels: + - dependencies + description: | + @elastic/apm-agent-java, can you please approve and merge this PR? From e86ddb161e7215426e6322f665367fbe5e17578e Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 13:53:14 +0200 Subject: [PATCH 05/11] Added GH action --- ...on.yml => bump-upstream-agent-version.yml} | 2 +- .github/workflows/updatecli.yml | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) rename .ci/updatecli.d/{bump-version.yml => bump-upstream-agent-version.yml} (99%) create mode 100644 .github/workflows/updatecli.yml diff --git a/.ci/updatecli.d/bump-version.yml b/.ci/updatecli.d/bump-upstream-agent-version.yml similarity index 99% rename from .ci/updatecli.d/bump-version.yml rename to .ci/updatecli.d/bump-upstream-agent-version.yml index 86acccc7..d574d7a1 100644 --- a/.ci/updatecli.d/bump-version.yml +++ b/.ci/updatecli.d/bump-upstream-agent-version.yml @@ -8,7 +8,7 @@ scms: kind: github spec: user: '{{ requiredEnv "GITHUB_ACTOR" }}' - owner: elastic + owner: JonasKunz repository: elastic-otel-java token: '{{ requiredEnv "GITHUB_TOKEN" }}' username: '{{ requiredEnv "GITHUB_ACTOR" }}' diff --git a/.github/workflows/updatecli.yml b/.github/workflows/updatecli.yml new file mode 100644 index 00000000..455c74f2 --- /dev/null +++ b/.github/workflows/updatecli.yml @@ -0,0 +1,32 @@ +name: updatecli + +on: + workflow_dispatch: ~ + #schedule: + # - cron: '0 6 * * *' + +#permissions: +# contents: read + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + #- uses: actions/setup-java@v4 + # with: + # java-version: 11 + # distribution: temurin + + - uses: elastic/oblt-actions/updatecli/run@v1 + with: + command: "--experimental apply --config .ci/updatecli.d" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + #- if: failure() + # uses: elastic/oblt-actions/slack/send@v1 + # with: + # bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + # channel-id: "#apm-agent-java" + # message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @robots-ci please look what's going on " From d6e86c8c1aa2ec9e2780f5550b53ca15c83ce516 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 14:02:02 +0200 Subject: [PATCH 06/11] Try to prevent overrides --- .ci/updatecli.d/bump-upstream-agent-version.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ci/updatecli.d/bump-upstream-agent-version.yml b/.ci/updatecli.d/bump-upstream-agent-version.yml index d574d7a1..dfd71ad6 100644 --- a/.ci/updatecli.d/bump-upstream-agent-version.yml +++ b/.ci/updatecli.d/bump-upstream-agent-version.yml @@ -76,6 +76,7 @@ targets: replacepattern: $1"{{ source "upstream-agent-version" }}-alpha" update-contrib-version: + dependson: [update-agent-version] name: "Update OpenTelemetry Contrib version" conditionids: [update-required] sourceid: contrib-version @@ -87,6 +88,7 @@ targets: replacepattern: $1"{{ source "contrib-version" }}" update-semconv-version: + dependson: [update-contrib-version] name: "Update OpenTelemetry SemConv version" conditionids: [update-required] sourceid: semconv-version From 6bea8414023ea47f0b998041ac48bf39930dae0a Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 14:17:26 +0200 Subject: [PATCH 07/11] Switch to shell script for updating --- .../bump-upstream-agent-version.yml | 55 ++----------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/.ci/updatecli.d/bump-upstream-agent-version.yml b/.ci/updatecli.d/bump-upstream-agent-version.yml index dfd71ad6..8a329f62 100644 --- a/.ci/updatecli.d/bump-upstream-agent-version.yml +++ b/.ci/updatecli.d/bump-upstream-agent-version.yml @@ -35,26 +35,6 @@ sources: file: gradle/libs.versions.toml key: versions.opentelemetryJavaagentAlpha - semconv-version: - dependson: [upstream-agent-version] - kind: file - spec: - file: https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation/v{{ source "upstream-agent-version" }}/dependencyManagement/build.gradle.kts - transformers: - - findsubmatch: - pattern: val\s+semConvVersion\s*=\s*"([^"]*) - captureindex: 1 - - contrib-version: - dependson: [upstream-agent-version] - kind: file - spec: - file: https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation/v{{ source "upstream-agent-version" }}/dependencyManagement/build.gradle.kts - transformers: - - findsubmatch: - pattern: val\s+otelContribVersion\s*=\s*"([^"]*) - captureindex: 1 - conditions: update-required: disablesourceinput: true @@ -65,40 +45,13 @@ conditions: targets: update-agent-version: - name: "Update upstream OpenTelemetry agent version" + name: "Update upstream OpenTelemetry agent version and related dependencies" conditionids: [update-required] - sourceid: upstream-agent-version - kind: file # toml action currently erases comments, so we fallback to regex-replace - scmid: githubConfig - spec: - file: gradle/libs.versions.toml - matchpattern: (opentelemetryJavaagentAlpha\s*=\s*)"(.*)" - replacepattern: $1"{{ source "upstream-agent-version" }}-alpha" - - update-contrib-version: - dependson: [update-agent-version] - name: "Update OpenTelemetry Contrib version" - conditionids: [update-required] - sourceid: contrib-version - kind: file # toml action currently erases comments, so we fallback to regex-replace - scmid: githubConfig - spec: - file: gradle/libs.versions.toml - matchpattern: (opentelemetryContribAlpha\s*=\s*)"(.*)" - replacepattern: $1"{{ source "contrib-version" }}" - - update-semconv-version: - dependson: [update-contrib-version] - name: "Update OpenTelemetry SemConv version" - conditionids: [update-required] - sourceid: semconv-version - kind: file # toml action currently erases comments, so we fallback to regex-replace + disablesourceinput: true + kind: shell # toml action currently erases comments, so we fallback to regex-replace scmid: githubConfig spec: - file: gradle/libs.versions.toml - matchpattern: (opentelemetrySemconvAlpha\s*=\s*)"(.*)" - replacepattern: $1"{{ source "semconv-version" }}" - + command: gradle/update-upstream.sh v"{{ source "upstream-agent-version" }} actions: open-pr: From 321993d20c9ed5805bd566d4a5df3193a0589c48 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 14:19:02 +0200 Subject: [PATCH 08/11] Fix script --- .ci/updatecli.d/bump-upstream-agent-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/updatecli.d/bump-upstream-agent-version.yml b/.ci/updatecli.d/bump-upstream-agent-version.yml index 8a329f62..53392bab 100644 --- a/.ci/updatecli.d/bump-upstream-agent-version.yml +++ b/.ci/updatecli.d/bump-upstream-agent-version.yml @@ -51,7 +51,7 @@ targets: kind: shell # toml action currently erases comments, so we fallback to regex-replace scmid: githubConfig spec: - command: gradle/update-upstream.sh v"{{ source "upstream-agent-version" }} + command: gradle/update-upstream.sh v{{ source "upstream-agent-version" }} actions: open-pr: From 8b58ee75abe5eb52267812318f517cd9586b8956 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 14:25:29 +0200 Subject: [PATCH 09/11] Try committing changes --- .ci/updatecli.d/bump-upstream-agent-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/updatecli.d/bump-upstream-agent-version.yml b/.ci/updatecli.d/bump-upstream-agent-version.yml index 53392bab..337f3c64 100644 --- a/.ci/updatecli.d/bump-upstream-agent-version.yml +++ b/.ci/updatecli.d/bump-upstream-agent-version.yml @@ -51,7 +51,7 @@ targets: kind: shell # toml action currently erases comments, so we fallback to regex-replace scmid: githubConfig spec: - command: gradle/update-upstream.sh v{{ source "upstream-agent-version" }} + command: gradle/update-upstream.sh v{{ source "upstream-agent-version" }} && git add . & git commit -m "Update upstream versions" actions: open-pr: From 8ff43a31d4559e4e486a9734fda64b74eb9d74f2 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Thu, 8 Aug 2024 14:28:37 +0200 Subject: [PATCH 10/11] Echo to perform upgrade --- .ci/updatecli.d/bump-upstream-agent-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/updatecli.d/bump-upstream-agent-version.yml b/.ci/updatecli.d/bump-upstream-agent-version.yml index 337f3c64..8b6e7cbf 100644 --- a/.ci/updatecli.d/bump-upstream-agent-version.yml +++ b/.ci/updatecli.d/bump-upstream-agent-version.yml @@ -51,7 +51,7 @@ targets: kind: shell # toml action currently erases comments, so we fallback to regex-replace scmid: githubConfig spec: - command: gradle/update-upstream.sh v{{ source "upstream-agent-version" }} && git add . & git commit -m "Update upstream versions" + command: gradle/update-upstream.sh v{{ source "upstream-agent-version" }} && echo "Update successful" actions: open-pr: From 639746dfddf0cb60410b4235683f9005059c7ed5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 12:29:43 +0000 Subject: [PATCH 11/11] chore: Update upstream OpenTelemetry agent version and related depend... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... encies Made with ❤️️ by updatecli --- gradle/libs.versions.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1ddc3427..f466281e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,17 +10,17 @@ opentelemetryProto = "1.3.2-alpha" # otel agent, we rely on the '*-alpha' and get the non-alpha dependencies transitively # updated from upstream agent with .ci/update-upstream.sh -opentelemetryJavaagentAlpha = "2.4.0-alpha" +opentelemetryJavaagentAlpha = "2.6.0-alpha" # otel contrib # updated from upstream agent with .ci/update-upstream.sh -opentelemetryContribAlpha = "1.33.0-alpha" +opentelemetryContribAlpha = "1.36.0-alpha" # otel semconv # updated from upstream agent with .ci/update-upstream.sh # While the semconv stable artifact is provided transitively by the agent, we still have to explicitly # reference the "incubating" version explicitly -opentelemetrySemconvAlpha = "1.24.0-alpha" +opentelemetrySemconvAlpha = "1.25.0-alpha" [libraries]