kubernetes / contributor-site

Code for kubernetes.dev
https://www.kubernetes.dev
Apache License 2.0
63 stars 147 forks source link

Make `hack/gen-content.sh` discover GNU `grep` and `sed` on macOS #492

Closed embik closed 3 months ago

embik commented 3 months ago

Running hack/gen-content.sh falls apart when running on macOS if grep doesn't point to GNU grep due to the -P flag heavily being used. This is normally not the case (you can install it via homebrew and override the grep name, but that's not the default), so I've adjusted the script to discover $GREP and $SED (just in case sed also acts up and I didn't notice) and set them to the GNU versions (which are prefixed with a g on installation). The discovery heuristics are simple but seem to be effective.

I'm not sure if this is something that is interesting to this repository (since you can also run this in a container), just wanted to submit it in case it would be useful to the community. Feel free to tell me that this will not be merged.

k8s-ci-robot commented 3 months ago

Welcome @embik!

It looks like this is your first PR to kubernetes/contributor-site 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/contributor-site has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

stmcginnis commented 3 months ago

I've had to do something similar to this in the past. I don't have a macOS system to test on right now, but this looks like it covers the detection and use throughout.

At any rate, testing with the changes on a Linux system doesn't show anything broken by the change, so: /lgtm

k8s-ci-robot commented 3 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: embik, mrbobbytables

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes/contributor-site/blob/master/OWNERS)~~ [mrbobbytables] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment