create_matrix_images.py usability fixes

pull/13416/head
Jan Tattermusch 7 years ago
parent b6a2eeb816
commit c093a7f8a1
  1. 16
      tools/interop_matrix/create_matrix_images.py

@ -97,6 +97,11 @@ argp.add_argument(
'reusing the repo can cause git checkout error if you switch ' 'reusing the repo can cause git checkout error if you switch '
'between releases.') 'between releases.')
argp.add_argument(
'--upload_images',
action='store_true',
help='If set, images will be uploaded to container registry after building.')
args = argp.parse_args() args = argp.parse_args()
@ -166,8 +171,9 @@ def build_all_images_for_lang(lang):
"""Build all docker images for a language across releases and runtimes.""" """Build all docker images for a language across releases and runtimes."""
if not args.git_checkout: if not args.git_checkout:
if args.release != 'master': if args.release != 'master':
print('WARNING: --release is set but will be ignored\n') print('Cannot use --release without also enabling --git_checkout.\n')
releases = ['master'] sys.exit(1)
releases = [args.release]
else: else:
if args.release == 'all': if args.release == 'all':
releases = client_matrix.get_release_tags(lang) releases = client_matrix.get_release_tags(lang)
@ -334,8 +340,12 @@ languages = args.language if args.language != ['all'] else _LANGUAGES
for lang in languages: for lang in languages:
docker_images = build_all_images_for_lang(lang) docker_images = build_all_images_for_lang(lang)
for image in docker_images: for image in docker_images:
if args.upload_images:
jobset.message('START', 'Uploading %s' % image, do_newline=True) jobset.message('START', 'Uploading %s' % image, do_newline=True)
# docker image name must be in the format <gcr_path>/<image>:<gcr_tag> # docker image name must be in the format <gcr_path>/<image>:<gcr_tag>
assert image.startswith(args.gcr_path) and image.find(':') != -1 assert image.startswith(args.gcr_path) and image.find(':') != -1
subprocess.call(['gcloud', 'docker', '--', 'push', image]) subprocess.call(['gcloud', 'docker', '--', 'push', image])
else:
# Uploading (and overwriting images) by default can easily break things.
print('Not uploading image %s, run with --upload_images to upload.' % image)

Loading…
Cancel
Save