Commit 9b1a34b
authored
fix: make generation config update logs verbose (#3764)
https://github.com/googleapis/java-storage/actions/runs/14629392782/job/41048556919
was a failed run of update_generation_config.sh.
The error message was misleading since jq failed because the command
that produced the input for such jq command had silently failed:
```
Updating files: 100% (7136/7136), done.
~/work/java-storage/java-storage/tmp-googleapis ~/work/java-storage/java-storage
Already up to date.
~/work/java-storage/java-storage
Update googleapis_commitish to 03baf05e13d9241ec8c19bdedb1d991b6ed7e115 in generation_config.yaml
jq: parse error: Invalid numeric literal at line 1, column 7
Error: Process completed with exit code 1.
```
If we enable the `xtrace` flag, we can see it was due to a 502 when
fetching the latest version of the generator:
```
Updating files: 100% (7136/7136), done.
+ pushd tmp-googleapis
~/google/java-storage/tmp-googleapis ~/google/java-storage
+ git pull
Already up to date.
++ git rev-parse HEAD
+ latest_commit=03baf05e13d9241ec8c19bdedb1d991b6ed7e115
+ popd
~/google/java-storage
+ rm -rf tmp-googleapis
+ update_config googleapis_commitish 03baf05e13d9241ec8c19bdedb1d991b6ed7e115 generation_config.yaml
+ local key_word=googleapis_commitish
+ local new_value=03baf05e13d9241ec8c19bdedb1d991b6ed7e115
+ local file=generation_config.yaml
+ echo 'Update googleapis_commitish to 03baf05e13d9241ec8c19bdedb1d991b6ed7e115 in generation_config.yaml'
Update googleapis_commitish to 03baf05e13d9241ec8c19bdedb1d991b6ed7e115 in generation_config.yaml
+ sed -i -e 's/^googleapis_commitish.*$/googleapis_commitish: 03baf05e13d9241ec8c19bdedb1d991b6ed7e115/' generation_config.yaml
++ get_latest_released_version com.google.api gapic-generator-java
++ local group_id=com.google.api
++ local artifact_id=gapic-generator-java
+++ curl -s 'https://search.maven.org/solrsearch/select?q=g:com.google.api+AND+a:gapic-generator-java&core=gav&rows=500&wt=json'
++ json_content='<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>'
+++ jq -r '.response.docs[] | select(.v | test("^[0-9]+(\\.[0-9]+)*$")) | .v'
+++ sort -V
+++ tail -n 1
jq: parse error: Invalid numeric literal at line 2, column 0
++ latest=
++ [[ -z '' ]]
++ echo 'The latest version of com.google.api:gapic-generator-java is empty.'
++ echo 'The returned json from maven.org is invalid: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>'
++ exit 1
+ latest_version='The latest version of com.google.api:gapic-generator-java is empty.
The returned json from maven.org is invalid: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>'
```
Such flag saves the developer a round trip for local reproduction.1 parent 0ef9e90 commit 9b1a34b
File tree
1 file changed
+1
-1
lines changed- hermetic_build/library_generation/owlbot/templates/java_library/.github/scripts
1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
0 commit comments