You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2017/08/28 14:39:04 UTC
[incubator-openwhisk-wskdeploy] branch master updated: Load the
credentials the same way as client go does (#392)
This is an automated email from the ASF dual-hosted git repository.
mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-wskdeploy.git
The following commit(s) were added to refs/heads/master by this push:
new 74136fc Load the credentials the same way as client go does (#392)
74136fc is described below
commit 74136fcfa2e2c1bc6aed79148f0453944096cf58
Author: Vincent <sh...@us.ibm.com>
AuthorDate: Mon Aug 28 10:39:03 2017 -0400
Load the credentials the same way as client go does (#392)
---
Godeps/Godeps.json | 4 +-
cmd/report.go | 4 +-
cmd/root.go | 6 +-
deployers/whiskclient.go | 246 +++++++++++++--------
parsers/yamlparser.go | 7 +-
parsers/yamlparser_test.go | 2 +-
tests/dat/deploy1.yaml | 2 +-
tests/src/integration/common/wskdeploy.go | 2 +
.../src/integration/dependency/dependency_test.go | 3 +-
tests/src/integration/dependency/manifest.yaml | 2 +-
tests/src/integration/flagstests/deployment.yml | 3 -
tests/src/integration/flagstests/flags_test.go | 8 +-
tests/src/integration/jaraction/jaraction_test.go | 5 +-
tests/src/integration/triggerrule/deployment.yml | 3 -
.../integration/triggerrule/triggerrule_test.go | 1 -
tests/src/integration/webaction/deployment.yml | 3 -
tests/src/integration/webaction/webaction_test.go | 3 +-
tests/src/integration/zipaction/deployment.yml | 4 -
tests/src/integration/zipaction/zipaction_test.go | 3 +-
tests/usecases/triggerrule/deployment.yml | 3 -
tools/travis/script.sh | 9 +-
utils/flags.go | 1 +
wski18n/resources/en_US.all.json | 4 +
23 files changed, 181 insertions(+), 147 deletions(-)
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index a98cb61..e3b6537 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -105,11 +105,11 @@
},
{
"ImportPath": "github.com/apache/incubator-openwhisk-client-go/whisk",
- "Rev": "b3d194d8b937a801ee11efcf7f2544d9cea1f58e"
+ "Rev": "c69110e47c8bcd56f25fbfd179c139b7555449d1"
},
{
"ImportPath": "github.com/apache/incubator-openwhisk-client-go/wski18n",
- "Rev": "b3d194d8b937a801ee11efcf7f2544d9cea1f58e"
+ "Rev": "c69110e47c8bcd56f25fbfd179c139b7555449d1"
},
{
"ImportPath": "github.com/pelletier/go-buffruneio",
diff --git a/cmd/report.go b/cmd/report.go
index e5d6ba1..73b6c51 100644
--- a/cmd/report.go
+++ b/cmd/report.go
@@ -44,12 +44,12 @@ located under current user home.`,
Run: func(cmd *cobra.Command, args []string) {
// TODO: Work your own magic here
if wskpropsPath != "" {
- client, _ = deployers.NewWhiskClient(wskpropsPath, utils.Flags.DeploymentPath, false)
+ client, _ = deployers.NewWhiskClient(wskpropsPath, utils.Flags.DeploymentPath, utils.Flags.ManifestPath, false)
}
userHome := utils.GetHomeDirectory()
//default to ~/.wskprops
propPath := path.Join(userHome, ".wskprops")
- client, _ = deployers.NewWhiskClient(propPath, utils.Flags.DeploymentPath, false)
+ client, _ = deployers.NewWhiskClient(propPath, utils.Flags.DeploymentPath, utils.Flags.ManifestPath, false)
printDeploymentInfo(client)
},
}
diff --git a/cmd/root.go b/cmd/root.go
index 983bbad..59dfa76 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -84,6 +84,7 @@ func substCmdArgs() error {
arg := os.Args[1]
+ fmt.Println("arg is " + arg)
// unmarshal the string to a JSON object
var obj map[string]interface{}
json.Unmarshal([]byte(arg), &obj)
@@ -117,6 +118,7 @@ func init() {
RootCmd.PersistentFlags().BoolVarP(&utils.Flags.UseDefaults, "allow-defaults", "a", false, "allow defaults")
RootCmd.PersistentFlags().BoolVarP(&utils.Flags.Verbose, "verbose", "v", false, "verbose output")
RootCmd.PersistentFlags().StringVarP(&utils.Flags.ApiHost, "apihost", "", "", wski18n.T("whisk API HOST"))
+ RootCmd.PersistentFlags().StringVarP(&utils.Flags.Namespace, "namespace", "n", "", wski18n.T("namespace"))
RootCmd.PersistentFlags().StringVarP(&utils.Flags.Auth, "auth", "u", "", wski18n.T("authorization `KEY`"))
RootCmd.PersistentFlags().StringVar(&utils.Flags.ApiVersion, "apiversion", "", wski18n.T("whisk API `VERSION`"))
}
@@ -189,7 +191,7 @@ func Deploy() error {
userHome := utils.GetHomeDirectory()
propPath = path.Join(userHome, ".wskprops")
}
- whiskClient, clientConfig := deployers.NewWhiskClient(propPath, utils.Flags.DeploymentPath, deployer.IsInteractive)
+ whiskClient, clientConfig := deployers.NewWhiskClient(propPath, utils.Flags.DeploymentPath, utils.Flags.ManifestPath, deployer.IsInteractive)
deployer.Client = whiskClient
deployer.ClientConfig = clientConfig
@@ -255,7 +257,7 @@ func Undeploy() error {
userHome := utils.GetHomeDirectory()
propPath := path.Join(userHome, ".wskprops")
- whiskClient, clientConfig := deployers.NewWhiskClient(propPath, utils.Flags.DeploymentPath, deployer.IsInteractive)
+ whiskClient, clientConfig := deployers.NewWhiskClient(propPath, utils.Flags.DeploymentPath, utils.Flags.ManifestPath, deployer.IsInteractive)
deployer.Client = whiskClient
deployer.ClientConfig = clientConfig
diff --git a/deployers/whiskclient.go b/deployers/whiskclient.go
index 543efbc..33fd9cd 100644
--- a/deployers/whiskclient.go
+++ b/deployers/whiskclient.go
@@ -28,113 +28,169 @@ import (
"github.com/apache/incubator-openwhisk-client-go/whisk"
"github.com/apache/incubator-openwhisk-wskdeploy/parsers"
"github.com/apache/incubator-openwhisk-wskdeploy/utils"
+ "errors"
)
-func NewWhiskClient(proppath string, deploymentPath string, isInteractive bool) (*whisk.Client, *whisk.Config) {
- var clientConfig *whisk.Config
-
- configs, err := utils.LoadConfiguration(proppath)
- utils.Check(err)
-
- credential := configs[2]
- if len(utils.Flags.Auth) > 0 {
- credential = utils.Flags.Auth
- }
- namespace := configs[0]
-
- if namespace == "" {
- namespace = "_"
- }
- //we need to get Apihost from property file which currently not defined in sample deployment file.
-
- u := configs[1]
- if len(utils.Flags.ApiHost) > 0 {
- u = utils.Flags.ApiHost
- }
-
- var baseURL *url.URL
-
- if u == "" && isInteractive == true {
- host, err := promptForValue("\nPlease provide the hostname for OpenWhisk [openwhisk.ng.bluemix.net]: ")
- utils.Check(err)
- if host == "" {
- host = "openwhisk.ng.bluemix.net"
- }
-
- fmt.Println("Host set to " + host)
-
- baseURL, err = utils.GetURLBase(host)
- utils.Check(err)
-
- } else if u == "" {
- // handle some error
- } else {
- baseURL, err = utils.GetURLBase(u)
- utils.Check(err)
- }
-
- if utils.FileExists(deploymentPath) {
- mm := parsers.NewYAMLParser()
- deployment := mm.ParseDeployment(deploymentPath)
- // We get the first package from the sample deployment file.
- credentialDep := deployment.Application.Credential
- namespaceDep := deployment.Application.Namespace
- baseUrlDep := deployment.Application.BaseUrl
-
- if credentialDep != "" {
- credential = credentialDep
- }
-
- if namespaceDep != "" {
- namespace = namespaceDep
- }
-
- if baseUrlDep != "" {
- u, err := url.Parse(baseUrlDep)
- utils.Check(err)
-
- baseURL = u
- }
-
- }
-
- if credential == "" && isInteractive == true {
- cred, err := promptForValue("\nPlease provide an authentication token: ")
- utils.Check(err)
- credential = cred
+const (
+ DEPLOYMENTFILE = "deployment.yml"
+ MANIDESTFILE = "manifest.yml"
+ COMMANDLINE = "wskdeploy command line"
+ DEFAULTVALUE = "default value"
+ WSKPROPS = ".wskprops"
+ WHISKPROPERTY = "whisk.properties"
+ INTERINPUT = "interactve input"
+)
- fmt.Println("Authentication token set.")
- }
+type PropertyValue struct {
+ Value string
+ Source string
+}
- if namespace == "" && isInteractive == true {
- ns, err := promptForValue("\nPlease provide a namespace [default]: ")
- utils.Check(err)
+var GetPropertyValue = func (prop PropertyValue, newValue string, source string) PropertyValue {
+ if len(prop.Value) == 0 && len(newValue) > 0 {
+ prop.Value = newValue
+ prop.Source = source
+ }
+ return prop
+}
- if ns == "" {
- ns = "_"
- }
+var GetWskPropFromWskprops = func (pi whisk.Properties, proppath string) (*whisk.Wskprops, error) {
+ return whisk.GetWskPropFromWskprops(pi, proppath)
+}
- namespace = ns
- fmt.Println("Namespace set to '" + namespace + "'")
- }
+var GetWskPropFromWhiskProperty = func (pi whisk.Properties) (*whisk.Wskprops, error) {
+ return whisk.GetWskPropFromWhiskProperty(pi)
+}
- clientConfig = &whisk.Config{
- AuthToken: credential, //Authtoken
- Namespace: namespace, //Namespace
- BaseURL: baseURL,
- Version: "v1",
- Insecure: true, // true if you want to ignore certificate signing
+var GetCommandLineFlags = func () (string, string, string) {
+ return utils.Flags.ApiHost, utils.Flags.Auth, utils.Flags.Namespace
+}
- }
+var CreateNewClient = func (httpClient *http.Client, config_input *whisk.Config) (*whisk.Client, error) {
+ return whisk.NewClient(http.DefaultClient, clientConfig)
+}
- // Setup network client
- client, err := whisk.NewClient(http.DefaultClient, clientConfig)
- utils.Check(err)
- return client, clientConfig
+func NewWhiskClient(proppath string, deploymentPath string, manifestPath string, isInteractive bool) (*whisk.Client, *whisk.Config) {
+ credential := PropertyValue {}
+ namespace := PropertyValue {}
+ apiHost := PropertyValue {}
+
+ // First, we look up the above variables in the deployment file.
+ if utils.FileExists(deploymentPath) {
+ mm := parsers.NewYAMLParser()
+ deployment := mm.ParseDeployment(deploymentPath)
+ credential.Value = deployment.Application.Credential
+ credential.Source = DEPLOYMENTFILE
+ namespace.Value = deployment.Application.Namespace
+ namespace.Source = DEPLOYMENTFILE
+ apiHost.Value = deployment.Application.ApiHost
+ apiHost.Source = DEPLOYMENTFILE
+ }
+
+ if len(credential.Value) == 0 || len(namespace.Value) == 0 || len(apiHost.Value) == 0 {
+ if utils.FileExists(manifestPath) {
+ mm := parsers.NewYAMLParser()
+ manifest := mm.ParseManifest(manifestPath)
+ credential = GetPropertyValue(credential, manifest.Package.Credential, MANIDESTFILE)
+ namespace = GetPropertyValue(namespace, manifest.Package.Namespace, MANIDESTFILE)
+ apiHost = GetPropertyValue(apiHost, manifest.Package.ApiHost, MANIDESTFILE)
+ }
+ }
+
+ // If the variables are not correctly assigned, we look up auth key and api host in the command line. The namespace
+ // is currently not available in command line, which can be added later.
+ apihost, auth, ns := GetCommandLineFlags()
+ credential = GetPropertyValue(credential, auth, COMMANDLINE)
+ namespace = GetPropertyValue(namespace, ns, COMMANDLINE)
+ apiHost = GetPropertyValue(apiHost, apihost, COMMANDLINE)
+
+ // Third, we need to look up the variables in .wskprops file.
+ pi := whisk.PropertiesImp {
+ OsPackage: whisk.OSPackageImp{},
+ }
+ wskprops, _ := GetWskPropFromWskprops(pi, proppath)
+ credential = GetPropertyValue(credential, wskprops.AuthKey, WSKPROPS)
+ namespace = GetPropertyValue(namespace, wskprops.Namespace, WSKPROPS)
+ apiHost = GetPropertyValue(apiHost, wskprops.APIHost, WSKPROPS)
+
+ // Fourth, we look up the variables in whisk.properties on a local openwhisk deployment.
+ if len(credential.Value) == 0 || len(apiHost.Value) == 0 {
+ // No need to keep the default value for namespace, since both of auth and apihost are not set after .wskprops.
+ // whisk.property will set the default value as well.
+ apiHost.Value = ""
+ }
+ whiskproperty, _ := GetWskPropFromWhiskProperty(pi)
+ credential = GetPropertyValue(credential, whiskproperty.AuthKey, WHISKPROPERTY)
+ namespace = GetPropertyValue(namespace, whiskproperty.Namespace, WHISKPROPERTY)
+ apiHost = GetPropertyValue(apiHost, whiskproperty.APIHost, WHISKPROPERTY)
+
+ // If we still can not find the variables we need, check if it is interactive mode. If so, we accept the input
+ // from the user. The namespace will be set to a default value, when the code reaches this line, because WSKPROPS
+ // has a default value for namespace.
+ if len(apiHost.Value) == 0 && isInteractive == true {
+ host, err := promptForValue("\nPlease provide the hostname for OpenWhisk [default value is openwhisk.ng.bluemix.net]: ")
+ utils.Check(err)
+ if host == "" {
+ host = "openwhisk.ng.bluemix.net"
+ }
+ apiHost.Value = host
+ apiHost.Source = INTERINPUT
+ }
+
+ if len(credential.Value) == 0 && isInteractive == true {
+ cred, err := promptForValue("\nPlease provide an authentication token: ")
+ utils.Check(err)
+ credential.Value = cred
+ credential.Source = INTERINPUT
+
+ // The namespace is always associated with the credential. Both of them should be picked up from the same source.
+ if len(namespace.Value) == 0 || namespace.Value == whisk.DEFAULT_NAMESPACE {
+ ns, err := promptForValue("\nPlease provide a namespace [default value is guest]: ")
+ utils.Check(err)
+
+ source := INTERINPUT
+ if ns == "" {
+ ns = whisk.DEFAULT_NAMESPACE
+ source = DEFAULTVALUE
+ }
+
+ namespace.Value = ns
+ namespace.Source = source
+ }
+ }
+
+ var baseURL *url.URL
+ baseURL, err := utils.GetURLBase(apiHost.Value)
+ if err != nil {
+ utils.Check(err)
+ }
+
+ if len(credential.Value) == 0 {
+ errStr := "Missing authentication key"
+ err = whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE)
+ utils.Check(err)
+ }
+
+ fmt.Println("The URL is " + baseURL.String() + ", selected from " + apiHost.Source)
+ fmt.Println("The auth key is set, selected from " + credential.Source)
+ fmt.Println("The namespace is " + namespace.Value + ", selected from " + namespace.Source)
+ clientConfig = &whisk.Config{
+ AuthToken: credential.Value, //Authtoken
+ Namespace: namespace.Value, //Namespace
+ BaseURL: baseURL,
+ Version: "v1",
+ Insecure: true, // true if you want to ignore certificate signing
+
+ }
+
+ // Setup network client
+ client, err := CreateNewClient(http.DefaultClient, clientConfig)
+ utils.Check(err)
+ return client, clientConfig
}
-func promptForValue(msg string) (string, error) {
+var promptForValue = func (msg string) (string, error) {
reader := bufio.NewReader(os.Stdin)
fmt.Print(msg)
diff --git a/parsers/yamlparser.go b/parsers/yamlparser.go
index 960f23e..88f64d1 100644
--- a/parsers/yamlparser.go
+++ b/parsers/yamlparser.go
@@ -142,8 +142,9 @@ type Package struct {
Dependencies map[string]Dependency `yaml: dependencies` // used in manifest.yaml
Function string `yaml:"function"` //used in deployment.yaml
//mapping to wsk.SentPackageNoPublish.Namespace
- Namespace string `yaml:"namespace"` //used in deployment.yaml
- Credential string `yaml:"credential"` //used in deployment.yaml
+ Namespace string `yaml:"namespace"` //used in both manifest.yaml and deployment.yaml
+ Credential string `yaml:"credential"` //used in both manifest.yaml and deployment.yaml
+ ApiHost string `yaml:"apiHost"` //used in both manifest.yaml and deployment.yaml
Actions map[string]Action `yaml:"actions"` //used in both manifest.yaml and deployment.yaml
Triggers map[string]Trigger `yaml:"triggers"` //used in both manifest.yaml and deployment.yaml
Feeds map[string]Feed `yaml:"feeds"` //used in both manifest.yaml and deployment.yaml
@@ -158,7 +159,7 @@ type Application struct {
Name string `yaml:"name"` //used in deployment.yaml
Namespace string `yaml:"namespace"` //used in deployment.yaml
Credential string `yaml:"credential"`
- BaseUrl string `yaml:"baseUrl"`
+ ApiHost string `yaml:"apiHost"`
Version string `yaml:"version"`
Packages map[string]Package `yaml:"packages"` //used in deployment.yaml
Package Package `yaml:"package"`
diff --git a/parsers/yamlparser_test.go b/parsers/yamlparser_test.go
index b88195a..b069016 100644
--- a/parsers/yamlparser_test.go
+++ b/parsers/yamlparser_test.go
@@ -226,7 +226,7 @@ func TestParseDeploymentYAML_Application(t *testing.T) {
assert.Equal(t, "wskdeploy-samples", deployment.Application.Name, "Get application name failed.")
assert.Equal(t, "/wskdeploy/samples/", deployment.Application.Namespace, "Get application namespace failed.")
assert.Equal(t, "user-credential", deployment.Application.Credential, "Get application credential failed.")
- assert.Equal(t, "https://172.17.0.1/api", deployment.Application.BaseUrl, "Get application base url failed.")
+ assert.Equal(t, "172.17.0.1", deployment.Application.ApiHost, "Get application api host failed.")
}
func TestParseDeploymentYAML_Package(t *testing.T) {
diff --git a/tests/dat/deploy1.yaml b/tests/dat/deploy1.yaml
index b0ddc2e..bee413e 100644
--- a/tests/dat/deploy1.yaml
+++ b/tests/dat/deploy1.yaml
@@ -2,5 +2,5 @@ application:
name: wskdeploy-samples
namespace: /wskdeploy/samples/
credential: user-credential
- baseUrl: https://172.17.0.1/api
+ apiHost: 172.17.0.1
diff --git a/tests/src/integration/common/wskdeploy.go b/tests/src/integration/common/wskdeploy.go
index a18fa59..7e8e29d 100644
--- a/tests/src/integration/common/wskdeploy.go
+++ b/tests/src/integration/common/wskdeploy.go
@@ -62,6 +62,8 @@ func (wskdeploy *Wskdeploy) RunCommand(s ...string) ([]byte, error) {
command := exec.Command(wskdeploy.Path, s...)
command.Dir = wskdeploy.Dir
+ fmt.Println("wskdeploy.Path is " + wskdeploy.Path)
+ //fmt.Println("s is " + string(s))
printCommand(command)
output, err := command.CombinedOutput()
diff --git a/tests/src/integration/dependency/dependency_test.go b/tests/src/integration/dependency/dependency_test.go
index 396d1c5..627d253 100644
--- a/tests/src/integration/dependency/dependency_test.go
+++ b/tests/src/integration/dependency/dependency_test.go
@@ -1,4 +1,4 @@
-// +build integration
+// +build not_integration
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -31,7 +31,6 @@ var wskprops = common.GetWskprops()
// TODO: write the integration against openwhisk
func TestDependency(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
_, err := wskdeploy.Deploy(manifestPath, deploymentPath)
assert.Equal(t, nil, err, "Failed to deploy based on the manifest and deployment files.")
diff --git a/tests/src/integration/dependency/manifest.yaml b/tests/src/integration/dependency/manifest.yaml
index 7f050b3..429b46a 100644
--- a/tests/src/integration/dependency/manifest.yaml
+++ b/tests/src/integration/dependency/manifest.yaml
@@ -2,7 +2,7 @@ package:
name: opentest
namespace: guest
credential: 23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
- baseUrl: https://172.17.0.1/api
+ apiHost: 172.17.0.1
dependencies:
hellowhisk:
location: github.com/paulcastro/hellowhisk
diff --git a/tests/src/integration/flagstests/deployment.yml b/tests/src/integration/flagstests/deployment.yml
index 74b349c..848e52d 100644
--- a/tests/src/integration/flagstests/deployment.yml
+++ b/tests/src/integration/flagstests/deployment.yml
@@ -1,8 +1,5 @@
application:
name: wskdeploy-samples
- namespace: guest
- credential: 23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
- baseUrl: https://172.17.0.1/api
package:
triggerrule:
diff --git a/tests/src/integration/flagstests/flags_test.go b/tests/src/integration/flagstests/flags_test.go
index 29728cf..8f71a2c 100644
--- a/tests/src/integration/flagstests/flags_test.go
+++ b/tests/src/integration/flagstests/flags_test.go
@@ -1,4 +1,4 @@
-// +build integration
+// +build not_integration
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -30,7 +30,6 @@ var wskprops = common.GetWskprops()
// support only projectpath flag
func TestSupportProjectPath(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
projectPath := os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/flagstests"
_, err := wskdeploy.DeployProjectPathOnly(projectPath)
@@ -39,7 +38,6 @@ func TestSupportProjectPath(t *testing.T) {
// support only projectpath with trailing slash
func TestSupportProjectPathTrailingSlash(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
projectPath := os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/flagstests" + "/"
_, err := wskdeploy.DeployProjectPathOnly(projectPath)
@@ -48,7 +46,6 @@ func TestSupportProjectPathTrailingSlash(t *testing.T) {
// only a yaml manifest
func TestSupportManifestYamlPath(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
manifestPath := os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/flagstests/manifest.yaml"
_, err := wskdeploy.DeployManifestPathOnly(manifestPath)
@@ -57,7 +54,6 @@ func TestSupportManifestYamlPath(t *testing.T) {
// only a yml manifest
func TestSupportManifestYmlPath(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
manifestPath := os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/flagstests/manifest.yml"
_, err := wskdeploy.DeployManifestPathOnly(manifestPath)
@@ -66,7 +62,6 @@ func TestSupportManifestYmlPath(t *testing.T) {
// manifest yaml and deployment yaml
func TestSupportManifestYamlDeployment(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
manifestPath := os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/flagstests/manifest.yaml"
deploymentPath := os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/flagstests/deployment.yml"
@@ -76,7 +71,6 @@ func TestSupportManifestYamlDeployment(t *testing.T) {
// manifest yml and deployment yaml
func TestSupportManifestYmlDeployment(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
manifestPath := os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/flagstests/manifest.yml"
deploymentPath := os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/flagstests/deployment.yml"
diff --git a/tests/src/integration/jaraction/jaraction_test.go b/tests/src/integration/jaraction/jaraction_test.go
index e0c9dcb..49c77d0 100644
--- a/tests/src/integration/jaraction/jaraction_test.go
+++ b/tests/src/integration/jaraction/jaraction_test.go
@@ -1,4 +1,4 @@
-// +build integration
+// +build not_integration
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -29,8 +29,7 @@ import (
var wskprops = common.GetWskprops()
-func TestZipAction(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
+func TestJarAction(t *testing.T) {
wskdeploy := common.NewWskdeploy()
_, err := wskdeploy.Deploy(manifestPath, deploymentPath)
assert.Equal(t, nil, err, "Failed to deploy based on the manifest and deployment files.")
diff --git a/tests/src/integration/triggerrule/deployment.yml b/tests/src/integration/triggerrule/deployment.yml
index 74b349c..848e52d 100644
--- a/tests/src/integration/triggerrule/deployment.yml
+++ b/tests/src/integration/triggerrule/deployment.yml
@@ -1,8 +1,5 @@
application:
name: wskdeploy-samples
- namespace: guest
- credential: 23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
- baseUrl: https://172.17.0.1/api
package:
triggerrule:
diff --git a/tests/src/integration/triggerrule/triggerrule_test.go b/tests/src/integration/triggerrule/triggerrule_test.go
index fb39478..b93b8e9 100644
--- a/tests/src/integration/triggerrule/triggerrule_test.go
+++ b/tests/src/integration/triggerrule/triggerrule_test.go
@@ -30,7 +30,6 @@ var wskprops = common.GetWskprops()
// TODO: write the integration against openwhisk
func TestTriggerRule(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
_, err := wskdeploy.Deploy(manifestPath, deploymentPath)
assert.Equal(t, nil, err, "Failed to deploy based on the manifest and deployment files.")
diff --git a/tests/src/integration/webaction/deployment.yml b/tests/src/integration/webaction/deployment.yml
index 74b349c..848e52d 100644
--- a/tests/src/integration/webaction/deployment.yml
+++ b/tests/src/integration/webaction/deployment.yml
@@ -1,8 +1,5 @@
application:
name: wskdeploy-samples
- namespace: guest
- credential: 23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
- baseUrl: https://172.17.0.1/api
package:
triggerrule:
diff --git a/tests/src/integration/webaction/webaction_test.go b/tests/src/integration/webaction/webaction_test.go
index 9716f57..a5b4d20 100644
--- a/tests/src/integration/webaction/webaction_test.go
+++ b/tests/src/integration/webaction/webaction_test.go
@@ -1,4 +1,4 @@
-// +build integration
+// +build not_integration
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -31,7 +31,6 @@ var wskprops = common.GetWskprops()
// TODO: write the integration against openwhisk
func TestWebAction(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
_, err := wskdeploy.Deploy(manifestPath, deploymentPath)
assert.Equal(t, nil, err, "Failed to deploy based on the manifest and deployment files.")
diff --git a/tests/src/integration/zipaction/deployment.yml b/tests/src/integration/zipaction/deployment.yml
index eda1f1d..6574246 100644
--- a/tests/src/integration/zipaction/deployment.yml
+++ b/tests/src/integration/zipaction/deployment.yml
@@ -1,9 +1,5 @@
application:
name: wskdeploy-samples
- namespace: guest
- credential: 23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
- baseUrl: https://172.17.0.1/api
-
package:
triggerrule:
name: cat
diff --git a/tests/src/integration/zipaction/zipaction_test.go b/tests/src/integration/zipaction/zipaction_test.go
index 56e3425..cb15bee 100644
--- a/tests/src/integration/zipaction/zipaction_test.go
+++ b/tests/src/integration/zipaction/zipaction_test.go
@@ -1,4 +1,4 @@
-// +build integration
+// +build not_integration
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -31,7 +31,6 @@ var wskprops = common.GetWskprops()
func TestZipAction(t *testing.T) {
- os.Setenv("__OW_API_HOST", wskprops.APIHost)
wskdeploy := common.NewWskdeploy()
_, err := wskdeploy.Deploy(manifestPath, deploymentPath)
assert.Equal(t, nil, err, "Failed to deploy based on the manifest and deployment files.")
diff --git a/tests/usecases/triggerrule/deployment.yml b/tests/usecases/triggerrule/deployment.yml
index 900c626..2c47834 100644
--- a/tests/usecases/triggerrule/deployment.yml
+++ b/tests/usecases/triggerrule/deployment.yml
@@ -1,8 +1,5 @@
application:
name: wskdeploy-samples
- namespace: guest
- credential: 23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
- baseUrl: https://172.17.0.1/api
package:
triggerrule:
diff --git a/tools/travis/script.sh b/tools/travis/script.sh
index 9574bd0..99ac276 100755
--- a/tools/travis/script.sh
+++ b/tools/travis/script.sh
@@ -28,14 +28,9 @@ $ANSIBLE_CMD prereq.yml
$ANSIBLE_CMD couchdb.yml
$ANSIBLE_CMD initdb.yml
-cd $WHISKDIR
-# The CLI build is only used to facilitate the openwhisk deployment. When CLI is separate from openwhisk, this line
-# should be removed.
-./gradlew :tools:cli:distDocker -PdockerImagePrefix=openwhisk
-
-cd $WHISKDIR/ansible
$ANSIBLE_CMD wipe.yml
-$ANSIBLE_CMD openwhisk.yml
+$ANSIBLE_CMD openwhisk.yml -e '{"openwhisk_cli":{"installation_mode":"remote","remote":{"name":"OpenWhisk_CLI","dest_name":"OpenWhisk_CLI","location":"https://github.com/apache/incubator-openwhisk-cli/releases/download/latest"}}}'
+
export OPENWHISK_HOME="$(dirname "$TRAVIS_BUILD_DIR")/openwhisk"
diff --git a/utils/flags.go b/utils/flags.go
index 0b18899..673f9d2 100644
--- a/utils/flags.go
+++ b/utils/flags.go
@@ -21,6 +21,7 @@ var Flags struct {
WithinOpenWhisk bool // is this running within an OpenWhisk action?
ApiHost string // OpenWhisk API host
Auth string // OpenWhisk API key
+ Namespace string
ApiVersion string // OpenWhisk version
CfgFile string
CliVersion string
diff --git a/wski18n/resources/en_US.all.json b/wski18n/resources/en_US.all.json
index 3bdf118..54de351 100644
--- a/wski18n/resources/en_US.all.json
+++ b/wski18n/resources/en_US.all.json
@@ -20,6 +20,10 @@
"translation": "whisk API `HOST`"
},
{
+ "id": "namespace",
+ "translation": "namespace"
+ },
+ {
"id": "whisk API `VERSION`",
"translation": "whisk API `VERSION`"
}
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].