Skip to content

Commit

Permalink
feat(build): check username and python sanity (#11445)
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion authored Aug 28, 2023
1 parent dd9b362 commit feffc2e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build/kong_bindings.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ def _check_sanity(ctx):
"The following command is useful to check if Xcode is picked up by Bazel:\n" +
"eval `find /private/var/tmp/_bazel_*/|grep xcode-locator|head -n1`")

python = ctx.execute(["which", "python"]).stdout.strip()
if not python:
fail("rules_foreign_cc hasn't migrated to python3 on macOS yet, and your system doens't \n" +
"have a `python` binary. Consider create a symlink to `python3` and include in PATH:\n" +
"ln -s `which python3` /usr/local/bin/python\n" +
"export PATH=/usr/local/bin:$PATH bazel build <target>\n")

user = ctx.os.environ.get("USER", "")
if "@" in user:
fail("Bazel uses $USER in cache and rule_foreign_cc uses `@` in its sed command.\n" +
"However, your username contains a `@` character, which will cause build failure.\n" +
"Please rerun this build with:\n" +
"export USER=" + user.replace("@", "_") + " bazel build <target>")

def _load_bindings_impl(ctx):
_check_sanity(ctx)

Expand Down

1 comment on commit feffc2e

@khcp-gha-bot
Copy link

Choose a reason for hiding this comment

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

Bazel Build

Docker image available kong/kong:feffc2e6ac75306bcd4d8c9f61e8b7967dc6af09
Artifacts available https://github.com/Kong/kong/actions/runs/5997450847

Please sign in to comment.