Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
aec6c507
Commit
aec6c507
authored
Dec 03, 2016
by
Matt Butcher
Committed by
GitHub
Dec 03, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1621 from technosophos/fix/tests-for-plugins
fi(helm): add more tests for plugins
parents
ec04da19
a5d818dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
12 deletions
+47
-12
plugins.go
cmd/helm/plugins.go
+5
-1
plugins_test.go
cmd/helm/plugins_test.go
+34
-0
plugins.md
docs/plugins.md
+8
-11
No files found.
cmd/helm/plugins.go
View file @
aec6c507
...
...
@@ -173,10 +173,14 @@ func setupEnv(shortname, base, plugdirs string, home helmpath.Home) {
"HELM_PATH_REPOSITORY_FILE"
:
home
.
RepositoryFile
(),
"HELM_PATH_CACHE"
:
home
.
Cache
(),
"HELM_PATH_LOCAL_REPOSITORY"
:
home
.
LocalRepository
(),
//"HELM_PATH_STARTER": home.Starter
(),
"HELM_PATH_STARTER"
:
home
.
Starters
(),
"TILLER_HOST"
:
tillerHost
,
}
{
os
.
Setenv
(
key
,
val
)
}
if
flagDebug
{
os
.
Setenv
(
"HELM_DEBUG"
,
"1"
)
}
}
cmd/helm/plugins_test.go
View file @
aec6c507
...
...
@@ -18,6 +18,7 @@ package main
import
(
"bytes"
"os"
"path/filepath"
"strings"
"testing"
...
...
@@ -128,3 +129,36 @@ func TestLoadPlugins(t *testing.T) {
}
}
}
func
TestSetupEnv
(
t
*
testing
.
T
)
{
name
:=
"pequod"
hh
:=
helmpath
.
Home
(
"testdata/helmhome"
)
base
:=
filepath
.
Join
(
hh
.
Plugins
(),
name
)
plugdirs
:=
hh
.
Plugins
()
flagDebug
=
true
defer
func
()
{
flagDebug
=
false
}()
setupEnv
(
name
,
base
,
plugdirs
,
hh
)
for
_
,
tt
:=
range
[]
struct
{
name
string
expect
string
}{
{
"HELM_PLUGIN_NAME"
,
name
},
{
"HELM_PLUGIN_DIR"
,
base
},
{
"HELM_PLUGIN"
,
hh
.
Plugins
()},
{
"HELM_DEBUG"
,
"1"
},
{
"HELM_HOME"
,
hh
.
String
()},
{
"HELM_PATH_REPOSITORY"
,
hh
.
Repository
()},
{
"HELM_PATH_REPOSITORY_FILE"
,
hh
.
RepositoryFile
()},
{
"HELM_PATH_CACHE"
,
hh
.
Cache
()},
{
"HELM_PATH_LOCAL_REPOSITORY"
,
hh
.
LocalRepository
()},
{
"HELM_PATH_STARTER"
,
hh
.
Starters
()},
{
"TILLER_HOST"
,
tillerHost
},
}
{
if
got
:=
os
.
Getenv
(
tt
.
name
);
got
!=
tt
.
expect
{
t
.
Errorf
(
"Expected $%s=%q, got %q"
,
tt
.
name
,
tt
.
expect
,
got
)
}
}
}
docs/plugins.md
View file @
aec6c507
...
...
@@ -159,18 +159,15 @@ to use the tunnel.
## A Note on Flag Parsing
When executing a plugin, Helm will parse global flags for its own use
, but pass
all flags
to the plugin.
When executing a plugin, Helm will parse global flags for its own use
. Some of
these flags are _not_ passed on
to the plugin.
Plugins MUST NOT produce an error for the following flags:
-
`--debug`
-
`--home`
-
`--host`
-
`--kube-context`
-
`-h`
-
`--help`
-
`--debug`
: If this is specified,
`$HELM_DEBUG`
is set to
`1`
-
`--home`
: This is converted to
`$HELM_HOME`
-
`--host`
: This is convereted to
`$HELM_HOST`
-
`--kube-context`
: This is simply dropped. If your plugin uses
`useTunnel`
, this
is used to set up the tunnel for you.
Plugins _should_ display help text and then exit for
`-h`
and
`--help`
. In all
other cases, plugins may
simply ignore the flags
.
other cases, plugins may
use flags as appropriate
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment