diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6693473..2a3f427 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.4.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace @@ -15,17 +15,17 @@ repos: - id: fix-byte-order-marker - repo: https://github.com/asottile/pyupgrade - rev: v2.32.1 + rev: v3.3.1 hooks: - id: pyupgrade args: [ "--py38-plus" ] - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort args: ["--profile", "black", "--filter-files"] diff --git a/ecr_scan_reporter/images_scanner.py b/ecr_scan_reporter/images_scanner.py index 5684984..f2eee67 100644 --- a/ecr_scan_reporter/images_scanner.py +++ b/ecr_scan_reporter/images_scanner.py @@ -13,6 +13,7 @@ from time import sleep from boto3 import session +from botocore.exceptions import ClientError from compose_x_common.compose_x_common import keyisset from dateutil.relativedelta import relativedelta from pytz import utc @@ -225,6 +226,12 @@ def trigger_images_scan(repo_name, images_to_scan, ecr_session=None): except client.exceptions.UnsupportedImageTypeException: print("The image does not support scanning.") tries = 0 + except client.exceptions.InvalidParameterException as error: + print(f"The scan could not be started on this repository image: {error}.") + tries = 0 + except ClientError as error: + print(f"Failed to trigger scan: {error}") + tries = 0 def scan_repo_images(repo, repo_images=None, duration_override=None, no_scan_images=False, ecr_session=None): diff --git a/pyproject.toml b/pyproject.toml index 410b1aa..1e3ad57 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,6 @@ classifiers = [ "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -22,22 +21,21 @@ include = [ ] [tool.poetry.dependencies] -python = "^3.7" +python = "^3.8" boto3 = "^1.22" -pytz = "^2022.1" -compose-x-common = "^1.0" +pytz = "^2023.3" +compose-x-common = "^1.2" [tool.poetry.dev-dependencies] sphinx-material = "^0.0.35" Sphinx = "^4.5.0" -black = "^22.3" -isort = "^5.10.1" +black = "^23.3" +isort = "^5.12" tbump = "^6.7,<7.0" placebo = "<1.0" behave = "^1.2.6" pytest = "^7.1" -pre-commit = "^2.19.0" -tox = "^3.25.0" +pre-commit = "^3.2" [tool.poetry.scripts] ecr_scan_reporter = "ecr_scan_reporter.cli:main"