Skip to content

Commit 4223a86

Browse files
authored
chore: Add renovate custom manager to update upper-bound files (#3894)
Dependencies CI Test: https://github.com/googleapis/sdk-platform-java/actions/runs/18327368470/job/52195017520 ## Changes In order to keep the current Maven pom.xml files the same, we create a new format in the dependencies.txt file: `{GroupID}:{ArtifactID},{MavenPropertyID}={Version}`. The `GroupID`, `ArtifactID`, and `Version` values are by renovate bot to determine there should be a dependency bump. The `MavenPropertyID` and `Version` values are used to build the maven test command. The format may not look intuitive and can be changed in the future. Values/ Separators were chosen so that it doesn't have any weird edge cases/ impact in shell scripts (avoiding ';', '*', '|' characters) ## Local Renovate Bot Invocation Local invocation of renovate shows that it is able to match the versions: ``` { "depName": "com.fasterxml.jackson:jackson-bom", "currentValue": "2.19.2", "datasource": "maven", "replaceString": "com.fasterxml.jackson:jackson-bom=2.19.2\n", "updates": [ { "bucket": "non-major", "newVersion": "2.20.0", "newValue": "2.20.0", "releaseTimestamp": "2025-08-28T22:48:03.000Z", "newVersionAgeInDays": 0, "newMajor": 2, "newMinor": 20, "newPatch": 0, "updateType": "minor", "isBreaking": false, "branchName": "renovate/com.fasterxml.jackson-jackson-bom-2.x" } ], ... ], "matchStrings": ["(?<depName>.*)=(?<currentValue>.*)\\n"], "datasourceTemplate": "maven", "packageFile": "dependencies.txt" } ```
1 parent 598de06 commit 4223a86

File tree

5 files changed

+58
-55
lines changed

5 files changed

+58
-55
lines changed

.github/scripts/test_dependency_compatibility.sh

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
# an input for the deps_list to manually run a subset of dependencies.
1919
#
2020
# The default upper-bound dependencies file is `dependencies.txt` located in the root
21-
# of sdk-platform-java. The upper-bound dependencies file will be in the format of:
22-
# ${dependency.name}=${dependency.version}
21+
# of sdk-platform-java. See the upper-bound dependencies file for the dependency format.
2322

2423
set -ex
2524

@@ -29,18 +28,6 @@ function print_help() {
2928
echo "Use -l {deps_list} for a comma-separated list of dependencies to test (Format: dep1=1.0,dep2=2.0)"
3029
}
3130

32-
# Function to parse a dependency string and append it to the Maven command
33-
function add_dependency_to_maven_command() {
34-
local dep_pair=$1
35-
if [[ ! "${dep_pair}" =~ .*=.* ]]; then
36-
echo "Malformed dependency string: ${dep_pair}. Expected format: dependency=version"
37-
exit 1
38-
fi
39-
local dependency=$(echo "${dep_pair}" | cut -d'=' -f1 | tr -d '[:space:]')
40-
local version=$(echo "${dep_pair}" | cut -d'=' -f2 | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
41-
MAVEN_COMMAND+=" -D${dependency}.version=${version}"
42-
}
43-
4431
# Default to the upper bounds file in the root of the repo
4532
file='dependencies.txt'
4633
dependency_list=''
@@ -59,7 +46,7 @@ if [[ -z "${file}" && -z "${dependency_list}" ]]; then
5946
print_help && exit 1
6047
fi
6148

62-
MAVEN_COMMAND="mvn verify -Penable-integration-tests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip -Denforcer.skip "
49+
MAVEN_COMMAND="mvn -ntp -B verify -Penable-integration-tests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip -Denforcer.skip"
6350

6451
# Check if a list of dependencies was provided as an argument. If the list of dependency inputted
6552
# is empty, then run with the upper-bound dependencies file
@@ -77,7 +64,11 @@ if [ -z "${dependency_list}" ]; then
7764
if [[ "${line}" =~ ^[[:space:]]*# ]] || [[ -z "${line}" ]]; then
7865
continue
7966
fi
80-
add_dependency_to_maven_command "${line}"
67+
# Format from `dependencies.txt`: {GroupID}:{ArtifactID},{PropertyName}={Version}
68+
propertyVersion=$(echo "${line}" | cut -d',' -f2)
69+
dependency=$(echo "${propertyVersion}" | cut -d'=' -f1)
70+
version=$(echo "${propertyVersion}" | cut -d'=' -f2)
71+
MAVEN_COMMAND+=" -D${dependency}.version=${version}"
8172
done < "${UPPER_BOUND_DEPENDENCY_FILE}"
8273
else # This else block means that a list of dependencies was inputted
8374
# Set the Internal Field Separator (IFS) to a comma.
@@ -91,7 +82,10 @@ else # This else block means that a list of dependencies was inputted
9182
if [ -z "${DEP_PAIR}" ]; then
9283
continue
9384
fi
94-
add_dependency_to_maven_command "${DEP_PAIR}"
85+
# Format: {MavenPropertyName}={Version}
86+
dependency=$(echo "${DEP_PAIR}" | cut -d'=' -f1)
87+
version=$(echo "${DEP_PAIR}" | cut -d'=' -f2)
88+
MAVEN_COMMAND+=" -D${dependency}.version=${version}"
9589
done
9690
fi
9791

.github/workflows/dependency_compatibility_test.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
inputs:
99
dependencies-list:
1010
description: 'Comma-separated list of dependencies to test (Example format: protobuf=4.31.0,guava=33.4.8-jre).
11+
Note: The name should be the maven property. Find this value in the <properties> section in the pom.
1112
Do not include the `-D` prefix or `.version` suffix. Those values will be appended when generating
1213
the command. No input (default) will run the the upper-bound dependencies file.'
1314
required: false
@@ -34,7 +35,7 @@ jobs:
3435
run: echo "DEPENDENCIES_LIST=${{ github.event.inputs.dependencies-list }}" >> $GITHUB_ENV
3536

3637
# Run in the root module which should test for everything except for showcase
37-
- name: Perform Dependency Compatibility Testing
38+
- name: Perform Dependency Compatibility Unit Testing
3839
shell: bash
3940
run: |
4041
if [[ -n "${{ env.DEPENDENCIES_LIST }}" ]]; then
@@ -63,7 +64,7 @@ jobs:
6364
cd -
6465
6566
# Run Showcase's Integration Tests
66-
- name: Perform Dependency Compatibility Testing (Showcase only)
67+
- name: Perform Dependency Compatibility Integration Testing (Showcase Tests)
6768
shell: bash
6869
# Need to cd out of the directory to get the scripts as this step is run inside the java-showcase directory
6970
run: |

dependencies.txt

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,50 @@
11
# This file contains a list of dependencies and their versions to be tested for compatibility.
2-
# The format is key=value, where the key is the dependency name and the value is the version.
2+
# The format is `{GroupID}:{ArtifactID},{PropertyName}={Version}`. The GAV coordinates
3+
# (specifically the GroupID and ArtifactID) are parsed by renovate to find the artifact from Maven
4+
# Central. Version stores the currently known upper bound. PropertyName corresponds to the Maven
5+
# property value in the pom.xml (it is NOT a 1:1 mapping to the GAV).
36
# "1P" refers to First-Party dependencies (owned by Google).
47
# "3P" refers to Third-Party dependencies.
58

69
# Pom-Parent Dependencies
710
# These dependencies are declared: https://github.com/googleapis/sdk-platform-java/blob/main/gapic-generator-java-pom-parent/pom.xml
8-
javax.annotation-api=1.3.2
9-
grpc=1.75.0
10-
google.auth=1.39.1
11-
google.http-client=2.0.1
12-
gson=2.13.2
13-
guava=33.5.0-jre
14-
protobuf=4.32.1
15-
# Note: This opentelemetry version refers to the opentelemetry-bom
16-
opentelemetry=1.54.1
17-
errorprone=2.42.0
18-
j2objc-annotations=3.1
19-
threetenbp=1.7.2
20-
slf4j=2.0.17
11+
javax.annotation:javax.annotation-api,javax.annotation-api=1.3.2
12+
io.grpc:grpc-bom,grpc=1.74.0
13+
com.google.auth:google-auth-library-bom,google.auth=1.37.1
14+
com.google.http-client:google-http-client,google.http-client=1.47.1
15+
com.google.code.gson:gson,gson=2.13.1
16+
com.google.guava:guava,guava=33.4.8-jre
17+
com.google.protobuf:protobuf-java,protobuf=4.31.1
18+
io.opentelemetry:opentelemetry-bom,opentelemetry=1.52.0
19+
com.google.errorprone:error_prone_annotations,errorprone=2.41.0
20+
com.google.j2objc:j2objc-annotations,j2objc-annotations=3.1
21+
org.threeten:threetenbp,threetenbp=1.7.2
22+
org.slf4j:slf4j-api,slf4j=2.0.17
2123

2224
# 1P Shared-Deps
2325
# These dependencies are declared: https://github.com/googleapis/sdk-platform-java/blob/main/java-shared-dependencies/first-party-dependencies/pom.xml
24-
grpc-gcp=1.7.0
25-
google.oauth-client=1.39.0
26-
google.api-client=2.8.1
26+
com.google.cloud:grpc-gcp,grpc-gcp=1.6.1
27+
com.google.oauth-client:google-oauth-client,google.oauth-client=1.39.0
28+
com.google.api-client:google-api-client,google.api-client=2.8.1
2729

2830
# 3P Shared-Deps
2931
# These dependencies are declared: https://github.com/googleapis/sdk-platform-java/blob/main/java-shared-dependencies/third-party-dependencies/pom.xml
30-
threeten-extra=1.8.0
31-
opencensus=0.31.1
32-
findbugs=3.0.2
33-
jackson=2.20.0
34-
codec=1.19.0
35-
httpcomponents.httpcore=4.4.16
36-
httpcomponents.httpclient=4.5.14
37-
apache-httpclient-5=5.5.1
38-
apache-httpcore-5=5.3.6
39-
perfmark-api=0.27.0
32+
org.threeten:threeten-extra,threeten-extra=1.8.0
33+
io.opencensus:opencensus-api,opencensus=0.31.0
34+
com.google.code.findbugs:jsr305,findbugs=3.0.2
35+
com.fasterxml.jackson:jackson-bom,jackson=2.19.2
36+
commons-codec:commons-codec,codec=1.19.0
37+
org.apache.httpcomponents:httpclient,httpcomponents.httpclient=4.5.14
38+
org.apache.httpcomponents:httpcore,httpcomponents.httpcore=4.4.16
39+
org.apache.httpcomponents.client5:httpclient5,apache-httpclient-5=5.5
40+
org.apache.httpcomponents.core5:httpcore5,apache-httpcore-5=5.3.4
41+
io.perfmark:perfmark-api,perfmark-api=0.27.0
4042
# Note: This is the google opentelemetry exporter and not the general opentelemetry project
41-
google.cloud.opentelemetry=0.36.0
42-
flogger=0.9
43-
arrow=18.3.0
44-
dev.cel=0.11.0
45-
com.google.crypto.tink=1.18.0
43+
com.google.cloud.opentelemetry:exporter-metrics,google.cloud.opentelemetry=0.36.0
44+
com.google.flogger:flogger,flogger=0.9
45+
org.apache.arrow:arrow-memory-core,arrow=18.3.0
46+
dev.cel:cel,dev.cel=0.10.1
47+
com.google.crypto.tink:tink,com.google.crypto.tink=1.18.0
4648
# The follow opentelemetry dependencies have a different version from the opentelemetry-bom
47-
opentelemetry-semconv=1.37.0
48-
io.opentelemetry.contrib.opentelemetry-gcp-resources=1.50.0-alpha
49+
io.opentelemetry.semconv:opentelemetry-semconv,opentelemetry-semconv=1.34.0
50+
io.opentelemetry.contrib:opentelemetry-gcp-resources,io.opentelemetry.contrib.opentelemetry-gcp-resources=1.48.0-alpha

gapic-generator-java-pom-parent/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<properties>
2323
<skipUnitTests>false</skipUnitTests>
2424
<checkstyle.header.file>java.header</checkstyle.header.file>
25+
<maven.compiler.release>8</maven.compiler.release>
2526

2627
<!-- External dependencies, especially gRPC and Protobuf version, should be
2728
consistent across modules in this repository -->
@@ -33,7 +34,6 @@
3334
<guava.version>33.4.0-jre</guava.version>
3435
<protobuf.version>3.25.8</protobuf.version>
3536
<opentelemetry.version>1.47.0</opentelemetry.version>
36-
<maven.compiler.release>8</maven.compiler.release>
3737
<errorprone.version>2.38.0</errorprone.version>
3838
<j2objc-annotations.version>3.0.0</j2objc-annotations.version>
3939
<threetenbp.version>1.7.0</threetenbp.version>
@@ -214,4 +214,4 @@
214214
<url>https://repo1.maven.org/maven2</url>
215215
</repository>
216216
</repositories>
217-
</project>
217+
</project>

renovate.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"^library_generation/requirements\\.txt$"
1111
],
1212
"customManagers": [
13+
{
14+
"customType": "regex",
15+
"managerFilePatterns": ["/^dependencies\\.txt$/"],
16+
"matchStrings": ["(?<depName>.*),(.*)=(?<currentValue>.*)"],
17+
"datasourceTemplate": "maven"
18+
},
1319
{
1420
"customType": "regex",
1521
"fileMatch": [

0 commit comments

Comments
 (0)