Skip to content

Add extension upgrade --dry-run#5098

Merged
samcoe merged 10 commits intotrunkfrom
speed-extension-list
Apr 12, 2022
Merged

Add extension upgrade --dry-run#5098
samcoe merged 10 commits intotrunkfrom
speed-extension-list

Conversation

@samcoe
Copy link
Contributor

@samcoe samcoe commented Jan 25, 2022

This PR does two related things.

  1. Removes the update available check from extension list command. It was slow and made what should be a simple command less usable.
  2. Introduces as --dry-run flag to extension upgrade command. This option combined with the --all flag gives the user the same functionality as the old extension list command functionality, except now the update available checking has to be explicitly asked for and is better aligned in the extension upgrade command.

Closes #4220

@samcoe samcoe self-assigned this Jan 25, 2022
@samcoe samcoe changed the title Add extension --dry-release Add extension upgrade --dry-release Jan 25, 2022
@samcoe samcoe marked this pull request as ready for review January 25, 2022 09:44
@samcoe samcoe requested a review from a team as a code owner January 25, 2022 09:44
@samcoe samcoe requested review from mislav and removed request for a team January 25, 2022 09:44
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

This looks like it's almost there, but I would challenge us to exercise as much of the upgrade logic as possible (i.e. most filesystem/API reads and comparisons) in dry-run mode.

return upToDateError
}
if dryRun {
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this exits too soon in the dry-run mode. There is heavy logic ahead that I can imagine it would be good to exercise even in dry-run mode. A dry-run should ideally do as much as a normal run would, sans any mutations (which get printed instead of executed).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mislav I updated this PR to now exercise more of the logic during dry-run mode. I opted against printing mutations for two reasons. First, in extensions commands we already don't display what is happening behind the scenes and this decision felt like keeping consistency. Second, when using the --all flag the output did not look clean with multiple output lines per extension that would be upgraded.

@samcoe samcoe changed the title Add extension upgrade --dry-release Add extension upgrade --dry-run Feb 24, 2022
@samcoe samcoe force-pushed the speed-extension-list branch from c9db1aa to bf34147 Compare March 2, 2022 19:41
@samcoe
Copy link
Contributor Author

samcoe commented Mar 30, 2022

@mislav I updated this PR if you want to take another look 🙇. The increased logic exercising meant passing around the dryRun variable to more functions, what are your thoughts on just adding the dryRun state as a property on the extension manager? I think this approach would work well as it would make it easier to add dry run flags to other extension commands.

@samcoe samcoe requested a review from mislav April 11, 2022 16:31
@samcoe
Copy link
Contributor Author

samcoe commented Apr 11, 2022

@mislav Updated the PR to reflect the addition of dryRunMode as a property of the extension manager.

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for the quick update

m.dryRunMode = true
}

func (m *Manager) DisableDryRunMode() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is Disable called from anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not right now, I added it mostly because it felt weird having a Enable function without the corresponding Disable function. Having said that, I don't know if we will ever need the ability to disable it so I will remove it for now. It is easy enough to add later.

@samcoe samcoe enabled auto-merge (squash) April 12, 2022 07:14
@samcoe samcoe merged commit 2c0236d into trunk Apr 12, 2022
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.

gh extension list is very slow

2 participants