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

lifecycle: automatically clean dirty steps #2145

Merged
merged 1 commit into from May 29, 2018

Conversation

kyrofa
Copy link
Contributor

@kyrofa kyrofa commented May 23, 2018

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on bug reports?
  • If this is a new feature. Have you discussed the design on the forum?
  • Have you successfully run ./runtests.sh static?
  • Have you successfully run ./runtests.sh unit?

Currently the snapcraft CLI will error out if a given step has already run, but has changed since doing so (e.g. if a part has been pulled, but then had a stage-package added).

This PR resolves LP: #1774021 by adding support for automatically cleaning the required steps instead of erroring. It leaves today's behavior as the default, but adds a configuration item to enable the new behavior. Simply add the following snippet to ~/.config/snapcraft/cli.cfg:

[Lifecycle]
outdated_step_action = clean

Currently the snapcraft CLI will error out if a given step has already
run, but has changed since doing so (e.g. if a part has been pulled, but
then had a `stage-package` added).

Add support for automatically cleaning the required steps instead of
erroring. Leave today's behavior as the default, but add a configuration
item to enable the new behavior. Simply add the following snippet to
`~/.config/snapcraft/cli.cfg`:

    [Lifecycle]
    outdated_step_action = clean

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
@kyrofa kyrofa force-pushed the feature/auto_clean_dirty_steps branch from 96cc962 to 43c6721 Compare May 23, 2018 23:06
@codecov-io
Copy link

codecov-io commented May 24, 2018

Codecov Report

Merging #2145 into master will decrease coverage by 0.01%.
The diff coverage is 96.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2145      +/-   ##
==========================================
- Coverage   91.02%   91.01%   -0.02%     
==========================================
  Files         193      193              
  Lines       12182    12200      +18     
  Branches     1820     1824       +4     
==========================================
+ Hits        11089    11104      +15     
- Misses        751      753       +2     
- Partials      342      343       +1
Impacted Files Coverage Δ
snapcraft/config.py 95.62% <100%> (+0.42%) ⬆️
snapcraft/internal/lifecycle/_runner.py 89.7% <93.75%> (-0.3%) ⬇️
snapcraft/internal/pluginhandler/_plugin_loader.py 91.96% <0%> (-1.79%) ⬇️
snapcraft/plugins/jhbuild.py 31.62% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 582731c...43c6721. Read the comment docs.

return OutdatedStepAction[action.upper()]
else:
# Error by default
return OutdatedStepAction.ERROR
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we want to make the default the new behavior and maybe warn (a couple of times) about how to set the old behavior back.

Copy link
Contributor Author

@kyrofa kyrofa May 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was thinking our team could flip that switch for a release or so to make sure it doesn't bite before flipping it for everyone, but yeah, if you want to flip it now and warn that's fine.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, if we flip ourselves in a near future, that is fine as well, please create a bug task to flip the switch.

@sergiusens sergiusens merged commit d033c7d into canonical:master May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants