Skip to content

Commit

Permalink
Change the component release flow to provide more information
Browse files Browse the repository at this point in the history
Fixes #10
  • Loading branch information
atarutin committed Jan 6, 2023
1 parent ffc038d commit b577c74
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
6 changes: 3 additions & 3 deletions core/nova_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ def name(self):
return self.__name

@property
def tasks(self):
def tasks(self) -> list[NovaTask]:
"""Returns component tasks"""
return self.__tasks

def add_task(self, task):
def add_task(self, task: NovaTask):
"""Adds task to component"""
self.__tasks.append(task)

def add_tasks(self, tasks):
def add_tasks(self, tasks: list[NovaTask]):
"""Adds tasks to component"""
self.__tasks.extend(tasks)

Expand Down
15 changes: 13 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,18 @@ def choose_component_from_release(rel: NovaRelease) -> NovaComponent:
release = manager.compose(config['jira']['project'], version, delivery)
print(release.describe_status())

component = choose_component_from_release(release)
if component is not None:

while True:
component = choose_component_from_release(release)
if component is None:
break
manager.preview_component_release(release, component)
release_component_decision = input(
'Do you want to release this component [Y/n/q]?')
if release_component_decision == 'q':
break
if release_component_decision == 'n':
continue
tag, url = manager.release_component(
release, component, config['release']['branch'])
print(f'Component [{component.name}] released, tag: [{tag}], url: [{url}]')
Expand All @@ -85,3 +95,4 @@ def choose_component_from_release(rel: NovaRelease) -> NovaComponent:
if release_version_decision == 'Y':
manager.release_version(release)
print(f'Version [{release.title}] has been successfully released')
break
17 changes: 16 additions & 1 deletion release_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def release_component(
component: NovaComponent,
branch: str = 'master') -> tuple[str, str]:
"""
Creates a tag in the repository and publishes a release
Creates a tag in the repository and publishes a release,
interacts with user to get the tag name.
:param release: release model
:param component: component to release
Expand Down Expand Up @@ -155,6 +156,20 @@ def release_component(

return git_release.tag_name, git_release.url

def preview_component_release(
self,
release: NovaRelease,
component: NovaComponent):
"""Prints release information for the component"""
print('Please, review the component release information:')
print('=' * 80)
print(f'Component: {component.name}.')
print(f'Version: {release.title}.')
print('Tasks:')
for task in component.tasks:
task_release_notes = task.get_release_notes()
print(task_release_notes)

def can_release_version(self, project: str, version: str, delivery: str) -> bool:
"""Checks if release can be marked as DONE"""
release = self.compose(project, version, delivery)
Expand Down

0 comments on commit b577c74

Please sign in to comment.