aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/interop_matrix/create_matrix_images.py
diff options
context:
space:
mode:
authorGravatar Adele Zhou <adelez@google.com>2017-11-14 17:30:32 -0800
committerGravatar Adele Zhou <adelez@google.com>2017-11-22 11:09:01 -0800
commita3664680c5a5cdf5d25e09d139474bd459447b63 (patch)
treee23a1a8f1b96a948dee26dba7c6c2267210d4bbb /tools/interop_matrix/create_matrix_images.py
parent99986d76a5b7183b9a6f8142169b145ae77c5290 (diff)
Recreate the git root dir by default.
Diffstat (limited to 'tools/interop_matrix/create_matrix_images.py')
-rwxr-xr-xtools/interop_matrix/create_matrix_images.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/interop_matrix/create_matrix_images.py b/tools/interop_matrix/create_matrix_images.py
index 21040eadf2..ddeca65f27 100755
--- a/tools/interop_matrix/create_matrix_images.py
+++ b/tools/interop_matrix/create_matrix_images.py
@@ -77,6 +77,13 @@ argp.add_argument('--keep',
action='store_true',
help='keep the created local images after uploading to GCR')
+argp.add_argument('--reuse_git_root',
+ default=False,
+ action='store_const',
+ const=True,
+ help='reuse the repo dir. Reusing the repo can cause git '
+ 'checkout error if you switch between releases.')
+
args = argp.parse_args()
@@ -227,6 +234,11 @@ 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)
+ # Clean up leftover repo dir if necessary.
+ if not args.reuse_git_root and os.path.exists(stack_base):
+ jobset.message('START', 'Removing git checkout root.', do_newline=True)
+ shutil.rmtree(stack_base)
+
if not os.path.exists(stack_base):
subprocess.check_call(['git', 'clone', '--recursive', repo],
cwd=os.path.dirname(stack_base))