This is an automated email from the ASF dual-hosted git repository.
Abacn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 6c0db120f38 Automate OpenTelemetry license entries in bomupgrader
(#38815)
6c0db120f38 is described below
commit 6c0db120f388fea2c8a590d313655656e28dc1e0
Author: Abdelrahman Ibrahim <[email protected]>
AuthorDate: Fri Jun 5 19:58:09 2026 +0200
Automate OpenTelemetry license entries in bomupgrader (#38815)
* Automate OpenTelemetry license entries in bomupgrader
* Simplify OpenTelemetry license updates in bomupgrader
---
scripts/tools/bomupgrader.py | 53 ++++++++++++++++++----
.../container/license_scripts/dep_urls_java.yaml | 6 ---
2 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/scripts/tools/bomupgrader.py b/scripts/tools/bomupgrader.py
index bf6e7dfdd31..4697c46a556 100644
--- a/scripts/tools/bomupgrader.py
+++ b/scripts/tools/bomupgrader.py
@@ -27,7 +27,8 @@ Specifically, it
1. preprocessing BeamModulePlugin.groovy to decide the dependencies need to
sync
2. generate an empty Maven project to fetch the exact target versions to change
3. Write back to BeamModulePlugin.groovy
-4. Update libraries-bom version on
sdks/java/container/license_scripts/dep_urls_java.yaml
+4. Update libraries-bom and opentelemetry-bom entries on
+ sdks/java/container/license_scripts/dep_urls_java.yaml
There are few reasons we need to declare the version numbers:
1. Sync the dependency that not included in GCP-BOM with those included with
BOM
@@ -254,17 +255,51 @@ configurations.implementation.canBeResolved = true
for line in self.target_lines:
fout.write(line)
+ def _get_opentelemetry_version(self):
+ for line in self.target_lines:
+ match = self.VERSION_STRING.match(line)
+ if match and match.group(1) == 'opentelemetry':
+ return match.group(2)
+ logging.warning('opentelemetry_version not found in BeamModulePlugin')
+ return None
+
def write_license_script(self):
logging.info("-----Update dep_urls_java.yaml-----")
- with open(os.path.join(self.project_root, self.LICENSE_SC_PATH),
- 'r') as fin:
+ license_path = os.path.join(self.project_root, self.LICENSE_SC_PATH)
+ with open(license_path, 'r') as fin:
lines = fin.readlines()
- with open(os.path.join(self.project_root, self.LICENSE_SC_PATH),
- 'w') as fout:
- for idx, line in enumerate(lines):
- if line.strip() == 'libraries-bom:':
- lines[idx + 1] = re.sub(
- r'[\'"]\d[\.\d]+[\'"]', f"'{self.bom_version}'", lines[idx + 1])
+
+ otel_version = self._get_opentelemetry_version()
+ otel_license_url = (
+ 'https://raw.githubusercontent.com/open-telemetry/'
+ 'opentelemetry-java/v{}/LICENSE'.format(otel_version)
+ if otel_version else None)
+ otel_license_line = ' license: "{}"\n'.format(otel_license_url)
+
+ for idx, line in enumerate(lines):
+ stripped = line.strip()
+ if stripped == 'libraries-bom:':
+ lines[idx + 1] = re.sub(
+ r'[\'"]\d[\d\.]+[\'"]', "'{}'".format(self.bom_version),
+ lines[idx + 1])
+ continue
+ if otel_version and stripped == 'opentelemetry-bom:':
+ lines[idx + 1] = re.sub(
+ r"'[\d\.]+'", "'{}'".format(otel_version), lines[idx + 1])
+ lines[idx + 2] = otel_license_line
+ continue
+ if otel_version and stripped == 'opentelemetry-bom-alpha:':
+ lines[idx + 1] = re.sub(
+ r"'[\d\.]+-alpha'", "'{}-alpha'".format(otel_version),
+ lines[idx + 1])
+ lines[idx + 2] = otel_license_line
+
+ if otel_version:
+ logging.info(
+ 'Updated opentelemetry-bom license entries to %s', otel_version)
+
+ with open(license_path, 'w') as fout:
+ for line in lines:
fout.write(line)
def run(self):
diff --git a/sdks/java/container/license_scripts/dep_urls_java.yaml
b/sdks/java/container/license_scripts/dep_urls_java.yaml
index 9f80b8c81fc..589f7ee2d12 100644
--- a/sdks/java/container/license_scripts/dep_urls_java.yaml
+++ b/sdks/java/container/license_scripts/dep_urls_java.yaml
@@ -66,16 +66,10 @@ org.eclipse.jgit:
license: "https://www.eclipse.org/org/documents/edl-v10.html"
type: "Eclipse Distribution License - v1.0"
opentelemetry-bom:
- '1.56.0':
- license:
"https://raw.githubusercontent.com/open-telemetry/opentelemetry-java/v1.56.0/LICENSE"
- type: "Apache License 2.0"
'1.57.0':
license:
"https://raw.githubusercontent.com/open-telemetry/opentelemetry-java/v1.57.0/LICENSE"
type: "Apache License 2.0"
opentelemetry-bom-alpha:
- '1.56.0-alpha':
- license:
"https://raw.githubusercontent.com/open-telemetry/opentelemetry-java/v1.56.0/LICENSE"
- type: "Apache License 2.0"
'1.57.0-alpha':
license:
"https://raw.githubusercontent.com/open-telemetry/opentelemetry-java/v1.57.0/LICENSE"
type: "Apache License 2.0"