INNER CODE UNIT · Python
verify_matching_images
1186258278/OpenClawChineseTranslation · scripts/verify-container-images.py:83
def verify_matching_images(rows):
for tag in {row['tag'] for row in rows}:
matches = [row for row in rows if row['tag'] == tag]
if len(matches) != 2 or len({row['digest'] for row in matches}) != 1:
raise ValueError(f'The two registries have different images for {tag}')
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--owner', default='1186258278')
parser.add_argument('--tag', action='append', required=True)
parser.add_argument('--expected-version')
parser.add_argument('--output')
args = parser.parse_args()
if not re.fullmatch(r'[a-z0-9][a-z0-9_-]*', args.owner):
parser.error('Invalid owner')
if any(not re.fullmatch(r'[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}', tag) for tag in args.tag):
parser.error('Invalid tag')