From 383f29c994d0d5c121b28e79927d02c18ed8d3da Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Tue, 23 Sep 2025 19:09:45 -0700 Subject: [PATCH 01/13] add script to bump otel dependencies --- scripts/update_dependencies.py | 126 +++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 scripts/update_dependencies.py diff --git a/scripts/update_dependencies.py b/scripts/update_dependencies.py new file mode 100644 index 0000000000..bc3c4864bf --- /dev/null +++ b/scripts/update_dependencies.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python3 + +import requests +import re +import sys + +def get_latest_instrumentation_version(): + """Get the latest version of opentelemetry-java-instrumentation from GitHub releases.""" + try: + response = requests.get( + 'https://api.github.com/repos/open-telemetry/opentelemetry-java-instrumentation/releases/latest', + timeout=30 + ) + response.raise_for_status() + + release_data = response.json() + tag_name = release_data['tag_name'] + + version = tag_name.lstrip('v') + return version + + except requests.RequestException as request_error: + print(f"Warning: Could not get latest instrumentation version: {request_error}") + return None + +def get_latest_maven_version(group_id, artifact_id): + """Get the latest version of a Maven artifact from Maven Central.""" + try: + response = requests.get( + f'https://search.maven.org/solrsearch/select?q=g:{group_id}+AND+a:{artifact_id}&rows=1&wt=json', + timeout=30 + ) + response.raise_for_status() + + data = response.json() + docs = data.get('response', {}).get('docs', []) + + if docs: + return docs[0]['latestVersion'] + else: + print(f"Warning: No versions found for {group_id}:{artifact_id}") + return None + + except requests.RequestException as request_error: + print(f"Warning: Could not get latest version for {group_id}:{artifact_id}: {request_error}") + return None + +def update_gradle_file(file_path): + """Update OpenTelemetry versions in build.gradle.kts.""" + try: + with open(file_path, 'r', encoding='utf-8') as input_file: + content = input_file.read() + + original_content = content + updated = False + + latest_instrumentation_version = get_latest_instrumentation_version() + if latest_instrumentation_version: + # Update otelVersion + otel_version_pattern = r'val otelVersion = "[^"]*"' + otel_version_replacement = f'val otelVersion = "{latest_instrumentation_version}"' + if re.search(otel_version_pattern, content): + new_content = re.sub(otel_version_pattern, otel_version_replacement, content) + if new_content != content: + content = new_content + updated = True + print(f"Updated otelVersion to {latest_instrumentation_version}") + + # Update otelSnapshotVersion (typically next minor version) + version_parts = latest_instrumentation_version.split('.') + if len(version_parts) >= 2: + next_minor = f"{version_parts[0]}.{int(version_parts[1]) + 1}.0" + otel_snapshot_pattern = r'val otelSnapshotVersion = "[^"]*"' + otel_snapshot_replacement = f'val otelSnapshotVersion = "{next_minor}"' + if re.search(otel_snapshot_pattern, content): + new_content = re.sub(otel_snapshot_pattern, otel_snapshot_replacement, content) + if new_content != content: + content = new_content + updated = True + print(f"Updated otelSnapshotVersion to {next_minor}") + + # Update hardcoded OpenTelemetry versions in dependencyLists + opentelemetry_packages = [ + ('io.opentelemetry.contrib', 'opentelemetry-aws-xray'), + ('io.opentelemetry.contrib', 'opentelemetry-aws-resources'), + ('io.opentelemetry', 'opentelemetry-extension-aws'), + ('io.opentelemetry.proto', 'opentelemetry-proto'), + ] + + for group_id, artifact_id in opentelemetry_packages: + latest_version = get_latest_maven_version(group_id, artifact_id) + if latest_version: + # Pattern to match the dependency line + pattern = rf'"{re.escape(group_id)}:{re.escape(artifact_id)}:[^"]*"' + replacement = f'"{group_id}:{artifact_id}:{latest_version}"' + + if re.search(pattern, content): + new_content = re.sub(pattern, replacement, content) + if new_content != content: + content = new_content + updated = True + print(f"Updated {group_id}:{artifact_id} to {latest_version}") + + if updated: + with open(file_path, 'w', encoding='utf-8') as output_file: + output_file.write(content) + print("Dependencies updated successfully") + return True + else: + print("No OpenTelemetry dependencies needed updating") + return False + + except (OSError, IOError) as file_error: + print(f"Error updating dependencies: {file_error}") + sys.exit(1) + +def main(): + gradle_file_path = 'dependencyManagement/build.gradle.kts' + + updated = update_gradle_file(gradle_file_path) + + if not updated: + print("No updates were made") + +if __name__ == '__main__': + main() From c4395a7d45a15b9de1db5b5c5c12175813e8b9eb Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Tue, 23 Sep 2025 19:12:06 -0700 Subject: [PATCH 02/13] add nightly build workflow --- .github/workflows/nightly-build.yml | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/nightly-build.yml diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml new file mode 100644 index 0000000000..f4677500e5 --- /dev/null +++ b/.github/workflows/nightly-build.yml @@ -0,0 +1,70 @@ +name: Nightly Upstream Snapshot Build + +on: + schedule: + - cron: "21 3 * * *" + workflow_dispatch: + +env: + BRANCH_NAME: nightly-dependency-updates + +jobs: + update-and-create-pr: + runs-on: ubuntu-latest + outputs: + has_changes: ${{ steps.check_changes.outputs.has_changes }} + + steps: + - name: Checkout repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #5.0.0 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check if nightly branch already exists + run: | + if git ls-remote --exit-code --heads origin "$BRANCH_NAME"; then + echo "Branch $BRANCH_NAME already exists. Skipping run to avoid conflicts." + echo "Please merge or close the existing PR before the next nightly run." + exit 1 + fi + + - name: Configure git and create branch + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git checkout -b "$BRANCH_NAME" + + - name: Set up Python + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c #v6.0.0 + with: + python-version: '3.11' + + - name: Install Python dependencies + run: pip install requests + + - name: Update dependencies + run: python3 scripts/update_dependencies.py + + - name: Check for changes and create PR + id: check_changes + run: | + if git diff --quiet; then + echo "No dependency updates needed" + echo "has_changes=false" >> $GITHUB_OUTPUT + else + echo "Dependencies were updated" + echo "has_changes=true" >> $GITHUB_OUTPUT + + git add dependencyManagement/build.gradle.kts + git commit -m "chore: update OpenTelemetry dependencies to latest versions" + git push origin "$BRANCH_NAME" + + gh pr create \ + --title "Nightly dependency update: OpenTelemetry packages to latest versions" \ + --body "Automated update of OpenTelemetry dependencies to their latest available versions." \ + --base main \ + --head "$BRANCH_NAME" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e12d79c9cb645d1bc8cee60ca9e571dea2bfbd31 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Tue, 23 Sep 2025 19:13:06 -0700 Subject: [PATCH 03/13] update main build to run on nightly build branch --- .github/workflows/main-build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 622cba16e3..6618a3b2f5 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -4,6 +4,7 @@ on: branches: - main - "release/v*" + - nightly-dependency-updates workflow_dispatch: # be able to run the workflow on demand env: AWS_DEFAULT_REGION: us-east-1 @@ -268,7 +269,7 @@ jobs: name: "Publish Main Build Status" needs: [ build, e2e-test, contract-tests, application-signals-lambda-layer-build, application-signals-e2e-test ] runs-on: ubuntu-latest - if: always() + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') steps: - name: Configure AWS Credentials for emitting metrics uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0 From a821678504e588da1057a1fcbeee442e5cef8997 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 28 Sep 2025 18:41:09 -0700 Subject: [PATCH 04/13] update contrib dependencies together in script --- scripts/update_dependencies.py | 57 ++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/scripts/update_dependencies.py b/scripts/update_dependencies.py index bc3c4864bf..2d4f84b520 100644 --- a/scripts/update_dependencies.py +++ b/scripts/update_dependencies.py @@ -23,6 +23,37 @@ def get_latest_instrumentation_version(): print(f"Warning: Could not get latest instrumentation version: {request_error}") return None +def get_latest_contrib_version(): + """Get the latest version of opentelemetry-java-contrib from GitHub releases.""" + try: + response = requests.get( + 'https://api.github.com/repos/open-telemetry/opentelemetry-java-contrib/releases', + timeout=30 + ) + response.raise_for_status() + + releases = response.json() + + # Find the latest stable release + for release in releases: + if release.get('prerelease', False): + continue # Skip pre-releases + + tag_name = release['tag_name'] + # Contrib releases are typically tagged as "v1.32.0" + version_match = re.match(r'^v?(\d+\.\d+\.\d+)$', tag_name) + if version_match: + version = version_match.group(1) + print(f"Found contrib version: {version}") + return version + + print("Warning: No stable contrib releases found") + return None + + except requests.RequestException as request_error: + print(f"Warning: Could not get latest contrib version: {request_error}") + return None + def get_latest_maven_version(group_id, artifact_id): """Get the latest version of a Maven artifact from Maven Central.""" try: @@ -79,15 +110,35 @@ def update_gradle_file(file_path): updated = True print(f"Updated otelSnapshotVersion to {next_minor}") - # Update hardcoded OpenTelemetry versions in dependencyLists - opentelemetry_packages = [ + # Get latest contrib version from GitHub + latest_contrib_version = get_latest_contrib_version() + + # Update contrib packages that are released together + contrib_packages = [ ('io.opentelemetry.contrib', 'opentelemetry-aws-xray'), ('io.opentelemetry.contrib', 'opentelemetry-aws-resources'), + ] + + for group_id, artifact_id in contrib_packages: + if latest_contrib_version: + # Pattern to match the dependency line + pattern = rf'"{re.escape(group_id)}:{re.escape(artifact_id)}:[^"]*"' + replacement = f'"{group_id}:{artifact_id}:{latest_contrib_version}"' + + if re.search(pattern, content): + new_content = re.sub(pattern, replacement, content) + if new_content != content: + content = new_content + updated = True + print(f"Updated {group_id}:{artifact_id} to {latest_contrib_version}") + + # Update remaining packages using Maven Central + other_packages = [ ('io.opentelemetry', 'opentelemetry-extension-aws'), ('io.opentelemetry.proto', 'opentelemetry-proto'), ] - for group_id, artifact_id in opentelemetry_packages: + for group_id, artifact_id in other_packages: latest_version = get_latest_maven_version(group_id, artifact_id) if latest_version: # Pattern to match the dependency line From ea7f37204c35a4fae6c9a6a297d3af8b32b1a913 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 28 Sep 2025 18:55:30 -0700 Subject: [PATCH 05/13] add logic to link releases with breaking changes --- .github/workflows/nightly-build.yml | 25 +++++- scripts/find_breaking_changes.py | 118 ++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 scripts/find_breaking_changes.py diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index f4677500e5..25d5909a82 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -41,7 +41,14 @@ jobs: python-version: '3.11' - name: Install Python dependencies - run: pip install requests + run: pip install requests packaging + + - name: Generate breaking changes summary + id: breaking_changes + run: | + echo "BREAKING_CHANGES<> $GITHUB_OUTPUT + python3 scripts/find_breaking_changes.py + echo "EOF" >> $GITHUB_OUTPUT - name: Update dependencies run: python3 scripts/update_dependencies.py @@ -60,11 +67,25 @@ jobs: git commit -m "chore: update OpenTelemetry dependencies to latest versions" git push origin "$BRANCH_NAME" + - name: Create or update PR + if: steps.check_changes.outputs.has_changes == 'true' + run: | + PR_BODY="Automated update of OpenTelemetry dependencies to their latest available versions. + + **Upstream releases with breaking changes:** + ${{ steps.breaking_changes.outputs.BREAKING_CHANGES }}" + + if gh pr view "$BRANCH_NAME" --json state --jq '.state' 2>/dev/null | grep -q "OPEN"; then + echo "Open PR already exists, updating description..." + gh pr edit "$BRANCH_NAME" --body "$PR_BODY" + else + echo "Creating new PR..." gh pr create \ --title "Nightly dependency update: OpenTelemetry packages to latest versions" \ - --body "Automated update of OpenTelemetry dependencies to their latest available versions." \ + --body "$PR_BODY" \ --base main \ --head "$BRANCH_NAME" fi + fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/find_breaking_changes.py b/scripts/find_breaking_changes.py new file mode 100644 index 0000000000..59e0cf4541 --- /dev/null +++ b/scripts/find_breaking_changes.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 + +import re +import requests +import sys +from packaging import version + + +def get_current_versions(): + """Get current versions from build.gradle.kts.""" + try: + with open("dependencyManagement/build.gradle.kts", "r", encoding="utf-8") as file: + content = file.read() + + # Extract otelVersion + otel_version_match = re.search(r'val otelVersion = "([^"]*)"', content) + current_instrumentation_version = otel_version_match.group(1) if otel_version_match else None + + return current_instrumentation_version + + except (OSError, IOError) as error: + print(f"Error reading current versions: {error}") + return None + + +def get_releases_with_breaking_changes(repo, current_version, new_version): + """Get releases between current and new version that mention breaking changes.""" + try: + response = requests.get(f"https://api.github.com/repos/open-telemetry/{repo}/releases", timeout=30) + response.raise_for_status() + releases = response.json() + + breaking_releases = [] + + for release in releases: + try: + tag_name = release["tag_name"] + release_version = tag_name.lstrip("v") + + # Check if this release is between current and new version + if ( + version.parse(current_version) + < version.parse(release_version) + <= version.parse(new_version) + ): + + # Check if release notes have breaking changes as headers + body = release.get("body", "") + breaking_header_pattern = r'^#+.*breaking changes' + if re.search(breaking_header_pattern, body, re.IGNORECASE | re.MULTILINE): + breaking_releases.append( + { + "version": release_version, + "name": release["name"], + "url": release["html_url"], + "body": release.get("body", ""), + } + ) + except (ValueError, KeyError): + # Skip releases with invalid version formats or missing data + continue + + return breaking_releases + + except requests.RequestException as request_error: + print(f"Warning: Could not get releases for {repo}: {request_error}") + return [] + + +def main(): + current_instrumentation_version = get_current_versions() + + if not current_instrumentation_version: + print("Could not determine current versions") + sys.exit(1) + + # Get new versions from the update script + sys.path.append('scripts') + from update_dependencies import get_latest_instrumentation_version, get_latest_contrib_version + + new_instrumentation_version = get_latest_instrumentation_version() + new_contrib_version = get_latest_contrib_version() + + if not new_instrumentation_version: + print("Could not determine new versions") + sys.exit(1) + + print("Checking for breaking changes:") + print(f"Instrumentation: {current_instrumentation_version} → {new_instrumentation_version}") + if new_contrib_version: + print(f"Contrib: → {new_contrib_version}") + + # Check instrumentation repo for breaking changes + instrumentation_breaking = get_releases_with_breaking_changes( + "opentelemetry-java-instrumentation", current_instrumentation_version, new_instrumentation_version + ) + + # Generate breaking changes summary + breaking_changes_summary = [] + + if instrumentation_breaking: + breaking_changes_summary.append("**Breaking changes found in opentelemetry-java-instrumentation:**") + for release in instrumentation_breaking: + breaking_changes_summary.append(f"- [{release['name']}]({release['url']})") + + # Always add contrib release link (no breaking changes detection needed) + if new_contrib_version: + breaking_changes_summary.append("**Check contrib releases:**") + breaking_changes_summary.append("- [opentelemetry-java-contrib releases](https://github.com/open-telemetry/opentelemetry-java-contrib/releases)") + + if breaking_changes_summary: + print("\n" + "\n".join(breaking_changes_summary)) + else: + print("\nNo breaking changes detected") + + +if __name__ == "__main__": + main() From 8cf6aac7cc314f1302764ea6f0ef7761a074d219 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 28 Sep 2025 18:57:52 -0700 Subject: [PATCH 06/13] Revert "update main build to run on nightly build branch" This reverts commit e12d79c9cb645d1bc8cee60ca9e571dea2bfbd31. --- .github/workflows/main-build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 6618a3b2f5..622cba16e3 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -4,7 +4,6 @@ on: branches: - main - "release/v*" - - nightly-dependency-updates workflow_dispatch: # be able to run the workflow on demand env: AWS_DEFAULT_REGION: us-east-1 @@ -269,7 +268,7 @@ jobs: name: "Publish Main Build Status" needs: [ build, e2e-test, contract-tests, application-signals-lambda-layer-build, application-signals-e2e-test ] runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') + if: always() steps: - name: Configure AWS Credentials for emitting metrics uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0 From ed8294e32025a657df476142cd9d21e3873fd86d Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 28 Sep 2025 19:03:26 -0700 Subject: [PATCH 07/13] fix branching logic and add metric --- .github/workflows/nightly-build.yml | 51 ++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 25d5909a82..cff54cd3d5 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -5,7 +5,13 @@ on: - cron: "21 3 * * *" workflow_dispatch: +permissions: + contents: write + pull-requests: write + id-token: write + env: + AWS_DEFAULT_REGION: us-east-1 BRANCH_NAME: nightly-dependency-updates jobs: @@ -21,19 +27,20 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - - name: Check if nightly branch already exists - run: | - if git ls-remote --exit-code --heads origin "$BRANCH_NAME"; then - echo "Branch $BRANCH_NAME already exists. Skipping run to avoid conflicts." - echo "Please merge or close the existing PR before the next nightly run." - exit 1 - fi - - - name: Configure git and create branch + - name: Configure git run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git checkout -b "$BRANCH_NAME" + + - name: Check out dependency update branch + run: | + if git ls-remote --exit-code --heads origin "$BRANCH_NAME"; then + echo "Branch $BRANCH_NAME already exists, checking out..." + git checkout "$BRANCH_NAME" + else + echo "Branch $BRANCH_NAME does not exist, creating new branch..." + git checkout -b "$BRANCH_NAME" + fi - name: Set up Python uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c #v6.0.0 @@ -66,7 +73,8 @@ jobs: git add dependencyManagement/build.gradle.kts git commit -m "chore: update OpenTelemetry dependencies to latest versions" git push origin "$BRANCH_NAME" - + fi + - name: Create or update PR if: steps.check_changes.outputs.has_changes == 'true' run: | @@ -89,3 +97,24 @@ jobs: fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + publish-nightly-build-status: + name: "Publish Nightly Build Status" + needs: [update-and-create-pr] + runs-on: ubuntu-latest + if: always() + steps: + - name: Configure AWS Credentials for emitting metrics + uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0 + with: + role-to-assume: ${{ secrets.MONITORING_ROLE_ARN }} + aws-region: ${{ env.AWS_DEFAULT_REGION }} + + - name: Publish nightly build status + run: | + # For now, just publish success since we don't have build validation yet + value="${{ needs.update-and-create-pr.result == 'success' && '0.0' || '1.0'}}" + aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \ + --metric-name Failure \ + --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly_build \ + --value $value From edcdb158df651b758b6336e89f2cc4944ee3bbba Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 28 Sep 2025 19:08:08 -0700 Subject: [PATCH 08/13] add main build call and update metric --- .github/workflows/main-build.yml | 15 +++++++++++++++ .github/workflows/nightly-build.yml | 26 +++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 622cba16e3..eba1156676 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -1,5 +1,15 @@ name: Java Agent Main Build on: + workflow_call: + inputs: + caller-workflow-name: + required: true + type: string + ref: + description: 'The branch, tag or SHA to checkout' + required: false + type: string + default: '' push: branches: - main @@ -24,6 +34,8 @@ jobs: runs-on: aws-otel-java-instrumentation_ubuntu-latest_32-core steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 + with: + ref: ${{ inputs.ref || github.sha }} - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0 with: java-version-file: .java-version @@ -58,6 +70,7 @@ jobs: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 with: fetch-depth: 0 + ref: ${{ inputs.ref || github.sha }} - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0 with: java-version-file: .java-version @@ -193,6 +206,7 @@ jobs: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 with: fetch-depth: 0 + ref: ${{ inputs.ref || github.sha }} - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0 with: java-version: 23 @@ -233,6 +247,7 @@ jobs: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0 with: fetch-depth: 0 + ref: ${{ inputs.ref || github.sha }} - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0 with: java-version-file: .java-version diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index cff54cd3d5..751152d322 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -98,9 +98,18 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build-and-test: + needs: update-and-create-pr + if: needs.update-and-create-pr.outputs.has_changes == 'true' + uses: ./.github/workflows/main-build.yml + secrets: inherit + with: + caller-workflow-name: nightly-build + ref: nightly-dependency-updates + publish-nightly-build-status: name: "Publish Nightly Build Status" - needs: [update-and-create-pr] + needs: [update-and-create-pr, build-and-test] runs-on: ubuntu-latest if: always() steps: @@ -112,9 +121,12 @@ jobs: - name: Publish nightly build status run: | - # For now, just publish success since we don't have build validation yet - value="${{ needs.update-and-create-pr.result == 'success' && '0.0' || '1.0'}}" - aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \ - --metric-name Failure \ - --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly_build \ - --value $value + if [[ "${{ needs.build-and-test.result }}" == "skipped" ]]; then + echo "Build was skipped (no changes), not publishing metric" + else + value="${{ needs.build-and-test.result == 'success' && '0.0' || '1.0'}}" + aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \ + --metric-name Failure \ + --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly_build \ + --value $value + fi From 3393cf74166e11dd0425a377df1425c1986f7fe7 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 28 Sep 2025 19:08:38 -0700 Subject: [PATCH 09/13] add test trigger to workflow --- .github/workflows/nightly-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 751152d322..215aa5b8c4 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -4,6 +4,9 @@ on: schedule: - cron: "21 3 * * *" workflow_dispatch: + push: + branches: + - zhaez/nightly-build permissions: contents: write From 27155e291911beefa3983b680390005c0e08a307 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 28 Sep 2025 19:10:26 -0700 Subject: [PATCH 10/13] fix bug and job title --- .github/workflows/nightly-build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 215aa5b8c4..cc2ab83806 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -63,7 +63,7 @@ jobs: - name: Update dependencies run: python3 scripts/update_dependencies.py - - name: Check for changes and create PR + - name: Check for changes and commit id: check_changes run: | if git diff --quiet; then @@ -97,7 +97,6 @@ jobs: --base main \ --head "$BRANCH_NAME" fi - fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 735e6af9d0e550a1499bb72d4ce376aff55df062 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 28 Sep 2025 19:11:44 -0700 Subject: [PATCH 11/13] fix credential for metric publishing --- .github/workflows/nightly-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index cc2ab83806..6abd6d0d61 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -118,7 +118,7 @@ jobs: - name: Configure AWS Credentials for emitting metrics uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0 with: - role-to-assume: ${{ secrets.MONITORING_ROLE_ARN }} + role-to-assume: ${{ secrets.METRICS_ROLE_ARN }} aws-region: ${{ env.AWS_DEFAULT_REGION }} - name: Publish nightly build status From f3abbd9533c31556e0d354a1fdd029a9e4725bf4 Mon Sep 17 00:00:00 2001 From: Eric Zhang Date: Sun, 28 Sep 2025 19:40:57 -0700 Subject: [PATCH 12/13] fix logic to find breaking changes --- .github/workflows/nightly-build.yml | 7 ++----- scripts/find_breaking_changes.py | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 6abd6d0d61..bea3ea5150 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -55,10 +55,7 @@ jobs: - name: Generate breaking changes summary id: breaking_changes - run: | - echo "BREAKING_CHANGES<> $GITHUB_OUTPUT - python3 scripts/find_breaking_changes.py - echo "EOF" >> $GITHUB_OUTPUT + run: python3 scripts/find_breaking_changes.py - name: Update dependencies run: python3 scripts/update_dependencies.py @@ -84,7 +81,7 @@ jobs: PR_BODY="Automated update of OpenTelemetry dependencies to their latest available versions. **Upstream releases with breaking changes:** - ${{ steps.breaking_changes.outputs.BREAKING_CHANGES }}" + ${{ steps.breaking_changes.outputs.breaking_changes_info }}" if gh pr view "$BRANCH_NAME" --json state --jq '.state' 2>/dev/null | grep -q "OPEN"; then echo "Open PR already exists, updating description..." diff --git a/scripts/find_breaking_changes.py b/scripts/find_breaking_changes.py index 59e0cf4541..560686a73c 100644 --- a/scripts/find_breaking_changes.py +++ b/scripts/find_breaking_changes.py @@ -46,8 +46,8 @@ def get_releases_with_breaking_changes(repo, current_version, new_version): # Check if release notes have breaking changes as headers body = release.get("body", "") - breaking_header_pattern = r'^#+.*breaking changes' - if re.search(breaking_header_pattern, body, re.IGNORECASE | re.MULTILINE): + breaking_header_pattern = r'^\s*#+.*Breaking changes' + if re.search(breaking_header_pattern, body, re.MULTILINE): breaking_releases.append( { "version": release_version, @@ -95,23 +95,24 @@ def main(): "opentelemetry-java-instrumentation", current_instrumentation_version, new_instrumentation_version ) - # Generate breaking changes summary - breaking_changes_summary = [] + # Output for GitHub Actions + breaking_info = "" if instrumentation_breaking: - breaking_changes_summary.append("**Breaking changes found in opentelemetry-java-instrumentation:**") + breaking_info += "**opentelemetry-java-instrumentation:**\n" for release in instrumentation_breaking: - breaking_changes_summary.append(f"- [{release['name']}]({release['url']})") + breaking_info += f"- [{release['name']}]({release['url']})\n" - # Always add contrib release link (no breaking changes detection needed) + # Add contrib release link only if we have a new contrib version if new_contrib_version: - breaking_changes_summary.append("**Check contrib releases:**") - breaking_changes_summary.append("- [opentelemetry-java-contrib releases](https://github.com/open-telemetry/opentelemetry-java-contrib/releases)") - - if breaking_changes_summary: - print("\n" + "\n".join(breaking_changes_summary)) - else: - print("\nNo breaking changes detected") + breaking_info += "\n**Check contrib releases for potential breaking changes:**\n" + breaking_info += "- [opentelemetry-java-contrib releases](https://github.com/open-telemetry/opentelemetry-java-contrib/releases)\n" + + # Set GitHub output + import os + if os.environ.get("GITHUB_OUTPUT"): + with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output_file: + output_file.write(f"breaking_changes_info< Date: Mon, 29 Sep 2025 02:41:23 +0000 Subject: [PATCH 13/13] chore: update OpenTelemetry dependencies to latest versions --- dependencyManagement/build.gradle.kts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index cf5f3c2f26..07beb2b487 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -27,8 +27,8 @@ data class DependencySet(val group: String, val version: String, val modules: Li val testSnapshots = rootProject.findProperty("testUpstreamSnapshots") == "true" // This is the version of the upstream instrumentation BOM -val otelVersion = "2.18.1-adot1" -val otelSnapshotVersion = "2.19.0" +val otelVersion = "2.20.1" +val otelSnapshotVersion = "2.21.0" val otelAlphaVersion = if (!testSnapshots) "$otelVersion-alpha" else "$otelSnapshotVersion-alpha-SNAPSHOT" val otelJavaAgentVersion = if (!testSnapshots) otelVersion else "$otelSnapshotVersion-SNAPSHOT" // All versions below are only used in testing and do not affect the released artifact. @@ -77,9 +77,9 @@ val dependencyLists = listOf( "commons-logging:commons-logging:1.2", "com.sparkjava:spark-core:2.9.4", "com.squareup.okhttp3:okhttp:4.12.0", - "io.opentelemetry.contrib:opentelemetry-aws-xray:1.48.0-adot1", - "io.opentelemetry.contrib:opentelemetry-aws-resources:1.48.0-alpha", - "io.opentelemetry.proto:opentelemetry-proto:1.0.0-alpha", + "io.opentelemetry.contrib:opentelemetry-aws-xray:1.50.0", + "io.opentelemetry.contrib:opentelemetry-aws-resources:1.50.0", + "io.opentelemetry.proto:opentelemetry-proto:1.7.0-alpha", "io.opentelemetry.javaagent:opentelemetry-javaagent:$otelJavaAgentVersion", "io.opentelemetry:opentelemetry-extension-aws:1.20.1", "net.bytebuddy:byte-buddy:1.14.10",