Merge pull request #16348 from jtattermusch/benchmark_kokoro_metadata

Correctly set performance job metadata on kokoro
pull/16353/head
Jan Tattermusch 7 years ago committed by GitHub
commit 1973af7453
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      tools/run_tests/performance/bq_upload_result.py
  2. 14
      tools/run_tests/python_utils/upload_test_results.py

@ -128,14 +128,16 @@ def _flatten_result_inplace(scenario_result):
def _populate_metadata_inplace(scenario_result): def _populate_metadata_inplace(scenario_result):
"""Populates metadata based on environment variables set by Jenkins.""" """Populates metadata based on environment variables set by Jenkins."""
# NOTE: Grabbing the Jenkins environment variables will only work if the # NOTE: Grabbing the Kokoro environment variables will only work if the
# driver is running locally on the same machine where Jenkins has started # driver is running locally on the same machine where Kokoro has started
# the job. For our setup, this is currently the case, so just assume that. # the job. For our setup, this is currently the case, so just assume that.
build_number = os.getenv('BUILD_NUMBER') build_number = os.getenv('KOKORO_BUILD_NUMBER')
build_url = os.getenv('BUILD_URL') build_url = 'https://source.cloud.google.com/results/invocations/%s' % os.getenv(
job_name = os.getenv('JOB_NAME') 'KOKORO_BUILD_ID')
git_commit = os.getenv('GIT_COMMIT') job_name = os.getenv('KOKORO_JOB_NAME')
git_commit = os.getenv('KOKORO_GIT_COMMIT')
# actual commit is the actual head of PR that is getting tested # actual commit is the actual head of PR that is getting tested
# TODO(jtattermusch): unclear how to obtain on Kokoro
git_actual_commit = os.getenv('ghprbActualCommit') git_actual_commit = os.getenv('ghprbActualCommit')
utc_timestamp = str(calendar.timegm(time.gmtime())) utc_timestamp = str(calendar.timegm(time.gmtime()))

@ -68,15 +68,13 @@ _INTEROP_RESULTS_SCHEMA = [
def _get_build_metadata(test_results): def _get_build_metadata(test_results):
"""Add Jenkins/Kokoro build metadata to test_results based on environment """Add Kokoro build metadata to test_results based on environment
variables set by Jenkins/Kokoro. variables set by Kokoro.
""" """
build_id = os.getenv('BUILD_ID') or os.getenv('KOKORO_BUILD_NUMBER') build_id = os.getenv('KOKORO_BUILD_NUMBER')
build_url = os.getenv('BUILD_URL') build_url = 'https://source.cloud.google.com/results/invocations/%s' % os.getenv(
if os.getenv('KOKORO_BUILD_ID'): 'KOKORO_BUILD_ID')
build_url = 'https://source.cloud.google.com/results/invocations/%s' % os.getenv( job_name = os.getenv('KOKORO_JOB_NAME')
'KOKORO_BUILD_ID')
job_name = os.getenv('JOB_BASE_NAME') or os.getenv('KOKORO_JOB_NAME')
if build_id: if build_id:
test_results['build_id'] = build_id test_results['build_id'] = build_id

Loading…
Cancel
Save