Skip to content

Commit e542af8

Browse files
authored
chore: Change all the references of OwlBot.yaml to OwlBot-hermetic.yaml. (#2642)
This is follow up of googleapis/google-cloud-java#10696. The hermetic build generation process would fail without this PR due to unable to find OwlBot.yaml files. This PR changes all the references of `OwlBot.yaml` to `OwlBot-hermetic.yaml`, removes `OwlBot.yaml` from a few places that don't need to reference it in the first places.
1 parent 2c93542 commit e542af8

File tree

10 files changed

+44
-53
lines changed

10 files changed

+44
-53
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ target/
2424
# library generation
2525
**/output/
2626
**/googleapis
27-
library_generation/test/**/golden*/
2827
library_generation/test/resources/test_monorepo_postprocessing/
2928
**/*egg-info/
3029
**/build/

library_generation/README.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,24 @@ of versions.txt.
5555
For each module (e.g. `google-cloud-java/java-asset`), the following files/folders
5656
will be created/modified:
5757

58-
| Name | Notes |
59-
|:----------------------------|:-------------------------------------------------------------------------|
60-
| google-*/ | Source code generated by gapic-generator-java |
61-
| google-*/pom.xml | Only be generated if it does not exist |
62-
| grpc-*/ | Source code generated by grpc generator, one per each version |
63-
| grpc-*/pom.xml | Only be generated if it does not exist |
64-
| proto-*/ | Source code generated by Protobuf default compiler, one per each version |
65-
| proto-*/pom.xml | Only be generated if it does not exist |
66-
| samples/snippets/generated/ | Only be generated if `include_samples` is set to true |
67-
| google-*-bom/pom.xml | Library BOM, only be generated if it does not exist |
68-
| pom.xml | Library parent BOM, only be generated if it does not exist |
69-
| .repo-metadata.json | Always generated from inputs |
70-
| .OwlBot.yaml | Only be generated from a template if it does not exist |
71-
| owlbot.py | Only be generated from a template if it does not exist |
72-
| README.md | Always generated from inputs |
73-
| gapic-libraries-bom/pom.xml | Always generated from inputs |
74-
| pom.xml (repo root dir) | Always generated from inputs |
75-
| versions.txt | New entries will be added if they don’t exist |
58+
| Name | Notes |
59+
|:------------------------------------|:-------------------------------------------------------------------------|
60+
| google-*/ | Source code generated by gapic-generator-java |
61+
| google-*/pom.xml | Only be generated if it does not exist |
62+
| grpc-*/ | Source code generated by grpc generator, one per each version |
63+
| grpc-*/pom.xml | Only be generated if it does not exist |
64+
| proto-*/ | Source code generated by Protobuf default compiler, one per each version |
65+
| proto-*/pom.xml | Only be generated if it does not exist |
66+
| samples/snippets/generated/ | Only be generated if `include_samples` is set to true |
67+
| google-*-bom/pom.xml | Library BOM, only be generated if it does not exist |
68+
| pom.xml | Library parent BOM, only be generated if it does not exist |
69+
| .repo-metadata.json | Always generated from inputs |
70+
| .OwlBot-hermetic.yaml | Only be generated from a template if it does not exist |
71+
| owlbot.py | Only be generated from a template if it does not exist |
72+
| README.md | Always generated from inputs |
73+
| gapic-libraries-bom/pom.xml | Always generated from inputs |
74+
| pom.xml (repo root dir) | Always generated from inputs |
75+
| versions.txt | New entries will be added if they don’t exist |
7676

7777
### googleapis commit history
7878

@@ -231,7 +231,7 @@ $repository_path
231231
| |_samples
232232
| | |_snippets
233233
| | | |_generated
234-
| |_.OwlBot.yaml
234+
| |_.OwlBot-hermetic.yaml
235235
| |_.repo-metadata.json
236236
| |_owlbot.py
237237
| |_pom.xml
@@ -275,7 +275,7 @@ $repository_path
275275
| |_samples
276276
| | |_snippets
277277
| | | |_generated
278-
| |_.OwlBot.yaml
278+
| |_.OwlBot-hermetic.yaml
279279
| |_.repo-metadata.json
280280
| |_owlbot.py
281281
| |_pom.xml

library_generation/generate_composed_library.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def generate_composed_library(
7272
build_file_folder = Path(f"{output_folder}/{gapic.proto_path}").resolve()
7373
print(f"build_file_folder: {build_file_folder}")
7474
gapic_inputs = parse_build_file(build_file_folder, gapic.proto_path)
75-
# generate prerequisite files (.repo-metadata.json, .OwlBot.yaml,
75+
# generate prerequisite files (.repo-metadata.json, .OwlBot-hermetic.yaml,
7676
# owlbot.py) here because transport is parsed from BUILD.bazel,
7777
# which lives in a versioned proto_path.
7878
util.generate_prerequisite_files(

library_generation/owlbot/bin/entrypoint.sh

+4-13
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,10 @@ set -ex
2727
scripts_root=$1
2828
versions_file=$2
2929
configuration_yaml=$3
30+
is_monorepo=$4
3031

3132

32-
# This script can be used to process HW libraries and monorepo
33-
# (google-cloud-java) libraries, which require a slightly different treatment
34-
# monorepo folders have an .OwlBot.yaml file in the module folder (e.g.
35-
# java-asset/.OwlBot.yaml), whereas HW libraries have the yaml in
36-
# `.github/.OwlBot.yaml`
37-
monorepo="false"
38-
if [[ -f "$(pwd)/.OwlBot.yaml" ]]; then
39-
monorepo="true"
40-
fi
41-
42-
if [[ "${monorepo}" == "true" ]]; then
33+
if [[ "${is_monorepo}" == "true" ]]; then
4334
mv owl-bot-staging/* temp
4435
rm -rd owl-bot-staging/
4536
mv temp owl-bot-staging
@@ -50,7 +41,7 @@ fi
5041

5142
# apply repo templates
5243
echo "Rendering templates"
53-
python3 "${scripts_root}/owlbot/src/apply_repo_templates.py" "${configuration_yaml}" "${monorepo}"
44+
python3 "${scripts_root}/owlbot/src/apply_repo_templates.py" "${configuration_yaml}" "${is_monorepo}"
5445

5546
# templates as well as retrieving files from owl-bot-staging
5647
echo "Retrieving files from owl-bot-staging directory..."
@@ -66,7 +57,7 @@ echo "...done"
6657

6758
# write or restore pom.xml files
6859
echo "Generating missing pom.xml..."
69-
python3 "${scripts_root}/owlbot/src/fix-poms.py" "${versions_file}" "${monorepo}"
60+
python3 "${scripts_root}/owlbot/src/fix-poms.py" "${versions_file}" "${is_monorepo}"
7061
echo "...done"
7162

7263
# write or restore clirr-ignored-differences.xml

library_generation/postprocess_library.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# has the following requirements
1010
# - a .repo-metadata.json file must be present
1111
# - an owlbot.py file must be present
12-
# - an .OwlBot.yaml file must be present
12+
# - an .OwlBot-hermetic.yaml file must be present
1313
# 2 - preprocessed_sources_path: used to transfer the raw grpc, proto and gapic
1414
# libraries into the postprocessing_target via copy-code
1515
# 3 - versions_file: path to file containing versions to be applied to the poms
@@ -33,6 +33,7 @@ owlbot_cli_image_sha=$5
3333
synthtool_commitish=$6
3434
is_monorepo=$7
3535
configuration_yaml_path=$8
36+
owlbot_yaml_file_name=".OwlBot-hermetic.yaml"
3637

3738
source "${scripts_root}"/utils/utilities.sh
3839

@@ -44,7 +45,7 @@ for required_input in "${required_inputs[@]}"; do
4445
fi
4546
done
4647

47-
for owlbot_file in ".repo-metadata.json" "owlbot.py" ".OwlBot.yaml"
48+
for owlbot_file in ".repo-metadata.json" "owlbot.py" "${owlbot_yaml_file_name}"
4849
do
4950
if [[ $(find "${postprocessing_target}" -name "${owlbot_file}" | wc -l) -eq 0 ]]; then
5051
echo "necessary file for postprocessing '${owlbot_file}' was not found in postprocessing_target"
@@ -59,10 +60,10 @@ if [[ -z "${owlbot_cli_source_folder}" ]]; then
5960
fi
6061

6162

62-
# we determine the location of the .OwlBot.yaml file by checking if the target
63+
# we determine the location of the .OwlBot-hermetic.yaml file by checking if the target
6364
# folder is a monorepo folder or not
6465
if [[ "${is_monorepo}" == "true" ]]; then
65-
# the deep-remove-regex and deep-preserve-regex of the .OwlBot.yaml
66+
# the deep-remove-regex and deep-preserve-regex of the .OwlBot-hermetic.yaml
6667
# files in the monorepo libraries assume that `copy-code` is run
6768
# from the root of the monorepo. However, we call `copy-code` from inside each
6869
# library, so a path like `/java-asset/google-.*/src` will not have
@@ -74,12 +75,12 @@ if [[ "${is_monorepo}" == "true" ]]; then
7475
# - "/google-.*/src"
7576

7677
library_name=$(basename "${postprocessing_target}")
77-
cat "${postprocessing_target}/.OwlBot.yaml" \
78+
cat "${postprocessing_target}/${owlbot_yaml_file_name}" \
7879
| sed "s/- \"\/${library_name}/ - \"/" \
7980
> "${postprocessing_target}/.OwlBot.hermetic.yaml"
8081
owlbot_yaml_relative_path=".OwlBot.hermetic.yaml"
8182
else
82-
owlbot_yaml_relative_path=".github/.OwlBot.yaml"
83+
owlbot_yaml_relative_path=".github/${owlbot_yaml_file_name}"
8384
fi
8485

8586
# Default values for running copy-code directly from host
@@ -150,5 +151,5 @@ popd # temp dir
150151
# run the postprocessor
151152
echo 'running owl-bot post-processor'
152153
pushd "${postprocessing_target}"
153-
bash "${scripts_root}/owlbot/bin/entrypoint.sh" "${scripts_root}" "${versions_file}" "${configuration_yaml_path}"
154+
bash "${scripts_root}/owlbot/bin/entrypoint.sh" "${scripts_root}" "${versions_file}" "${configuration_yaml_path}" "${is_monorepo}"
154155
popd # postprocessing_target

library_generation/test/resources/integration/google-cloud-java/current_generation_config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
gapic_generator_version: 2.37.0
1+
gapic_generator_version: 2.38.1
22
protobuf_version: 25.2
33
googleapis_commitish: 4ce0ff67a3d4509be641cbe47a35844ddc1268fc
44
owlbot_cli_image: sha256:623647ee79ac605858d09e60c1382a716c125fb776f69301b72de1cd35d49409
5-
synthtool_commitish: 5e1fb2032fa44bc170677b38713023b4fec51a4e
5+
synthtool_commitish: 6612ab8f3afcd5e292aecd647f0fa68812c9f5b5
66
template_excludes:
77
- ".github/*"
88
- ".kokoro/*"

library_generation/test/utilities_unit_tests.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ def test_generate_prerequisite_files_non_monorepo_success(self):
359359
# since this is a single library, we treat this as HW repository,
360360
# meaning that the owlbot yaml will be inside a .github folder
361361
file_comparator.compare_files(
362-
f"{library_path}/.github/.OwlBot.yaml",
363-
f"{library_path}/.OwlBot-golden.yaml",
362+
f"{library_path}/.github/.OwlBot-hermetic.yaml",
363+
f"{library_path}/.OwlBot-hermetic-golden.yaml",
364364
)
365365
file_comparator.compare_files(
366366
f"{library_path}/owlbot.py", f"{library_path}/owlbot-golden.py"
@@ -374,8 +374,8 @@ def test_generate_prerequisite_files_monorepo_success(self):
374374
f"{library_path}/.repo-metadata-monorepo-golden.json",
375375
)
376376
file_comparator.compare_files(
377-
f"{library_path}/.OwlBot.yaml",
378-
f"{library_path}/.OwlBot-golden.yaml",
377+
f"{library_path}/.OwlBot-hermetic.yaml",
378+
f"{library_path}/.OwlBot-hermetic-golden.yaml",
379379
)
380380
file_comparator.compare_files(
381381
f"{library_path}/owlbot.py", f"{library_path}/owlbot-golden.py"
@@ -432,7 +432,7 @@ def __setup_prerequisite_files(
432432
library_path = f"{resources_dir}/goldens"
433433
files = [
434434
f"{library_path}/.repo-metadata.json",
435-
f"{library_path}/.OwlBot.yaml",
435+
f"{library_path}/.OwlBot-hermetic.yaml",
436436
f"{library_path}/owlbot.py",
437437
]
438438
cleanup(files)

library_generation/utils/utilities.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ def generate_prerequisite_files(
280280
with open(f"{library_path}/{json_file}", "w") as fp:
281281
json.dump(repo_metadata, fp, indent=2)
282282

283-
# generate .OwlBot.yaml
284-
owlbot_yaml_file = ".OwlBot.yaml"
283+
# generate .OwlBot-hermetic.yaml
284+
owlbot_yaml_file = ".OwlBot-hermetic.yaml"
285285
path_to_owlbot_yaml_file = (
286286
f"{library_path}/{owlbot_yaml_file}"
287287
if config.is_monorepo()

library_generation/utils/utilities.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ get_proto_path_from_preprocessed_sources() {
276276

277277
# for a pre-processed library stored in $preprocessed_sources_path, a folder
278278
# tree is built on $target_folder so it looks like a googleapis-gen folder and
279-
# is therefore consumable by an .OwlBot.yaml file
279+
# is therefore consumable by OwlBot CLI
280280
build_owlbot_cli_source_folder() {
281281
local postprocessing_target=$1
282282
local target_folder=$2
@@ -288,7 +288,7 @@ build_owlbot_cli_source_folder() {
288288
owlbot_staging_folder="${postprocessing_target}/owl-bot-staging"
289289
mkdir -p "${owlbot_staging_folder}"
290290

291-
# By default (thanks to generation templates), .OwlBot.yaml `deep-copy` section
291+
# By default (thanks to generation templates), .OwlBot-hermetic.yaml `deep-copy` section
292292
# references a wildcard pattern matching a folder
293293
# ending with `-java` at the leaf of proto_path. We then use a generated-java
294294
# folder that will be picked up by copy-code

0 commit comments

Comments
 (0)