-
-
Save filipeandre/c32cd5b2850aa1b0f611ab1e26efe801 to your computer and use it in GitHub Desktop.
A simple Python function to check if an image tag exists in an ECR repo using boto3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Checks if an image tag exists in the repo | |
| def check_tag_exists(tag, repo): | |
| ecr_client = boto3.client('ecr', region_name='us-east-1') | |
| response = ecr_client.describe_images(repositoryName=repo, filter={'tagStatus': 'TAGGED'}) | |
| for i in response['imageDetails']: | |
| if tag in i['imageTags']: | |
| return True | |
| return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment