-
Notifications
You must be signed in to change notification settings - Fork 165
Do not fetch disabled remote plans in tmt run
#4749
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
Open
pkhartsk
wants to merge
3
commits into
teemtee:main
Choose a base branch
from
pkhartsk:fix-2968
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+145
−3
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -62,6 +62,47 @@ | |||||
| name: /plans/provision/connect | ||||||
| enabled: true | ||||||
|
|
||||||
| /inaccessible: | ||||||
| plan: | ||||||
| import: | ||||||
| url: https://secret.internal | ||||||
| name: /secret/internal/plan | ||||||
| /disabled: | ||||||
| summary: Unimportable plan should not raise errors when disabled | ||||||
| enabled: false | ||||||
|
|
||||||
| /disabled-by-adjust: | ||||||
| summary: Local plan disabled by adjust should not import remote plan | ||||||
| adjust: | ||||||
| enabled: false | ||||||
| when: distro == fedora-rawhide | ||||||
|
|
||||||
| /enabled-by-adjust: | ||||||
| summary: Local plan enabled by adjust should import remote plan | ||||||
| adjust: | ||||||
| enabled: true | ||||||
| when: distro == fedora-rawhide | ||||||
| enabled: false | ||||||
|
|
||||||
| /importing: | ||||||
| plan: | ||||||
| import: | ||||||
| url: https://github.com/teemtee/tmt | ||||||
|
Member
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.
Suggested change
What about using the |
||||||
| name: /plans/provision/connect | ||||||
|
|
||||||
| /disabled-by-adjust: | ||||||
| summary: Local plan disabled by adjust should not import remote plan | ||||||
| adjust: | ||||||
| enabled: false | ||||||
| when: distro == fedora-rawhide | ||||||
|
|
||||||
| /enabled-by-adjust: | ||||||
| summary: Local plan enabled by adjust should import remote plan | ||||||
| adjust: | ||||||
| enabled: true | ||||||
| when: distro == fedora-rawhide | ||||||
| enabled: false | ||||||
|
|
||||||
| /disabled: | ||||||
| summary: Imported plan will be disabled by local plan | ||||||
| plan: | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2545,6 +2545,7 @@ def plans( | |||||
| links: Optional[list['LinkNeedle']] = None, | ||||||
| excludes: Optional[list[str]] = None, | ||||||
| apply_command_line: bool = True, | ||||||
| resolve_enabled_only: bool = False, | ||||||
| ) -> list["Plan"]: | ||||||
| """ | ||||||
| Search available plans | ||||||
|
|
@@ -2621,10 +2622,19 @@ def plans( | |||||
| for policy in run.policies: | ||||||
| policy.apply_to_plans(plans=plans, logger=logger) | ||||||
|
|
||||||
| if Plan._opt('enabled') or ('enabled:true' in filters): | ||||||
| resolve_enabled_only = True | ||||||
|
|
||||||
| if not Plan._opt('shallow'): | ||||||
| unresolved_plans = plans | ||||||
| plans = [] | ||||||
| for plan in unresolved_plans: | ||||||
| # Do not resolve disabled plans unless forced to | ||||||
| if resolve_enabled_only and not plan.enabled: | ||||||
| plan.debug( | ||||||
| f"Plan '{plan.name}' is not enabled, skipping imports resolution", | ||||||
|
Member
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.
Suggested change
A consistency nitipick. |
||||||
| ) | ||||||
| continue | ||||||
| try: | ||||||
| plans += plan.resolve_imports() | ||||||
| except Exception as error: | ||||||
|
|
@@ -3144,7 +3154,7 @@ def load(self) -> None: | |||||
| else: | ||||||
| plan_names = [f"^{re.escape(plan_name)}$" for plan_name in self.data.plans] | ||||||
|
|
||||||
| self._plans = self.tree.plans(run=self, names=plan_names) | ||||||
| self._plans = self.tree.plans(run=self, names=plan_names, resolve_enabled_only=True) | ||||||
|
|
||||||
| # Initialize steps only if not selected on the command line | ||||||
| step_options = ['all', 'since', 'until', 'after', 'before', 'skip'] | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Oh boy, what happened with all of the diff in this test?
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.
Right, removed everything and added mine, will bring them back
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.
What about adding a new test script to cover these scenarios? They are not
basicanymore... Perhapstests/plan/import/inaccessible.sh?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.
Not sure separating one test case (with four sub-cases) makes much sense here. Maybe in the future when things like
plans showget covered more correctly?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.
It's quite a long one, so would still lean toward the separation, but not a blocker.