-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add 'allow' and 'disallow' setting to each manager #1156
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,7 +294,6 @@ def run(self, labels: list, analysis_id=None): | |
self._issue_list = self.project.get_issue_list() | ||
self._close_advise_issues4users_lacking_perms() | ||
self._tracking_issue = self._close_all_but_oldest_issue() | ||
runtime_environments: typing.List[typing.Tuple[str, Issue]] | ||
|
||
if analysis_id is None: | ||
if self._tracking_issue is None: | ||
|
@@ -311,16 +310,7 @@ def run(self, labels: list, analysis_id=None): | |
|
||
with open(".thoth.yaml", "r") as f: | ||
thoth_config = yaml.safe_load(f) | ||
|
||
if thoth_config.get("overlays_dir"): | ||
runtime_environments = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we are removing the local There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ack,done |
||
e["name"] for e in thoth_config["runtime_environments"] | ||
] | ||
else: | ||
runtime_environments = [ | ||
thoth_config["runtime_environments"][0]["name"] | ||
] | ||
harshad16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for e in runtime_environments: | ||
for e in self.runtime_environments or []: | ||
try: | ||
analysis_id = lib.advise_here( | ||
nowait=True, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
import re | ||
import json | ||
import typing | ||
from typing import Optional, List | ||
from typing import Optional | ||
from itertools import chain | ||
from functools import partial | ||
from datetime import datetime | ||
|
@@ -111,6 +111,7 @@ def __init__(self, *args, **kwargs): | |
# We do API calls once for merge requests and we cache them for later use. | ||
self._cached_merge_requests = None | ||
self._pr_list = [] | ||
self.runtime_environment = "default" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this line added here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. previously , self.runtime_environment was a string, being used in https://github.com/thoth-station/kebechet/blob/master/kebechet/managers/update/update.py#L761 and many more places. |
||
super().__init__(*args, **kwargs) | ||
|
||
@property | ||
|
@@ -738,26 +739,14 @@ def run(self, labels: list = []) -> Optional[dict]: | |
runtime_environment_names = [ | ||
e["name"] for e in thoth_config.list_runtime_environments() | ||
] | ||
|
||
overlays_dir = thoth_config.content.get("overlays_dir") | ||
|
||
runtime_environments: List[Optional[str]] | ||
if self.runtime_environment: | ||
if self.runtime_environment not in runtime_environment_names: | ||
results: dict = {} | ||
for e in self.runtime_environments or []: | ||
if e not in runtime_environment_names: | ||
# This is not a warning as it is expected when users remove and change runtime_environments | ||
_LOGGER.info("Requested runtime does not exist in target repo.") | ||
return None | ||
runtime_environments = [self.runtime_environment] | ||
else: | ||
if overlays_dir: | ||
runtime_environments = runtime_environment_names | ||
elif runtime_environment_names: | ||
runtime_environments = [runtime_environment_names[0]] | ||
else: | ||
runtime_environments = [None] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we lost the "default" functionality here. I think the for loop should probably be default |
||
|
||
results: dict = {} | ||
for e in runtime_environments: | ||
continue | ||
self.runtime_environment = e or "default" | ||
close_no_management_issue = partial( | ||
self.close_issue_and_comment, | ||
|
@@ -793,7 +782,8 @@ def run(self, labels: list = []) -> Optional[dict]: | |
except Exception: | ||
_LOGGER.exception( | ||
f"Failed to delete branch " | ||
f"{_UPDATE_BRANCH_NAME.format(env_name=self.runtime_environment)}, trying to continue" | ||
f"{_UPDATE_BRANCH_NAME.format(env_name=self.runtime_environment)}, " | ||
f"trying to continue" | ||
) | ||
elif to_rebase: | ||
for pr in to_rebase: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to respect the passed runtime_environment. We could also allow the user to pass a list of runtime_environments in the future, I don't think we need to do this now though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack