Commit 0be1e96
authored
fix(hermetic-build): use public maven metadata for latest version inference (#3853)
Currently, the `get_latest_released_version()` function returns `2.59.0` for gapic-generator-java. This is not correct and is due to an ongoing issue with Maven. This PR uses the alternative `maven-metadata.xml` files instead, which contains a `metadata/versioning/latest` entry always pointing to the latest version. ```bash [hi on] diegomarquezp:~$ function get_latest_released_version() { local group_id=$1 local artifact_id=$2 group_id_url_path="$(sed 's|\.|/|g' <<< "${group_id}")" url="https://repo1.maven.org/maven2/${group_id_url_path}/${artifact_id}/maven-metadata.xml" xml_content=$(curl -s --fail "${url}") latest=$(xmllint --xpath 'metadata/versioning/latest/text()' - <<< "${xml_content}") if [[ -z "${latest}" ]]; then echo "The latest version of ${group_id}:${artifact_id} is empty." echo "The returned json from maven.org is invalid: ${json_content}" exit 1 else echo "${latest}" fi } [hi on] diegomarquezp:~$ get_latest_released_version com.google.api gapic-generator-java 2.60.0 ```1 parent 44355b2 commit 0be1e96
File tree
2 files changed
+7
-2
lines changed- hermetic_build/library_generation/owlbot/templates/java_library/.github
- scripts
- workflows
2 files changed
+7
-2
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
0 commit comments