Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update owlbot configs to copy generated samples #8790

Merged
merged 20 commits into from
Jan 18, 2023
Merged

Conversation

alicejli
Copy link
Contributor

@alicejli alicejli commented Nov 15, 2022

Fixes #8767

Tested with local Owlbot invocation using the following command (using java-analyticshub as the example):

docker run --rm --user $(id -u):$(id -g) \
  -v $(pwd):/repo -v /tmp/googleapis-gen:/googleapis-gen -w /repo \
  --env HOME=/tmp \
  gcr.io/cloud-devrel-public-resources/owlbot-cli:latest copy-code \
  --source-repo=/googleapis-gen \
  --config-file=java-analyticshub/.OwlBot.yaml

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Nov 15, 2022
@alicejli alicejli marked this pull request as ready for review November 15, 2022 17:58
@alicejli alicejli requested review from suztomo and blakeli0 November 15, 2022 17:59
Copy link
Member

@meltsufin meltsufin left a comment

Choose a reason for hiding this comment

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

Please merge in main and ensure that all ci checks are green.

@alicejli alicejli force-pushed the updateOwlBotYamls branch 2 times, most recently from 73577dd to 9ead407 Compare November 18, 2022 17:48
@alicejli alicejli added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 18, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 18, 2022
@alicejli alicejli requested a review from meltsufin November 21, 2022 16:00
Copy link
Member

@meltsufin meltsufin left a comment

Choose a reason for hiding this comment

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

How did you apply the script? Did you run this?

for F in `find . -maxdepth 2 -name '.OwlBot.yaml'`; do sh generation/set_owlbot_config.sh $F; done

I see some small differences when I run this command on the branch.

Also, would you mind adding a test to generated_files_sync.yaml for this script?

generation/set_owlbot_config.sh Outdated Show resolved Hide resolved
generation/set_owlbot_config.sh Outdated Show resolved Hide resolved
@alicejli alicejli added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 28, 2022
@alicejli
Copy link
Contributor Author

How did you apply the script? Did you run this?

for F in `find . -maxdepth 2 -name '.OwlBot.yaml'`; do sh generation/set_owlbot_config.sh $F; done

I see some small differences when I run this command on the branch.

Yes, that's what I ran. I had to manually edit java-grafeas/.OwlBot.yaml and java-accesscontextmanager/.OwlBot.yaml because they had an exceptional pattern compared to the other ones. Were those the same ones you noticed differences in?

Also, would you mind adding a test to generated_files_sync.yaml for this script?

Sorry I'm having trouble finding where that file is - do you mind linking? Thank you!

@alicejli
Copy link
Contributor Author

Chatted with Mike offline that the test should be added here: https://github.com/googleapis/google-cloud-java/blob/main/.github/workflows/generated_files_sync.yaml

@alicejli
Copy link
Contributor Author

@meltsufin I chatted with @suztomo about this and it seemed the best way to test this was to run owlbot locally to confirm the correct directories get copied over. I did that and confirmed the updated .OwlbotYaml files are working as intended, but we're not sure of a good way to actually add a test for these files via a script.

Do you have an idea of how you'd like to add a test? Or is testing Owlbot locally on this PR sufficient? Thanks!

@meltsufin
Copy link
Member

@meltsufin I chatted with @suztomo about this and it seemed the best way to test this was to run owlbot locally to confirm the correct directories get copied over. I did that and confirmed the updated .OwlbotYaml files are working as intended, but we're not sure of a good way to actually add a test for these files via a script.

Do you have an idea of how you'd like to add a test? Or is testing Owlbot locally on this PR sufficient? Thanks!

The manual test is good, but I was talking more about the kind of tests that generated_files_sync.yaml has, where you just run the script (generation/set_owlbot_config.sh) for all modules and verify that no files have changed as a side-effect.

@alicejli alicejli requested a review from meltsufin January 13, 2023 16:25
@alicejli
Copy link
Contributor Author

The manual test is good, but I was talking more about the kind of tests that generated_files_sync.yaml has, where you just run the script (generation/set_owlbot_config.sh) for all modules and verify that no files have changed as a side-effect.

Ahh I think I understand - I added a check to run set_owlbot_config.sh in generated_files_sync.yaml. Do you mind taking another look to see if that is sufficient?

@alicejli alicejli removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 13, 2023
# Checks that each module's .OwlbotYaml file is correctly configured according to the template set in `set_owlbot_config.sh`

OWLBOT_FILE=$1
for F in $(find . -maxdepth 2 -name '.OwlBot.yaml'); do sh generation/set_owlbot_config.sh "$F"; done
Copy link
Member

Choose a reason for hiding this comment

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

Since this actually modifies the files, and doesn't really check, I think the file name doesn't really make sense. Would it make sense to just add this loop to set_owlbot_config.sh and update places where it's used? I think we always want to apply this to all .OwlBot.yaml files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I see what you're saying; I did a little more digging and it looks like set_owlbot_config.sh is actually run as part of merge_repository.sh (https://github.com/googleapis/google-cloud-java/blob/main/generation/merge_repository.sh#L121) which is run regularly as a workflow: https://github.com/googleapis/google-cloud-java/blob/main/.github/workflows/merge_repository.yaml#L22.

My sense is that actually would suffice as the check for the Owlbot.yaml files - what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

That check doesn't apply to the entire repo and might go away in the future. I think the check your added is valuable beyond that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointers offline - let me know if this update works!

Copy link
Member

Choose a reason for hiding this comment

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

This is good, but I think you need to update 2 places where this script is used: bootstrap.sh and merge_repository.sh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhh good catch; I updated merge_repository.sh. I think bootstrap.sh doesn't exist anymore as it was renamed to merge_repository.sh here: https://github.com/googleapis/google-cloud-java/pull/8832/files#diff-b082d5538e9aa0d75efd9ec5915d2a9462bd1237209225fa95b8be79517c0a63

Copy link
Member

Choose a reason for hiding this comment

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

I see that you updated merge_repository.sh, but bootstrap.sh still needs an update.

Copy link
Member

Choose a reason for hiding this comment

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

Right, never mind! I think it's still in my local for some reason.

@@ -59,6 +59,17 @@ jobs:
- name: Fail if there's any difference
run: git --no-pager diff --exit-code

owlbot-yaml:
Copy link
Member

Choose a reason for hiding this comment

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

Yes, this is what I had in mind. Thanks!

@alicejli alicejli merged commit 5a404a8 into main Jan 18, 2023
@alicejli alicejli deleted the updateOwlBotYamls branch January 18, 2023 21:30
@release-please release-please bot mentioned this pull request Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure generated samples directory is being copied over from googleapis-gen
3 participants