Skip to content

Commit 113cd95

Browse files
authored
Provide custom sponge configs to exclude manual runs from testgrid (#26283)
* Provide custom sponge configs * Correct the script * Allow test scripts to produce artifacts through Docker * Overcome the direcotry clone in our docker script * Expose TESTGRID_EXCLUDE and GIT_ORIGIN_URL through docker run * Make sanity tests happy
1 parent d7954e8 commit 113cd95

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tools/run_tests/dockerize/build_and_run_docker.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ docker run \
5858
-e "KOKORO_BUILD_NUMBER=$KOKORO_BUILD_NUMBER" \
5959
-e "KOKORO_BUILD_URL=$KOKORO_BUILD_URL" \
6060
-e "KOKORO_JOB_NAME=$KOKORO_JOB_NAME" \
61+
-e "KOKORO_ARTIFACTS_DIR=$KOKORO_ARTIFACTS_DIR" \
62+
-e "GIT_ORIGIN_URL=$(git -C $git_root remote get-url origin)" \
63+
-e "GIT_COMMIT_SHORT=$(git -C $git_root rev-parse --short HEAD)" \
64+
-e "TESTGRID_EXCLUDE=$TESTGRID_EXCLUDE" \
6165
-v "$git_root:/var/local/jenkins/grpc:ro" \
66+
-v "$KOKORO_ARTIFACTS_DIR:$KOKORO_ARTIFACTS_DIR" \
6267
-w /var/local/git/grpc \
6368
--name="$CONTAINER_NAME" \
6469
$EXTRA_DOCKER_ARGS \

tools/run_tests/run_xds_tests.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,6 +2238,31 @@ def test_csds(gcp, original_backend_service, instance_group, server_uri):
22382238
test_csds_timeout_s)
22392239

22402240

2241+
def maybe_write_sponge_properties():
2242+
"""Writing test infos to enable more advanced testgrid searches."""
2243+
if 'KOKORO_ARTIFACTS_DIR' not in os.environ:
2244+
return
2245+
if 'GIT_ORIGIN_URL' not in os.environ:
2246+
return
2247+
if 'GIT_COMMIT_SHORT' not in os.environ:
2248+
return
2249+
properties = [
2250+
# Technically, 'TESTS_FORMAT_VERSION' is not required for run_xds_tests.
2251+
# We keep it here so one day we may merge the process of writing sponge
2252+
# properties.
2253+
'TESTS_FORMAT_VERSION,2',
2254+
'TESTGRID_EXCLUDE,%s' % os.environ.get('TESTGRID_EXCLUDE', 0),
2255+
'GIT_ORIGIN_URL,%s' % os.environ['GIT_ORIGIN_URL'],
2256+
'GIT_COMMIT_SHORT,%s' % os.environ['GIT_COMMIT_SHORT'],
2257+
]
2258+
logger.info('Writing Sponge configs: %s', properties)
2259+
with open(
2260+
os.path.join(os.environ['KOKORO_ARTIFACTS_DIR'],
2261+
"custom_sponge_config.csv"), 'w') as f:
2262+
f.write("\n".join(properties))
2263+
f.write("\n")
2264+
2265+
22412266
def set_validate_for_proxyless(gcp, validate_for_proxyless):
22422267
if not gcp.alpha_compute:
22432268
logger.debug(
@@ -2954,6 +2979,7 @@ def __init__(self, compute, alpha_compute, project, project_num):
29542979
self.instance_groups = []
29552980

29562981

2982+
maybe_write_sponge_properties()
29572983
alpha_compute = None
29582984
if args.compute_discovery_document:
29592985
with open(args.compute_discovery_document, 'r') as discovery_doc:

0 commit comments

Comments
 (0)