|  | @@ -116,12 +116,13 @@ def add_files_to_image(image, with_files, label=None):
 | 
	
		
			
				|  |  |    subprocess.check_output(build_cmd)
 | 
	
		
			
				|  |  |    dockerjob.remove_image(orig_tag, skip_nonexistent=True)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -def build_image_jobspec(runtime, env, gcr_tag):
 | 
	
		
			
				|  |  | +def build_image_jobspec(runtime, env, gcr_tag, stack_base):
 | 
	
		
			
				|  |  |    """Build interop docker image for a language with runtime.
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    runtime: a <lang><version> string, for example go1.8.
 | 
	
		
			
				|  |  |    env:     dictionary of env to passed to the build script.
 | 
	
		
			
				|  |  |    gcr_tag: the tag for the docker image (i.e. v1.3.0).
 | 
	
		
			
				|  |  | +  stack_base: the local gRPC repo path.
 | 
	
		
			
				|  |  |    """
 | 
	
		
			
				|  |  |    basename = 'grpc_interop_%s' % runtime
 | 
	
		
			
				|  |  |    tag = '%s/%s:%s' % (args.gcr_path, basename, gcr_tag)
 | 
	
	
		
			
				|  | @@ -132,7 +133,7 @@ def build_image_jobspec(runtime, env, gcr_tag):
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    build_env.update(env)
 | 
	
		
			
				|  |  |    build_job = jobset.JobSpec(
 | 
	
		
			
				|  |  | -          cmdline=[_IMAGE_BUILDER],
 | 
	
		
			
				|  |  | +          cmdline=[os.path.join(stack_base, _IMAGE_BUILDER)],
 | 
	
		
			
				|  |  |            environ=build_env,
 | 
	
		
			
				|  |  |            shortname='build_docker_%s' % runtime,
 | 
	
		
			
				|  |  |            timeout_seconds=30*60)
 | 
	
	
		
			
				|  | @@ -172,13 +173,14 @@ def build_all_images_for_release(lang, release):
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    env = {}
 | 
	
		
			
				|  |  |    # If we not using current tree or the sibling for grpc stack, do checkout.
 | 
	
		
			
				|  |  | +  stack_base = ''
 | 
	
		
			
				|  |  |    if args.git_checkout:
 | 
	
		
			
				|  |  |      stack_base = checkout_grpc_stack(lang, release)
 | 
	
		
			
				|  |  |      var ={'go': 'GRPC_GO_ROOT', 'java': 'GRPC_JAVA_ROOT', 'node': 'GRPC_NODE_ROOT'}.get(lang, 'GRPC_ROOT')
 | 
	
		
			
				|  |  |      env[var] = stack_base
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    for runtime in client_matrix.LANG_RUNTIME_MATRIX[lang]:
 | 
	
		
			
				|  |  | -    job = build_image_jobspec(runtime, env, release)
 | 
	
		
			
				|  |  | +    job = build_image_jobspec(runtime, env, release, stack_base)
 | 
	
		
			
				|  |  |      docker_images.append(job.tag)
 | 
	
		
			
				|  |  |      build_jobs.append(job)
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -225,7 +227,6 @@ def checkout_grpc_stack(lang, release):
 | 
	
		
			
				|  |  |    repo_dir = os.path.splitext(os.path.basename(repo))[0]
 | 
	
		
			
				|  |  |    stack_base = os.path.join(args.git_checkout_root, repo_dir)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  # Assume the directory is reusable for git checkout.
 | 
	
		
			
				|  |  |    if not os.path.exists(stack_base):
 | 
	
		
			
				|  |  |      subprocess.check_call(['git', 'clone', '--recursive', repo],
 | 
	
		
			
				|  |  |                            cwd=os.path.dirname(stack_base))
 | 
	
	
		
			
				|  | @@ -238,7 +239,9 @@ def checkout_grpc_stack(lang, release):
 | 
	
		
			
				|  |  |    output = subprocess.check_output(
 | 
	
		
			
				|  |  |        ['git', 'checkout', release], cwd=stack_base, stderr=subprocess.STDOUT)
 | 
	
		
			
				|  |  |    commit_log = subprocess.check_output(['git', 'log', '-1'], cwd=stack_base)
 | 
	
		
			
				|  |  | -  jobset.message('SUCCESS', 'git checkout', output + commit_log, do_newline=True)
 | 
	
		
			
				|  |  | +  jobset.message('SUCCESS', 'git checkout', 
 | 
	
		
			
				|  |  | +                 '%s: %s' % (str(output), commit_log), 
 | 
	
		
			
				|  |  | +                 do_newline=True)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    # Write git log to commit_log so it can be packaged with the docker image.
 | 
	
		
			
				|  |  |    with open(os.path.join(stack_base, 'commit_log'), 'w') as f:
 |