You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
```
Copy file name to clipboardExpand all lines: hermetic_build/library_generation/owlbot/templates/java_library/.github/scripts/update_generation_config.sh
Copy file name to clipboardExpand all lines: hermetic_build/library_generation/owlbot/templates/java_library/.github/workflows/update_generation_config.yaml
0 commit comments