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

Run find in a cross-platform manner #72

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Run find in a cross-platform manner #72

merged 1 commit into from
Jan 24, 2024

Conversation

ajm188
Copy link
Contributor

@ajm188 ajm188 commented Jan 24, 2024

Managed to finally get my hands on a relevant log entry and saw:

{"level":"error","github_event_type":"pull_request","github_delivery_id":"<omitted>","error":"Failed to `find` latest docs version to generate cobradocs preview for https://github.com/vitessio/vitess/pull/14789: exit status 1\nstderr: find: unknown predicate `-sE'\n\nstdout: ","time":"2024-01-24T13:13:22Z","message":"Unexpected error handling webhook"}

So, we need to remove -sE on unix, but not on darwin.

-E before the path is replaced by -regextype posix-extended after the path.

There is no replacement for -s on non-darwin unix, so we now need to pipe to sort to sort in dictionary order.


Tested running this on both my laptop:

➜  vtwebsite git:(cross-platform-find) ✗ bash -c "find -E content/en/docs -maxdepth 1 -type d -regex '.*/[0-9]+.[0-9]+' | sort -d"
content/en/docs/16.0
content/en/docs/17.0
content/en/docs/18.0
content/en/docs/19.0

And on the bot:

vitess-bot:website# bash -c "find content/en/docs -regextype posix-extended -maxdepth 1 -type d -regex '.*/[0-9]+.[0-9]+' | sort -d"
content/en/docs/16.0
content/en/docs/17.0
content/en/docs/18.0
content/en/docs/19.0

I believe this will fix #63 but I will close manually after verifying.

Managed to finally get my hands on a relevant log entry and saw:

```
{"level":"error","github_event_type":"pull_request","github_delivery_id":"<omitted>","error":"Failed to `find` latest docs version to generate cobradocs preview for vitessio/vitess#14789: exit status 1\nstderr: find: unknown predicate `-sE'\n\nstdout: ","time":"2024-01-24T13:13:22Z","message":"Unexpected error handling webhook"}
```

So, we need to remove `-sE` on unix, but not on darwin.

`-E` _before_ the path is replaced by `-regextype posix-extended` _after_
the path.

There is no replacement for `-s` on non-darwin unix, so we now need to
pipe to `sort` to sort in dictionary order.

Signed-off-by: Andrew Mason <[email protected]>
@ajm188 ajm188 requested a review from frouioui as a code owner January 24, 2024 15:04
@frouioui frouioui merged commit 9ca16b4 into main Jan 24, 2024
1 check passed
@frouioui frouioui deleted the cross-platform-find branch January 24, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support previewing doc changes on open PRs
2 participants