Reorgnize dependencies and variables

pull/17505/head
Lidi Zheng 6 years ago
parent 6692429f31
commit eafb1d527d
  1. 5
      tools/internal_ci/helper_scripts/prepare_build_linux_perf_rc
  2. 4
      tools/internal_ci/helper_scripts/prepare_build_macos_rc
  3. 35
      tools/run_tests/python_utils/check_on_pr.py

@ -34,4 +34,9 @@ fi
sudo pip install tabulate
# Python dependencies for tools/run_tests/python_utils/check_on_pr.py
sudo -H pip install pyjwt cryptography requests
ls -al "${KOKORO_KEYSTORE_DIR}/73836_grpc_checks_private_key"
git submodule update --init

@ -31,6 +31,8 @@ date
pip install google-api-python-client oauth2client --user python
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json
ls -al "${KOKORO_KEYSTORE_DIR}/73836_grpc_checks_private_key"
# If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests
if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ]; then
set +x
@ -63,7 +65,7 @@ time pod repo update # needed by python
# python
time pip install virtualenv --user python
time pip install -U Mako six tox setuptools twisted pyyaml --user python
time pip install -U Mako six tox setuptools twisted pyyaml pyjwt cryptography requests --user python
export PYTHONPATH=/Library/Python/3.4/site-packages
# Install Python 3.7

@ -25,21 +25,21 @@ _GITHUB_API_PREFIX = 'https://api.github.com'
_GITHUB_REPO = 'grpc/grpc'
_GITHUB_APP_ID = 22338
_INSTALLATION_ID = 519109
_GITHUB_APP_KEY = open(
os.path.join(os.environ['KOKORO_KEYSTORE_DIR'], '73836_grpc_checks_private_key'),
'rb').read()
_ACCESS_TOKEN_CACHE = None
def _jwt_token():
github_app_key = open(
os.path.join(os.environ['KOKORO_KEYSTORE_DIR'],
'73836_grpc_checks_private_key'), 'rb').read()
return jwt.encode(
{
'iat': int(time.time()),
'exp': int(time.time() + 60 * 10), # expire in 10 minutes
'iss': _GITHUB_APP_ID,
},
_GITHUB_APP_KEY,
github_app_key,
algorithm='RS256')
@ -90,25 +90,26 @@ def check_on_pr(name, summary, success=True):
summary: A str in Markdown to be used as the detail information of the check.
success: A bool indicates whether the check is succeed or not.
"""
if 'KOKORO_GIT_COMMIT' not in os.environ:
print('Missing KOKORO_GIT_COMMIT env var: not checking')
return
if 'KOKORO_KEYSTORE_DIR' not in os.environ:
print('Missing KOKORO_KEYSTORE_DIR env var: not checking')
return
if 'ghprbPullId' not in os.environ:
print('Missing ghprbPullId env var: not commenting')
print('Missing ghprbPullId env var: not checking')
return
commit = _latest_commit()
completion_time = str(
datetime.datetime.utcnow().replace(microsecond=0).isoformat()) + 'Z'
resp = _call(
'/repos/%s/check-runs' % _GITHUB_REPO,
method='POST',
json={
'name':
name,
'head_sha':
commit['sha'],
'status':
'completed',
'completed_at':
'%sZ' %
datetime.datetime.utcnow().replace(microsecond=0).isoformat(),
'conclusion':
'success' if success else 'failure',
'name': name,
'head_sha': os.environ['KOKORO_GIT_COMMIT'],
'status': 'completed',
'completed_at': completion_time,
'conclusion': 'success' if success else 'failure',
'output': {
'title': name,
'summary': summary,

Loading…
Cancel
Save