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

build(python): exit with success status if no samples found #1153

Merged
merged 3 commits into from
Jul 14, 2021

Conversation

busunkim96
Copy link
Contributor

@busunkim96 busunkim96 commented Jul 13, 2021

Look for requirements.txt in samples to check if any samples exist. The current check for samples/ doesn't always work as some repos have placeholder samples directories with READMEs.

This will make it possible to add samples kokoro jobs to every repository and remove custom sync repo settings configs.

EDIT: This doesn't seem to work correctly for more deeply nested directories, I will look around to find something that works.

@busunkim96 busunkim96 requested a review from a team as a code owner July 13, 2021 22:11
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 13, 2021
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Jul 13, 2021
@busunkim96 busunkim96 changed the title build(python): successfully exit if no samples found build(python): exit with success status if no samples found Jul 13, 2021
@busunkim96 busunkim96 added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 13, 2021
@busunkim96 busunkim96 removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 13, 2021
@busunkim96 busunkim96 requested a review from parthea July 13, 2021 22:40
@busunkim96 busunkim96 merged commit 53ea389 into master Jul 14, 2021
@busunkim96 busunkim96 deleted the python-ignore-empty-samples branch July 14, 2021 14:39
@@ -21,7 +21,7 @@ set -eo pipefail
shopt -s globstar

# Exit early if samples don't exist
if ! compgen -G "./samples/**/requirements.txt" > /dev/null; then
if ! find samples -name 'requirements.txt' | grep -q .; then
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, find is going to emit a message on stderr for the case that the samples directory doesn't exist, e.g.:

$ find nonesuch -name foobar.txt
find: ‘nonesuch’: No such file or directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants