-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Refactor BaseEnvironment #3687
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
Refactor BaseEnvironment #3687
Conversation
I have removed the |
kwargs['warn_only'] = True | ||
return super(LocalEnvironment, self).run(*cmd, **kwargs) | ||
|
||
# record, force_success, warn_only |
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.
I see that there is some magic with the parameters on the run_command_class
(change according to other parameters). So I was thinking to use different parameters: record, force_success, warn_only that are independent from each other and play nice together.
5cbd078
to
f6aaab3
Compare
f6aaab3
to
443b0e0
Compare
What I done so far:
What is missing:
|
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.
Thanks for this PR! The code looks good. Althouhg, I think it needs more work on the logic/usage of the record
, record_as_success
and friends.
The builders are complex, so we will want to merge #3764 first to cover some scenarios.
Also, we will need to do some manual QA to be sure that this code is working and the builders are building the documentation properly. This code is escential for the build process, it's complex to see the errors, and it's tricky to test (we had many problems each time we touch it :) ) --so, I'd like to be more careful this time.
:param warn_only: don't raise an exception on command failure | ||
:param record_as_success: force command ``exit_code`` to be saved as |
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 are lossing the documentation for these attributes here. It should be added where it fit.
@@ -348,12 +328,7 @@ def run_command_class( | |||
build_cmd = cls(cmd, **kwargs) | |||
self.commands.append(build_cmd) | |||
build_cmd.run() |
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.
self.pre_run_command
shuold be before this line and should receive only the build_cmd
, warn_only
and **kwargs
'build_env': self, | ||
}) | ||
self.record = kwargs.pop('record', True) | ||
self.record_as_success = warn_only |
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.
record_as_success
and warn_only
are not the same.
(take a look at my previous comment where the logic to calculate these is defined)
if not record: | ||
warn_only = True | ||
|
||
if record_as_success: |
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 do need this logic to calculate these values to decide later if we want to record or just warn or both.
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.
Yeah, I know, that's because I want to eliminate those parameters and just use record
and warn_only
#3687 (comment)
@stsewd issues mentioned "as blocking" this PR are already closed/merged. Do you want to continue with this PR? I think it was close enough to be merged. |
Codecov Report
@@ Coverage Diff @@
## master #3687 +/- ##
==========================================
- Coverage 76.8% 74.74% -2.07%
==========================================
Files 158 158
Lines 9937 9933 -4
Branches 1241 1239 -2
==========================================
- Hits 7632 7424 -208
- Misses 1973 2177 +204
Partials 332 332
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #3687 +/- ##
==========================================
- Coverage 76.8% 74.74% -2.07%
==========================================
Files 158 158
Lines 9937 9933 -4
Branches 1241 1239 -2
==========================================
- Hits 7632 7424 -208
- Misses 1973 2177 +204
Partials 332 332
|
@humitos turns out I forgot everything about the current state of this PR 😢 but I have read all the related code again, and there is a part blocking this. We were relying on the |
Ok, I think I got it, after reading #3520, but I'm not sure. We are lying to the users when saving the result to something else. But I understand that would make the build to appear like a failure... But, if the command failed, then something isn't right. Also, we are just using that to execute some commands in the VCS, actually we don't use |
I was checking, we still need that for svn and bzr :/, I guess I'll continue here |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This will close #3643
Also related to #3665