Skip to content

Commit

Permalink
Adding exceptions handling & deps updates
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnPreston committed Apr 10, 2023
1 parent 48e5e5d commit adda73f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"]
Expand Down
7 changes: 7 additions & 0 deletions ecr_scan_reporter/images_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
14 changes: 6 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down

0 comments on commit adda73f

Please sign in to comment.