1
Bazel genrule에서 gcloud를 실행하는 데 문제가 있습니다. 파이썬 경로와 관련된 문제처럼 보입니다.bazel genrule에서 gcloud 호출하기
genrule(
name="foo",
outs=["bar"],
srcs=[":bar.enc"],
cmd="gcloud decrypt --location=global --keyring=foo --key=bar --plaintext-file [email protected] --ciphertext-file $(location bar.enc)"
)
는 예외입니다 :
ImportError: No module named traceback
에서 :
try:
gcloud_main = _import_gcloud_main()
except Exception as err: # pylint: disable=broad-except
# We want to catch *everything* here to display a nice message to the user
# pylint:disable=g-import-not-at-top
import traceback
# We DON'T want to suggest `gcloud components reinstall` here (ex. as
# opposed to the similar message in gcloud_main.py), as we know that no
# commands will work.
sys.stderr.write(
('ERROR: gcloud failed to load: {0}\n{1}\n\n'
'This usually indicates corruption in your gcloud installation or '
'problems with your Python interpreter.\n\n'
'Please verify that the following is the path to a working Python 2.7 '
'executable:\n'
' {2}\n\n'
'If it is not, please set the CLOUDSDK_PYTHON environment variable to '
'point to a working Python 2.7 executable.\n\n'
'If you are still experiencing problems, please reinstall the Cloud '
'SDK using the instructions here:\n'
' https://cloud.google.com/sdk/\n').format(
err,
'\n'.join(traceback.format_exc().splitlines()[2::2]),
sys.executable))
sys.exit(1)
내 질문
은 다음과 같습니다- 어떻게 genrule에서 나는 최고의 통화 gcloud합니까?
- 파이썬 경로를 지정하는 데 필요한 매개 변수는 무엇입니까?
- Bazel은 어떻게 차단합니까?
업데이트 : CLOUDSDK_PYTHON
을 지정하여 실행할 수 있습니다.
을 대부분 일하고있다. py_library 규칙은 올바른 데이터를 얻기 위해 몇 가지 데이터 파일과 추가 작업이 필요합니다. –