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

Move Cloud commands out of Spin CLI and into a plugin #1452

Merged
merged 13 commits into from
Jun 7, 2023

Conversation

kate-goldenring
Copy link
Contributor

@kate-goldenring kate-goldenring commented May 4, 2023

WIP draft to move Fermyon Cloud command code (spin cloud deploy and spin cloud login) out of Spin CLI and into a plugin.

SIP.

Cloud plugin: https://github.com/fermyon/cloud-plugin

Do not merge until the plugin is added to the Spin plugins registry. Added

@kate-goldenring kate-goldenring marked this pull request as draft May 4, 2023 21:53
Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
@kate-goldenring
Copy link
Contributor Author

@bacongobbler has been working on the SIP that will be added to this PR

Signed-off-by: Matthew Fisher <matt.fisher@fermyon.com>
@bacongobbler
Copy link
Member

@bacongobbler has been working on the SIP that will be added to this PR

Added in 84fd741

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
@kate-goldenring kate-goldenring marked this pull request as ready for review May 11, 2023 22:55
docs/content/sips/013-cloud-plugin.md Outdated Show resolved Hide resolved
docs/content/sips/013-cloud-plugin.md Outdated Show resolved Hide resolved
if plugin_name == "cloud" {
println!("The `cloud` plugin is required. Installing now.");
let plugin_installer = Install {
name: Some("cloud".to_string()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To test this out now (before the cloud plugin is added to the plugins repository), replace the name field with local_manifest_src that points to the local manifest after cloning the cloud-plugin repo

local_manifest_src: Some("/Path/to/repo/cloud-plugin/plugin/cloud.json".into()),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now added to the plugins repo so no need to modify

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
@kate-goldenring
Copy link
Contributor Author

The test_spin_deploy will continue to fail till we add the plugin to the spin-plugins repo

@kate-goldenring
Copy link
Contributor Author

@tpmccallum added an issue to documentation on documenting this fermyon/developer#621

Signed-off-by: Matthew Fisher <matt.fisher@fermyon.com>
Signed-off-by: Matthew Fisher <matt.fisher@fermyon.com>
Signed-off-by: Matthew Fisher <matt.fisher@fermyon.com>
@kate-goldenring
Copy link
Contributor Author

for the cloud plugin, @itowlson brought up the question of whether we should suppress prerelease compatibility warnings?. At the moment, using any plugin with canary or HEAD gives a "prerelease version of Spin, plugin may not be compatible." However, cloud login and cloud deploy are common paths so that is a lot of warnings and may become irksome. The main folks irked are contributors as users should be using a release.

@bacongobbler
Copy link
Member

bacongobbler commented May 17, 2023

However, cloud login and cloud deploy are common paths so that is a lot of warnings and may become irksome.

How often is this warning displayed? If you're using a canary release, does it happen on every invocation to spin deploy?

Perhaps we could display a prerelease compatibility warning once per day. I don't think Spin has a date check system to warn the user, though.

IMO this is starting to feel like it falls out of scope of this PR and it should be tackled separately, either as a follow-up discussion or a new SIP to modify plugin loading behavior for "core" plugins. The system was designed to warn the user when you're using a pre-release of Spin that invokes a plugin.

I can see why we may want to tackle this problem now especially because cloud-plugin is part of the default on-ramp experience to the Fermyon Cloud. Personally I'd prefer that we take that discussion to another thread as the decisions we make here will impact other plugins we may want to bring into the core CLI.

@itowlson
Copy link
Contributor

It's displayed every time any plugin is invoked. I'm happy to decouple it from the cloud PR though - it occurred to me just because this was a blessed plugin that aimed for a relatively seamless experience, but I will open a separate issue for it.

@bacongobbler
Copy link
Member

It's good that you point out that this is just a canary/HEAD problem. Most users won't see this. I'd be fine with kicking this decision down the road.

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
@kate-goldenring
Copy link
Contributor Author

@itowlson @fibonacci1729 @bacongobbler @radu-matei this should be ready for another review. I also added a test that ensures that the cloud plugin is installed during a spin login and removed all fermyon-platform tests.

@kate-goldenring
Copy link
Contributor Author

I am weirdly having an issue rebasing the commits to just 1. It will only go back HEAD~2 worth of commits with fatal: invalid upstream 'HEAD~5' and will only show a few commits even if i point to the first commits. Maybe we can squash merge this so it isn't a bunch of commits?

Copy link
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

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

mostly nits - looks good!

src/commands/cloud.rs Show resolved Hide resolved
src/commands/cloud.rs Outdated Show resolved Hide resolved
src/commands/cloud.rs Outdated Show resolved Hide resolved
src/commands/external.rs Show resolved Hide resolved
src/commands/plugins.rs Outdated Show resolved Hide resolved
@itowlson
Copy link
Contributor

itowlson commented Jun 6, 2023

@kate-goldenring I agree we don't need to keep the commit history but I think GH squashing is disabled because of GPG - not sure we can bypass it.

@kate-goldenring
Copy link
Contributor Author

@itowlson I believe it should be cleaned up

Copy link
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@fibonacci1729 fibonacci1729 left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>

Remove Fermyon Platform tests

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>

Test that cloud plugin is installed during a spin login

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>

Syntactical nits

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
@bacongobbler
Copy link
Member

I got this when initially testing:

><> spin cloud login
The `cloud` plugin is required. Installing now.
Error: plugin 'cloud' not found at expected location /home/bacongobbler/.local/share/spin/plugins/.spin-plugins/manifests/cloud/cloud.json: No such file or directory (os error 2)

Once I ran spin plugin update, everything worked as expected:

><> spin cloud login
The `cloud` plugin is required. Installing now.
You're using a pre-release version of Spin (1.2.0-pre0). This plugin might not be compatible (supported: >=1.3). Continuing anyway.
Plugin 'cloud' was installed successfully!

Copy your one-time code:

MWtjLTDG

...and open the authorization page in your browser:

https://cloud.fermyon.com/device-authorization

Waiting for device authorization...
Device authorized!

Might be worth calling out in the release notes.

Otherwise, LGTM!

@bacongobbler
Copy link
Member

One other thing unrelated to this PR: I noticed spin plugin list seems to show the cloud plugin twice:

 ><> spin plugin list
cloud 0.1.0 [installed]
cloud 0.1.0 [installed]
js2wasm 0.1.0
js2wasm 0.2.0
js2wasm 0.3.0
js2wasm 0.4.0 [installed]
py2wasm 0.1.0
py2wasm 0.1.1
py2wasm 0.2.0

@kate-goldenring
Copy link
Contributor Author

@bacongobbler good find. I think we might want to add a spin plugin update in this case that it can't be found. Thoughts @itowlson?

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
@kate-goldenring
Copy link
Contributor Author

@bacongobbler I added a step to do spin plugin update for the user if it doesn't see the cloud plugin. We can probably remove this later once we have the badgering and it is highly unlikely to not have updated. We may be able to remove this step in the future once we think everyone will have it. Duplication of the plugin should now be fixed via fermyon/spin-plugins#25

@melissaklein24 melissaklein24 added this to the 1.3.0 milestone Jun 7, 2023
@kate-goldenring kate-goldenring merged commit eb5e826 into fermyon:main Jun 7, 2023
@itowlson
Copy link
Contributor

itowlson commented Jun 7, 2023

@bacongobbler Thanks for flagging the "double cloud" quirk in the list. It looks like at one point there were both a cloud.json and a cloud@0.1.0.json in the registry, both reporting v0.1.0. There's now just the one, so spin plugins update made the duplication go away (for me). @kate-goldenring Is this a situation I should guard against in the client, or is it a "shouldn't happen" in the registry?

@itowlson
Copy link
Contributor

itowlson commented Jun 7, 2023

Doh sorry, I completely missed all the bits where @kate-goldenring covered the duplication stuff already, please ignore.

@rylev rylev mentioned this pull request Dec 21, 2023
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.

6 participants