Skip to content

Conversation

diegomarquezp
Copy link
Contributor

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.

[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

@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label Jun 30, 2025
@diegomarquezp
Copy link
Contributor Author

Follow up: HW libraries without hermetic build (e.g. java-bigquery).

JoeWang1127
JoeWang1127 previously approved these changes Jun 30, 2025
suztomo
suztomo previously approved these changes Jun 30, 2025
Copy link
Member

@suztomo suztomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check xmllint is available in the container before merging this?

@diegomarquezp diegomarquezp dismissed stale reviews from suztomo and JoeWang1127 via 5e51016 June 30, 2025 20:27
@diegomarquezp
Copy link
Contributor Author

Can you check xmllint is available in the container before merging this?

Confirming manually in java-storage: googleapis/java-storage#3181
The action resulted in xmllint: command not found

Installing using sudo apt install -y libxml2-utils solves the problem.

I modified the template.

Thanks a lot for the catch, @suztomo!

@suztomo
Copy link
Member

suztomo commented Jun 30, 2025

Thank you.

@diegomarquezp diegomarquezp enabled auto-merge (squash) June 30, 2025 20:36
Copy link

Copy link

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@diegomarquezp diegomarquezp merged commit 0be1e96 into main Jun 30, 2025
57 of 60 checks passed
@diegomarquezp diegomarquezp deleted the fix-maven-search-template branch June 30, 2025 20:51
mpeddada1 pushed a commit that referenced this pull request Jul 8, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>2.60.1</summary>

##
[2.60.1](v2.60.0...v2.60.1)
(2025-07-08)


### Bug Fixes

* **hermetic-build:** use public maven metadata for latest version
inference
([#3853](#3853))
([0be1e96](0be1e96))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
diegomarquezp added a commit to googleapis/java-spanner that referenced this pull request Jul 24, 2025
Unfortunately, googleapis/sdk-platform-java#3853 cannot be automatically propagated. 

This PR manually updates this script with the latest.
diegomarquezp added a commit to googleapis/java-storage that referenced this pull request Jul 24, 2025
Unfortunately, googleapis/sdk-platform-java#3853 cannot be automatically propagated. 

This PR manually updates this script with the latest.
BenWhitehead pushed a commit to googleapis/java-storage that referenced this pull request Jul 24, 2025
Unfortunately, googleapis/sdk-platform-java#3853 cannot be automatically propagated. 

This PR manually updates this script with the latest.
diegomarquezp added a commit to googleapis/java-datastore that referenced this pull request Jul 24, 2025
Unfortunately, googleapis/sdk-platform-java#3853 cannot be automatically propagated.

This PR manually updates this script with the latest.
diegomarquezp added a commit to googleapis/java-spanner that referenced this pull request Jul 28, 2025
* chore: manual update of update_generation_config.sh

Unfortunately, googleapis/sdk-platform-java#3853 cannot be automatically propagated. 

This PR manually updates this script with the latest.

* chore: generate libraries at Thu Jul 24 16:12:02 UTC 2025

* chore: update yaml as well

* chore: bring back the script

* chore: generate libraries at Thu Jul 24 16:17:24 UTC 2025

* chore: include yaml changes as well

* chore: generate libraries at Thu Jul 24 17:52:43 UTC 2025

* Revert "chore: generate libraries at Thu Jul 24 17:52:43 UTC 2025"

This reverts commit 3322513.

* chore: generate libraries at Thu Jul 24 18:50:37 UTC 2025

* Revert "chore: generate libraries at Thu Jul 24 18:50:37 UTC 2025"

This reverts commit a1c5956.

* chore: generate libraries at Thu Jul 24 18:54:36 UTC 2025

* Revert "chore: generate libraries at Thu Jul 24 18:54:36 UTC 2025"

This reverts commit 53c4dd7.

---------

Co-authored-by: cloud-java-bot <[email protected]>
diegomarquezp added a commit to googleapis/google-cloud-java that referenced this pull request Jul 28, 2025
Unfortunately, googleapis/sdk-platform-java#3853 cannot be automatically propagated. 

This PR manually updates this script with the latest.
diegomarquezp added a commit to googleapis/google-cloud-java that referenced this pull request Jul 28, 2025
Unfortunately, googleapis/sdk-platform-java#3853
cannot be automatically propagated.

This PR manually updates this script with the latest.
diegomarquezp added a commit to googleapis/java-datastore that referenced this pull request Jul 28, 2025
Unfortunately, googleapis/sdk-platform-java#3853 cannot be automatically propagated.

This PR manually updates this script with the latest.
lqiu96 pushed a commit that referenced this pull request Aug 21, 2025
…erence (#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
```
lqiu96 pushed a commit that referenced this pull request Aug 21, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>2.60.1</summary>

##
[2.60.1](v2.60.0...v2.60.1)
(2025-07-08)


### Bug Fixes

* **hermetic-build:** use public maven metadata for latest version
inference
([#3853](#3853))
([0be1e96](0be1e96))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
lqiu96 pushed a commit that referenced this pull request Aug 27, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>2.60.1</summary>

##
[2.60.1](v2.60.0...v2.60.1)
(2025-07-08)


### Bug Fixes

* **hermetic-build:** use public maven metadata for latest version
inference
([#3853](#3853))
([0be1e96](0be1e96))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants