Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve dora implementation #241

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ async def initialise_app():
description='API definition',
title='Delivery-Service by Gardener CICD',
definitions=api_definitions,
)
)

return app

Expand Down
12 changes: 1 addition & 11 deletions components.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,6 @@ async def check_if_component_exists(
return False


def ensure_utc(ts: datetime.datetime) -> datetime.datetime:
if ts.tzinfo is None:
ts = ts.replace(tzinfo=datetime.timezone.utc)
else:
if ts.tzinfo != datetime.timezone.utc:
ts = ts.astimezone(datetime.timezone.utc)

return ts


def get_creation_date(component: ocm.Component) -> datetime.datetime:
'''
Trys to extract creation date from creationTime attribute and if not set from label with name
Expand All @@ -94,7 +84,7 @@ def get_creation_date(component: ocm.Component) -> datetime.datetime:
'''

if (creationTime := component.creationTime):
return ensure_utc(dateutil.parser.isoparse(creationTime))
return util.as_timezone(dateutil.parser.isoparse(creationTime))

creation_label: ocm.Label | None = component.find_label('cloud.gardener/ocm/creation-date')

Expand Down
Loading