New option --skip (charts, images)

Added new option --skip, which allows to skip updates to the
listed comma-delimited charts and images.

Change-Id: I08a458fc107019ee915e8e8086d23215642c9835
This commit is contained in:
Roman Gorshunov 2018-10-24 01:03:42 +02:00
parent 61940c210c
commit 78bb5d6801
1 changed files with 16 additions and 1 deletions

View File

@ -240,6 +240,10 @@ def traverse(obj, dict_path=None):
old_git_commit_id = v['reference'] old_git_commit_id = v['reference']
git_url = v['location'] git_url = v['location']
if skip_list and k in skip_list:
logging.info("Ignoring chart %s, it is in a skip list (%s)", k, git_url)
continue
new_git_commit_id = get_commit_id(git_url) new_git_commit_id = get_commit_id(git_url)
# Update git commit id in reference field of dictionary # Update git commit id in reference field of dictionary
@ -284,6 +288,10 @@ def traverse(obj, dict_path=None):
hash_v = v.split(":") hash_v = v.split(":")
image, old_image_tag = hash_v image, old_image_tag = hash_v
if skip_list and image.endswith(skip_list):
logging.info("Ignoring image %s, it is in a skip list", image)
continue
new_image_tag = get_image_tag(image) new_image_tag = get_image_tag(image)
if new_image_tag == 0: if new_image_tag == 0:
logging.error("Failed to get image tag for %s" % image) logging.error("Failed to get image tag for %s" % image)
@ -315,9 +323,17 @@ if __name__ == '__main__':
parser.add_argument('--out-file', default='versions.yaml', parser.add_argument('--out-file', default='versions.yaml',
help='name of output file; default - "versions.yaml" (overwrite existing)') help='name of output file; default - "versions.yaml" (overwrite existing)')
parser.add_argument('--skip',
help='comma-delimited list of images and charts to skip during the update')
args = parser.parse_args() args = parser.parse_args()
in_file = args.in_file in_file = args.in_file
out_file = args.out_file out_file = args.out_file
if args.skip:
skip_list = tuple(args.skip.strip().split(","))
logging.info('Skip list: %s', skip_list)
else:
skip_list = None
if os.path.isfile(in_file): if os.path.isfile(in_file):
out_file = os.path.join(os.path.dirname(os.path.abspath(in_file)), out_file) out_file = os.path.join(os.path.dirname(os.path.abspath(in_file)), out_file)
@ -340,4 +356,3 @@ if __name__ == '__main__':
explicit_end=True, explicit_start=True, explicit_end=True, explicit_start=True,
width=4096)) width=4096))
logging.info('New versions.yaml created as %s' % out_file) logging.info('New versions.yaml created as %s' % out_file)