Skip to content
Snippets Groups Projects
Commit da25fdb8 authored by Sree Kuchibhotla's avatar Sree Kuchibhotla
Browse files

Address code review comments

parent 61c134f5
No related branches found
No related tags found
No related merge requests found
...@@ -228,7 +228,7 @@ def delete_pod(kube_host, kube_port, namespace, pod_name): ...@@ -228,7 +228,7 @@ def delete_pod(kube_host, kube_port, namespace, pod_name):
def create_pod_and_service(kube_host, kube_port, namespace, pod_name, def create_pod_and_service(kube_host, kube_port, namespace, pod_name,
image_name, container_port_list, cmd_list, arg_list, image_name, container_port_list, cmd_list, arg_list,
env_dict, is_headless_service): env_dict, is_headless_service):
"""A simple helper function that creates a pod and a service (if pod creation was successful).""" """A helper function that creates a pod and a service (if pod creation was successful)."""
is_success = create_pod(kube_host, kube_port, namespace, pod_name, image_name, is_success = create_pod(kube_host, kube_port, namespace, pod_name, image_name,
container_port_list, cmd_list, arg_list, env_dict) container_port_list, cmd_list, arg_list, env_dict)
if not is_success: if not is_success:
...@@ -253,7 +253,7 @@ def create_pod_and_service(kube_host, kube_port, namespace, pod_name, ...@@ -253,7 +253,7 @@ def create_pod_and_service(kube_host, kube_port, namespace, pod_name,
def delete_pod_and_service(kube_host, kube_port, namespace, pod_name): def delete_pod_and_service(kube_host, kube_port, namespace, pod_name):
""" A simple helper function that calls delete_pod and delete_service """ """ A helper function that calls delete_pod and delete_service """
is_success = delete_pod(kube_host, kube_port, namespace, pod_name) is_success = delete_pod(kube_host, kube_port, namespace, pod_name)
if not is_success: if not is_success:
print 'Error in deleting pod %s' % pod_name print 'Error in deleting pod %s' % pod_name
......
...@@ -178,28 +178,19 @@ class StressClientSettings: ...@@ -178,28 +178,19 @@ class StressClientSettings:
def _build_docker_image(image_name, tag_name): def _build_docker_image(image_name, tag_name):
""" Build the docker image and add a tag """ """ Build the docker image and add tag it to the GKE repository """
print 'Building docker image: %s' % image_name print 'Building docker image: %s' % image_name
os.environ['INTEROP_IMAGE'] = image_name os.environ['INTEROP_IMAGE'] = image_name
os.environ['INTEROP_IMAGE_REPOSITORY_TAG'] = tag_name
# Note that 'BASE_NAME' HAS to be 'grpc_interop_stress_cxx' since the script # Note that 'BASE_NAME' HAS to be 'grpc_interop_stress_cxx' since the script
# build_interop_stress_image.sh invokes the following script: # build_interop_stress_image.sh invokes the following script:
# tools/dockerfile/$BASE_NAME/build_interop_stress.sh # tools/dockerfile/$BASE_NAME/build_interop_stress.sh
os.environ['BASE_NAME'] = 'grpc_interop_stress_cxx' os.environ['BASE_NAME'] = 'grpc_interop_stress_cxx'
cmd = ['tools/jenkins/build_interop_stress_image.sh'] cmd = ['tools/jenkins/build_interop_stress_image.sh']
p = subprocess.Popen(args=cmd) retcode = subprocess.call(args=cmd)
retcode = p.wait()
if retcode != 0: if retcode != 0:
print 'Error in building docker image' print 'Error in building docker image'
return False return False
print 'Adding an additional tag %s to the image %s' % (tag_name, image_name)
cmd = ['docker', 'tag', '-f', image_name, tag_name]
p = subprocess.Popen(args=cmd)
retcode = p.wait()
if retcode != 0:
print 'Error in creating the tag %s for %s' % (tag_name, image_name)
return False
return True return True
...@@ -207,8 +198,7 @@ def _push_docker_image_to_gke_registry(docker_tag_name): ...@@ -207,8 +198,7 @@ def _push_docker_image_to_gke_registry(docker_tag_name):
"""Executes 'gcloud docker push <docker_tag_name>' to push the image to GKE registry""" """Executes 'gcloud docker push <docker_tag_name>' to push the image to GKE registry"""
cmd = ['gcloud', 'docker', 'push', docker_tag_name] cmd = ['gcloud', 'docker', 'push', docker_tag_name]
print 'Pushing %s to GKE registry..' % docker_tag_name print 'Pushing %s to GKE registry..' % docker_tag_name
p = subprocess.Popen(args=cmd) retcode = subprocess.call(args=cmd)
retcode = p.wait()
if retcode != 0: if retcode != 0:
print 'Error in pushing docker image %s to the GKE registry' % docker_tag_name print 'Error in pushing docker image %s to the GKE registry' % docker_tag_name
return False return False
......
...@@ -35,6 +35,8 @@ set -x ...@@ -35,6 +35,8 @@ set -x
# Params: # Params:
# INTEROP_IMAGE - name of tag of the final interop image # INTEROP_IMAGE - name of tag of the final interop image
# INTEROP_IMAGE_TAG - Optional. If set, the created image will be tagged using
# the command: 'docker tag $INTEROP_IMAGE $INTEROP_IMAGE_REPOSITORY_TAG'
# BASE_NAME - base name used to locate the base Dockerfile and build script # BASE_NAME - base name used to locate the base Dockerfile and build script
# TTY_FLAG - optional -t flag to make docker allocate tty # TTY_FLAG - optional -t flag to make docker allocate tty
# BUILD_INTEROP_DOCKER_EXTRA_ARGS - optional args to be passed to the # BUILD_INTEROP_DOCKER_EXTRA_ARGS - optional args to be passed to the
...@@ -77,6 +79,7 @@ CONTAINER_NAME="build_${BASE_NAME}_$(uuidgen)" ...@@ -77,6 +79,7 @@ CONTAINER_NAME="build_${BASE_NAME}_$(uuidgen)"
$BASE_IMAGE \ $BASE_IMAGE \
bash -l /var/local/jenkins/grpc/tools/dockerfile/$BASE_NAME/build_interop_stress.sh \ bash -l /var/local/jenkins/grpc/tools/dockerfile/$BASE_NAME/build_interop_stress.sh \
&& docker commit $CONTAINER_NAME $INTEROP_IMAGE \ && docker commit $CONTAINER_NAME $INTEROP_IMAGE \
&& ( if [ -n $INTEROP_IMAGE_REPOSITORY_TAG ]; then docker tag $INTEROP_IMAGE $INTEROP_IMAGE_REPOSITORY_TAG ; fi ) \
&& echo "Successfully built image $INTEROP_IMAGE") && echo "Successfully built image $INTEROP_IMAGE")
EXITCODE=$? EXITCODE=$?
......
...@@ -142,7 +142,6 @@ def run_client(): ...@@ -142,7 +142,6 @@ def run_client():
# Check if stress_client is still running. If so, collect metrics and upload # Check if stress_client is still running. If so, collect metrics and upload
# to BigQuery status table # to BigQuery status table
if stress_p.poll() is not None: if stress_p.poll() is not None:
# TODO(sree) Upload completion status to BigQuery
end_time = datetime.datetime.now().isoformat() end_time = datetime.datetime.now().isoformat()
event_type = EventType.SUCCESS event_type = EventType.SUCCESS
details = 'End time: %s' % end_time details = 'End time: %s' % end_time
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment