Skip to content

Commit 88c3a4f

Browse files
Alex Melnikmmb
authored andcommitted
command layer for install plugin from URL
[#142580147] Signed-off-by: Matthew Boedicker <[email protected]>
1 parent 46595cb commit 88c3a4f

32 files changed

+667
-438
lines changed

actor/pluginaction/install.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ type CommandList interface {
2828
// PluginInvalidError is returned with a plugin is invalid because it is
2929
// missing a name or has 0 commands.
3030
type PluginInvalidError struct {
31-
Path string
3231
}
3332

3433
func (_ PluginInvalidError) Error() string {
35-
return "File {{.Path}} is not a valid cf CLI plugin binary."
34+
return "File not a valid cf CLI plugin binary."
3635
}
3736

3837
// PluginCommandConflictError is returned when a plugin command name conflicts
@@ -90,10 +89,10 @@ func (actor Actor) CreateExecutableCopy(path string) (string, error) {
9089
return executablePath, nil
9190
}
9291

93-
// FetchPluginFromURL fetches a plugin binary from the specified URL, if
92+
// DownloadBinaryFromURL fetches a plugin binary from the specified URL, if
9493
// it exists.
95-
func (actor Actor) FetchPluginFromURL(path string) (string, error) {
96-
return "", nil
94+
func (actor Actor) DownloadExecutableBinaryFromURL(path string) (string, int64, error) {
95+
return "", 0, nil
9796
}
9897

9998
// FileExists returns true if the file exists. It returns false if the file
@@ -106,7 +105,7 @@ func (actor Actor) FileExists(path string) bool {
106105
func (actor Actor) GetAndValidatePlugin(pluginMetadata PluginMetadata, commandList CommandList, path string) (configv3.Plugin, error) {
107106
plugin, err := pluginMetadata.GetMetadata(path)
108107
if err != nil || plugin.Name == "" || len(plugin.Commands) == 0 {
109-
return configv3.Plugin{}, PluginInvalidError{Path: path}
108+
return configv3.Plugin{}, PluginInvalidError{}
110109
}
111110

112111
installedPlugins := actor.config.Plugins()

actor/pluginaction/install_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ var _ = Describe("install actions", func() {
166166
})
167167

168168
It("returns a PluginInvalidError", func() {
169-
Expect(validateErr).To(MatchError(PluginInvalidError{Path: "some-plugin-path"}))
169+
Expect(validateErr).To(MatchError(PluginInvalidError{}))
170170
})
171171
})
172172

@@ -176,7 +176,7 @@ var _ = Describe("install actions", func() {
176176
})
177177

178178
It("returns a PluginInvalidError", func() {
179-
Expect(validateErr).To(MatchError(PluginInvalidError{Path: "some-plugin-path"}))
179+
Expect(validateErr).To(MatchError(PluginInvalidError{}))
180180
})
181181
})
182182

@@ -186,7 +186,7 @@ var _ = Describe("install actions", func() {
186186
})
187187

188188
It("returns a PluginInvalidError", func() {
189-
Expect(validateErr).To(MatchError(PluginInvalidError{Path: "some-plugin-path"}))
189+
Expect(validateErr).To(MatchError(PluginInvalidError{}))
190190
})
191191
})
192192

cf/i18n/resources/de-de.all.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2939,6 +2939,10 @@
29392939
"id": "Features",
29402940
"translation": "Features"
29412941
},
2942+
{
2943+
"id": "File not a valid cf CLI plugin binary.",
2944+
"translation": ""
2945+
},
29422946
{
29432947
"id": "File not found locally, make sure the file exists at given path {{.FilePath}}",
29442948
"translation": ""
@@ -4400,7 +4404,7 @@
44004404
"translation": ""
44014405
},
44024406
{
4403-
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.Command}}' to force a reinstall.",
4407+
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.BinaryName}} install-plugin -f' to force a reinstall.",
44044408
"translation": ""
44054409
},
44064410
{
@@ -5339,6 +5343,10 @@
53395343
"id": "Starting app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...",
53405344
"translation": "Starten der App {{.AppName}} in Organisation {{.OrgName}} / Bereich {{.SpaceName}} als {{.CurrentUser}}..."
53415345
},
5346+
{
5347+
"id": "Starting download of plugin binary from URL...",
5348+
"translation": ""
5349+
},
53425350
{
53435351
"id": "Startup command, set to null to reset to default start command",
53445352
"translation": "Startbefehl, auf Null festlegen, um die Einstellung auf den Standardstartbefehl zurückzusetzen"
@@ -5795,6 +5803,10 @@
57955803
"id": "This command",
57965804
"translation": "Dieser Befehl"
57975805
},
5806+
{
5807+
"id": "This command does not support the URL scheme in {{.UnsupportedURL}}.",
5808+
"translation": ""
5809+
},
57985810
{
57995811
"id": "This command is in EXPERIMENTAL stage and may change without notice",
58005812
"translation": ""
@@ -7063,6 +7075,10 @@
70637075
"id": "{{.BinaryName}} version {{.VersionString}}",
70647076
"translation": ""
70657077
},
7078+
{
7079+
"id": "{{.Bytes}} bytes downloaded...",
7080+
"translation": ""
7081+
},
70667082
{
70677083
"id": "{{.CFName}} api",
70687084
"translation": "{{.CFName}}-API"

cf/i18n/resources/de-de.untranslated.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@
207207
"id": "Error staging application: {{.Message}}\n\nTIP: Use '{{.BuildpackCommand}}' to see a list of supported buildpacks.",
208208
"translation": "Error staging application: {{.Message}}\n\nTIP: Use '{{.BuildpackCommand}}' to see a list of supported buildpacks."
209209
},
210+
{
211+
"id": "File not a valid cf CLI plugin binary.",
212+
"translation": ""
213+
},
210214
{
211215
"id": "File not found locally, make sure the file exists at given path {{.FilePath}}",
212216
"translation": ""
@@ -344,8 +348,8 @@
344348
"translation": ""
345349
},
346350
{
347-
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.Command}}' to force a reinstall.",
348-
"translation": ""
351+
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.BinaryName}} install-plugin -f' to force a reinstall.",
352+
"translation": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.BinaryName}} install-plugin -f' to force a reinstall."
349353
},
350354
{
351355
"id": "Plugin {{.Name}} {{.Version}} is already installed. Uninstalling existing plugin...",
@@ -491,6 +495,10 @@
491495
"id": "Start unsuccessful\n\nTIP: use '{{.BinaryName}} logs {{.AppName}} --recent' for more information",
492496
"translation": ""
493497
},
498+
{
499+
"id": "Starting download of plugin binary from URL...",
500+
"translation": ""
501+
},
494502
{
495503
"id": "Stop all instances of the app, then start them again. This may cause downtime.",
496504
"translation": ""
@@ -547,6 +555,10 @@
547555
"id": "This action impacts all orgs using this domain.\nDeleting it will remove associated routes and could make any app with this domain, in any org, unreachable.\nAre you sure you want to delete the domain {{.DomainName}}? ",
548556
"translation": "This action impacts all orgs using this domain.\nDeleting it will remove associated routes and could make any app with this domain, in any org, unreachable.\nAre you sure you want to delete the domain {{.DomainName}}? "
549557
},
558+
{
559+
"id": "This command does not support the URL scheme in {{.UnsupportedURL}}.",
560+
"translation": ""
561+
},
550562
{
551563
"id": "This command is in EXPERIMENTAL stage and may change without notice",
552564
"translation": ""
@@ -783,6 +795,10 @@
783795
"id": "{{.BinaryName}} version {{.VersionString}}",
784796
"translation": ""
785797
},
798+
{
799+
"id": "{{.Bytes}} bytes downloaded...",
800+
"translation": ""
801+
},
786802
{
787803
"id": "{{.MemorySize}} x {{.NumInstances}} instances",
788804
"translation": ""

cf/i18n/resources/en-us.all.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,6 +2939,10 @@
29392939
"id": "Features",
29402940
"translation": "Features"
29412941
},
2942+
{
2943+
"id": "File not a valid cf CLI plugin binary.",
2944+
"translation": ""
2945+
},
29422946
{
29432947
"id": "File not found locally, make sure the file exists at given path {{.FilePath}}",
29442948
"translation": ""
@@ -4400,8 +4404,8 @@
44004404
"translation": ""
44014405
},
44024406
{
4403-
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.Command}}' to force a reinstall.",
4404-
"translation": ""
4407+
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.BinaryName}} install-plugin -f' to force a reinstall.",
4408+
"translation": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.BinaryName}} install-plugin -f' to force a reinstall."
44054409
},
44064410
{
44074411
"id": "Plugin {{.Name}} {{.Version}} is already installed. Uninstalling existing plugin...",
@@ -5339,6 +5343,10 @@
53395343
"id": "Starting app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...",
53405344
"translation": "Starting app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}..."
53415345
},
5346+
{
5347+
"id": "Starting download of plugin binary from URL...",
5348+
"translation": ""
5349+
},
53425350
{
53435351
"id": "Startup command, set to null to reset to default start command",
53445352
"translation": "Startup command, set to null to reset to default start command"
@@ -5795,6 +5803,10 @@
57955803
"id": "This command",
57965804
"translation": "This command"
57975805
},
5806+
{
5807+
"id": "This command does not support the URL scheme in {{.UnsupportedURL}}.",
5808+
"translation": ""
5809+
},
57985810
{
57995811
"id": "This command is in EXPERIMENTAL stage and may change without notice",
58005812
"translation": ""
@@ -7063,6 +7075,10 @@
70637075
"id": "{{.BinaryName}} version {{.VersionString}}",
70647076
"translation": ""
70657077
},
7078+
{
7079+
"id": "{{.Bytes}} bytes downloaded...",
7080+
"translation": ""
7081+
},
70667082
{
70677083
"id": "{{.CFName}} api",
70687084
"translation": "{{.CFName}} api"

cf/i18n/resources/es-es.all.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2939,6 +2939,10 @@
29392939
"id": "Features",
29402940
"translation": "Características"
29412941
},
2942+
{
2943+
"id": "File not a valid cf CLI plugin binary.",
2944+
"translation": ""
2945+
},
29422946
{
29432947
"id": "File not found locally, make sure the file exists at given path {{.FilePath}}",
29442948
"translation": ""
@@ -4400,7 +4404,7 @@
44004404
"translation": ""
44014405
},
44024406
{
4403-
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.Command}}' to force a reinstall.",
4407+
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.BinaryName}} install-plugin -f' to force a reinstall.",
44044408
"translation": ""
44054409
},
44064410
{
@@ -5339,6 +5343,10 @@
53395343
"id": "Starting app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...",
53405344
"translation": "Iniciando app {{.AppName}} en la organización {{.OrgName}} / espacio {{.SpaceName}} como {{.CurrentUser}}..."
53415345
},
5346+
{
5347+
"id": "Starting download of plugin binary from URL...",
5348+
"translation": ""
5349+
},
53425350
{
53435351
"id": "Startup command, set to null to reset to default start command",
53445352
"translation": "Mandato de arranque, establecido en nulo para restablecer a predeterminado el mandato de inicio"
@@ -5795,6 +5803,10 @@
57955803
"id": "This command",
57965804
"translation": "Este mandato"
57975805
},
5806+
{
5807+
"id": "This command does not support the URL scheme in {{.UnsupportedURL}}.",
5808+
"translation": ""
5809+
},
57985810
{
57995811
"id": "This command is in EXPERIMENTAL stage and may change without notice",
58005812
"translation": ""
@@ -7063,6 +7075,10 @@
70637075
"id": "{{.BinaryName}} version {{.VersionString}}",
70647076
"translation": ""
70657077
},
7078+
{
7079+
"id": "{{.Bytes}} bytes downloaded...",
7080+
"translation": ""
7081+
},
70667082
{
70677083
"id": "{{.CFName}} api",
70687084
"translation": "API de {{.CFName}}"

cf/i18n/resources/es-es.untranslated.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@
207207
"id": "Error staging application: {{.Message}}\n\nTIP: Use '{{.BuildpackCommand}}' to see a list of supported buildpacks.",
208208
"translation": "Error staging application: {{.Message}}\n\nTIP: Use '{{.BuildpackCommand}}' to see a list of supported buildpacks."
209209
},
210+
{
211+
"id": "File not a valid cf CLI plugin binary.",
212+
"translation": ""
213+
},
210214
{
211215
"id": "File not found locally, make sure the file exists at given path {{.FilePath}}",
212216
"translation": ""
@@ -344,8 +348,8 @@
344348
"translation": ""
345349
},
346350
{
347-
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.Command}}' to force a reinstall.",
348-
"translation": ""
351+
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.BinaryName}} install-plugin -f' to force a reinstall.",
352+
"translation": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.BinaryName}} install-plugin -f' to force a reinstall."
349353
},
350354
{
351355
"id": "Plugin {{.Name}} {{.Version}} is already installed. Uninstalling existing plugin...",
@@ -491,6 +495,10 @@
491495
"id": "Start unsuccessful\n\nTIP: use '{{.BinaryName}} logs {{.AppName}} --recent' for more information",
492496
"translation": ""
493497
},
498+
{
499+
"id": "Starting download of plugin binary from URL...",
500+
"translation": ""
501+
},
494502
{
495503
"id": "Stop all instances of the app, then start them again. This may cause downtime.",
496504
"translation": ""
@@ -547,6 +555,10 @@
547555
"id": "This action impacts all orgs using this domain.\nDeleting it will remove associated routes and could make any app with this domain, in any org, unreachable.\nAre you sure you want to delete the domain {{.DomainName}}? ",
548556
"translation": "This action impacts all orgs using this domain.\nDeleting it will remove associated routes and could make any app with this domain, in any org, unreachable.\nAre you sure you want to delete the domain {{.DomainName}}? "
549557
},
558+
{
559+
"id": "This command does not support the URL scheme in {{.UnsupportedURL}}.",
560+
"translation": ""
561+
},
550562
{
551563
"id": "This command is in EXPERIMENTAL stage and may change without notice",
552564
"translation": ""
@@ -783,6 +795,10 @@
783795
"id": "{{.BinaryName}} version {{.VersionString}}",
784796
"translation": ""
785797
},
798+
{
799+
"id": "{{.Bytes}} bytes downloaded...",
800+
"translation": ""
801+
},
786802
{
787803
"id": "{{.MemorySize}} x {{.NumInstances}} instances",
788804
"translation": ""

cf/i18n/resources/fr-fr.all.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2939,6 +2939,10 @@
29392939
"id": "Features",
29402940
"translation": "Fonctions"
29412941
},
2942+
{
2943+
"id": "File not a valid cf CLI plugin binary.",
2944+
"translation": ""
2945+
},
29422946
{
29432947
"id": "File not found locally, make sure the file exists at given path {{.FilePath}}",
29442948
"translation": ""
@@ -4400,7 +4404,7 @@
44004404
"translation": ""
44014405
},
44024406
{
4403-
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.Command}}' to force a reinstall.",
4407+
"id": "Plugin {{.Name}} {{.Version}} could not be installed. A plugin with that name is already installed.\nTIP: Use '{{.BinaryName}} install-plugin -f' to force a reinstall.",
44044408
"translation": ""
44054409
},
44064410
{
@@ -5339,6 +5343,10 @@
53395343
"id": "Starting app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.CurrentUser}}...",
53405344
"translation": "Démarrage de l'application {{.AppName}} dans l'organisation {{.OrgName}} / l'espace {{.SpaceName}} en tant que {{.CurrentUser}}..."
53415345
},
5346+
{
5347+
"id": "Starting download of plugin binary from URL...",
5348+
"translation": ""
5349+
},
53425350
{
53435351
"id": "Startup command, set to null to reset to default start command",
53445352
"translation": "Commande de démarrage, avec valeur NULL pour réinitialiser la commande de démarrage par défaut"
@@ -5795,6 +5803,10 @@
57955803
"id": "This command",
57965804
"translation": "Cette commande"
57975805
},
5806+
{
5807+
"id": "This command does not support the URL scheme in {{.UnsupportedURL}}.",
5808+
"translation": ""
5809+
},
57985810
{
57995811
"id": "This command is in EXPERIMENTAL stage and may change without notice",
58005812
"translation": ""
@@ -7063,6 +7075,10 @@
70637075
"id": "{{.BinaryName}} version {{.VersionString}}",
70647076
"translation": ""
70657077
},
7078+
{
7079+
"id": "{{.Bytes}} bytes downloaded...",
7080+
"translation": ""
7081+
},
70667082
{
70677083
"id": "{{.CFName}} api",
70687084
"translation": "API {{.CFName}}"

0 commit comments

Comments
 (0)