[incubator-openwhisk-cli] 01/02: Added changes for classes and variables casing to be get exported and can be used in other places (#2675)
This is an automated email from the ASF dual-hosted git repository. dubeejw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git commit eca5dde8aaeebab8dd6ba8ab52c5fd8c1dfa3762 Author: Jesus AlvaAuthorDate: Fri Sep 22 12:43:43 2017 -0500 Added changes for classes and variables casing to be get exported and can be used in other places (#2675) * Updating classes and variables so that they are exported and usable by other modules * Updating missed debug statements to have case of client -> Client --- commands/action.go | 64 +- commands/activation.go | 54 ++--- commands/api.go| 54 ++--- commands/commands.go | 6 ++-- commands/namespace.go | 18 +- commands/package.go| 84 ++-- commands/property.go | 51 ++- commands/qualified_name.go | 8 ++--- commands/rule.go | 86 +++--- commands/sdk.go| 6 ++-- commands/trigger.go| 72 +++--- commands/util.go | 4 +-- commands/wsk.go| 2 +- wski18n/i18n_resources.go | 20 +-- 14 files changed, 264 insertions(+), 265 deletions(-) diff --git a/commands/action.go b/commands/action.go index be56dda..b80bfb0 100644 --- a/commands/action.go +++ b/commands/action.go @@ -51,12 +51,12 @@ var actionCreateCmd = { Short: wski18n.T("create a new action"), SilenceUsage: true, SilenceErrors: true, -PreRunE: setupClientConfig, +PreRunE: SetupClientConfig, RunE: func(cmd *cobra.Command, args []string) error { var action *whisk.Action var err error -if whiskErr := checkArgs( +if whiskErr := CheckArgs( args, 1, 2, @@ -69,7 +69,7 @@ var actionCreateCmd = { return actionParseError(cmd, args, err) } -if _, _, err = client.Actions.Insert(action, false); err != nil { +if _, _, err = Client.Actions.Insert(action, false); err != nil { return actionInsertError(action, err) } @@ -84,12 +84,12 @@ var actionUpdateCmd = { Short: wski18n.T("update an existing action, or create an action if it does not exist"), SilenceUsage: true, SilenceErrors: true, -PreRunE: setupClientConfig, +PreRunE: SetupClientConfig, RunE: func(cmd *cobra.Command, args []string) error { var action *whisk.Action var err error -if whiskErr := checkArgs( +if whiskErr := CheckArgs( args, 1, 2, @@ -102,7 +102,7 @@ var actionUpdateCmd = { return actionParseError(cmd, args, err) } -if _, _, err = client.Actions.Insert(action, true); err != nil { +if _, _, err = Client.Actions.Insert(action, true); err != nil { return actionInsertError(action, err) } @@ -117,14 +117,14 @@ var actionInvokeCmd = { Short: wski18n.T("invoke action"), SilenceUsage: true, SilenceErrors: true, -PreRunE: setupClientConfig, +PreRunE: SetupClientConfig, RunE: func(cmd *cobra.Command, args []string) error { var err error var parameters interface{} var qualifiedName = new(QualifiedName) var paramArgs []string -if whiskErr := checkArgs( +if whiskErr := CheckArgs( args, 1, 1, @@ -137,7 +137,7 @@ var actionInvokeCmd = { return NewQualifiedNameError(args[0], err) } -client.Namespace = qualifiedName.GetNamespace() +Client.Namespace = qualifiedName.GetNamespace() paramArgs = Flags.common.param if len(paramArgs) > 0 { @@ -148,7 +148,7 @@ var actionInvokeCmd = { if Flags.action.result { Flags.common.blocking = true} -res, _, err := client.Actions.Invoke( +res, _, err := Client.Actions.Invoke( qualifiedName.GetEntityName(), parameters, Flags.common.blocking, @@ -200,14 +200,14 @@ var actionGetCmd = { Short: wski18n.T("get action"), SilenceUsage: true, SilenceErrors: true, -PreRunE: setupClientConfig, +PreRunE: SetupClientConfig, RunE: func(cmd *cobra.Command, args []string) error { var err error var field string var action *whisk.Action var qualifiedName = new(QualifiedName) -if whiskErr := checkArgs(args, 1, 2, "Action get", wski18n.T("An action name is required.")); whiskErr != nil { +if whiskErr := CheckArgs(args, 1, 2, "Action get", wski18n.T("An action name is required."));
[incubator-openwhisk-cli] 02/02: Update the client go verion to 4a63a306d52f5dd54454e0ba38e0c7eb9cb2852b
This is an automated email from the ASF dual-hosted git repository. dubeejw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git commit 63e6635d06735c86fb769147df4857491194af62 Author: Vincent HouAuthorDate: Mon Sep 25 14:35:22 2017 -0400 Update the client go verion to 4a63a306d52f5dd54454e0ba38e0c7eb9cb2852b --- Godeps/Godeps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 8510ec6..8348838 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -65,7 +65,7 @@ }, { "ImportPath": "github.com/apache/incubator-openwhisk-client-go/whisk", -"Rev": "c6e512b136e8c27bb144c0f8b625e833fbae878a" +"Rev": "4a63a306d52f5dd54454e0ba38e0c7eb9cb2852b" } ] } -- To stop receiving notification emails like this one, please contact "commits@openwhisk.apache.org" .
[incubator-openwhisk-cli] annotated tag latest updated (c14acd2 -> 48f4a9a)
This is an automated email from the ASF dual-hosted git repository. csantanapr pushed a change to annotated tag latest in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git. *** WARNING: tag latest was modified! *** from c14acd2 (tag) to 48f4a9a (tag) tagging 63e6635d06735c86fb769147df4857491194af62 (commit) replaces 1.0.0 by Travis CI on Mon Sep 25 21:14:37 2017 + - Log - Generated tag from Travis CI build 549 --- from 64e75af Revert "Sync openwhisk (#107)" (#108) add eca5dde Added changes for classes and variables casing to be get exported and can be used in other places (#2675) add 63e6635 Update the client go verion to 4a63a306d52f5dd54454e0ba38e0c7eb9cb2852b No new revisions were added by this update. Summary of changes: Godeps/Godeps.json | 2 +- commands/action.go | 64 +- commands/activation.go | 54 ++--- commands/api.go| 54 ++--- commands/commands.go | 6 ++-- commands/namespace.go | 18 +- commands/package.go| 84 ++-- commands/property.go | 51 ++- commands/qualified_name.go | 8 ++--- commands/rule.go | 86 +++--- commands/sdk.go| 6 ++-- commands/trigger.go| 72 +++--- commands/util.go | 4 +-- commands/wsk.go| 2 +- wski18n/i18n_resources.go | 20 +-- 15 files changed, 265 insertions(+), 266 deletions(-) -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org"'].
[incubator-openwhisk-cli] annotated tag latest updated (de24da0 -> c14acd2)
This is an automated email from the ASF dual-hosted git repository. csantanapr pushed a change to annotated tag latest in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git. *** WARNING: tag latest was modified! *** from de24da0 (tag) to c14acd2 (tag) tagging 64e75afe3bee9a29d09aefba7b7005cc1f2994e3 (commit) replaces 1.0.0 by Travis CI on Mon Sep 25 20:38:19 2017 + - Log - Generated tag from Travis CI build 546 --- from 078c74d Sync openwhisk (#107) add 64e75af Revert "Sync openwhisk (#107)" (#108) No new revisions were added by this update. Summary of changes: Godeps/Godeps.json | 2 +- commands/action.go | 64 +- commands/activation.go | 54 ++--- commands/api.go| 54 ++--- commands/commands.go | 6 ++-- commands/namespace.go | 18 +- commands/package.go| 84 ++-- commands/property.go | 51 +-- commands/qualified_name.go | 8 ++--- commands/rule.go | 86 +++--- commands/sdk.go| 6 ++-- commands/trigger.go| 72 +++--- commands/util.go | 4 +-- commands/wsk.go| 2 +- wski18n/i18n_resources.go | 20 +-- 15 files changed, 266 insertions(+), 265 deletions(-) -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org"'].
[incubator-openwhisk-wskdeploy] branch master updated: Fix an issue of deploymentreader and add a unit test (#542)
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 606f8b7 Fix an issue of deploymentreader and add a unit test (#542) 606f8b7 is described below commit 606f8b72030ded6f8d8692d3afa4412bdfcc2ac4 Author: Ying Chun GuoAuthorDate: Tue Sep 26 10:02:58 2017 +0800 Fix an issue of deploymentreader and add a unit test (#542) --- deployers/deploymentreader.go | 6 ++--- deployers/deploymentreader_test.go | 35 ++ tests/dat/deployment-deploymentreader-test.yml | 18 + 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/deployers/deploymentreader.go b/deployers/deploymentreader.go index 9a0e145..dc96a6c 100644 --- a/deployers/deploymentreader.go +++ b/deployers/deploymentreader.go @@ -110,7 +110,7 @@ func (reader *DeploymentReader) bindPackageInputsAndAnnotations() { serviceDeployPack.Package.Parameters = keyValArr } - keyValArr = keyValArr[:0] + keyValArr = make(whisk.KeyValueArr, 0) if len(pack.Annotations) > 0 { for name, input := range pack.Annotations { @@ -180,7 +180,7 @@ func (reader *DeploymentReader) bindActionInputsAndAnnotations() { } } - keyValArr = keyValArr[:0] + keyValArr = make(whisk.KeyValueArr, 0) if len(action.Annotations) > 0 { for name, input := range action.Annotations { @@ -249,7 +249,7 @@ func (reader *DeploymentReader) bindTriggerInputsAndAnnotations() { } } - keyValArr = keyValArr[:0] + keyValArr = make(whisk.KeyValueArr, 0) if len(trigger.Annotations) > 0 { for name, input := range trigger.Annotations { diff --git a/deployers/deploymentreader_test.go b/deployers/deploymentreader_test.go index 97fe936..c3e92aa 100644 --- a/deployers/deploymentreader_test.go +++ b/deployers/deploymentreader_test.go @@ -22,6 +22,7 @@ package deployers import ( "github.com/stretchr/testify/assert" "testing" + "github.com/apache/incubator-openwhisk-client-go/whisk" ) var sd *ServiceDeployer @@ -50,3 +51,37 @@ func TestDeployerCheck(t *testing.T) { // The system will exit thus the test will fail. // sd.Check() } + +func TestDeploymentReader_bindTrigger(t *testing.T) { + //init variables + sDeployer := NewServiceDeployer() + sDeployer.DeploymentPath = "../tests/dat/deployment-deploymentreader-test.yml" + sDeployer.Deployment.Triggers["locationUpdate"] = new(whisk.Trigger) + + //parse deployment and bind triggers input and annotation + dReader := NewDeploymentReader(sDeployer) + dReader.HandleYaml() + dReader.bindTriggerInputsAndAnnotations() + + trigger := sDeployer.Deployment.Triggers["locationUpdate"] + for _, param := range trigger.Parameters { + switch param.Key { + case "name": + assert.Equal(t, "Bernie", param.Value, "Failed to set inputs") + case "place": + assert.Equal(t, "DC", param.Value, "Failed to set inputs") + default: + assert.Fail(t, "Failed to get inputs key") + + } + } + for _, annos := range trigger.Annotations { + switch annos.Key { + case "bbb": + assert.Equal(t, "this is an annotation", annos.Value, "Failed to set annotations") + default: + assert.Fail(t, "Failed to get annotation key") + + } + } +} diff --git a/tests/dat/deployment-deploymentreader-test.yml b/tests/dat/deployment-deploymentreader-test.yml new file mode 100644 index 000..3fca66c --- /dev/null +++ b/tests/dat/deployment-deploymentreader-test.yml @@ -0,0 +1,18 @@ +application: + name: AppWithTriggerRule + packages: +triggerrule: + actions: +greeting: + inputs: +name: Amy +place: Paris + annotations: +aaa: this is an annotation + triggers: +locationUpdate: + inputs: +name: Bernie +place: DC + annotations: +bbb: this is an annotation -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org" '].
[incubator-openwhisk] branch master updated: revert change to enable collection of log files in local target environments (#2805)
This is an automated email from the ASF dual-hosted git repository. dragos pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git The following commit(s) were added to refs/heads/master by this push: new e85975f revert change to enable collection of log files in local target environments (#2805) e85975f is described below commit e85975f45f48d3c77411b4e6695fd49002e639f1 Author: Carlos SantanaAuthorDate: Mon Sep 25 20:51:46 2017 -0400 revert change to enable collection of log files in local target environments (#2805) --- ansible/logs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/logs.yml b/ansible/logs.yml index 86cc2c2..43dc52d 100644 --- a/ansible/logs.yml +++ b/ansible/logs.yml @@ -47,4 +47,4 @@ when: ansible_ssh_private_key_file is defined - name: fetch logs from all machines synchronize: src="{{ whisk_logs_dir }}/" dest="{{ openwhisk_home }}/logs" mode=pull -when: ('machine' not in exclude_logs_from) and (whisk_version_name != "local") \ No newline at end of file +when: "'machine' not in exclude_logs_from" -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org" '].
[incubator-openwhisk-website] branch master updated: fetch asf-site branch before creating commit (#246)
This is an automated email from the ASF dual-hosted git repository. dubeejw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-website.git The following commit(s) were added to refs/heads/master by this push: new 6e4866b fetch asf-site branch before creating commit (#246) 6e4866b is described below commit 6e4866be2105c75d1a089ebf6cc52bf7cb38bbf5 Author: Carlos SantanaAuthorDate: Mon Sep 25 10:41:22 2017 -0400 fetch asf-site branch before creating commit (#246) --- tools/jenkins/website_build.groovy | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/jenkins/website_build.groovy b/tools/jenkins/website_build.groovy index 11f0eeb..ab85428 100644 --- a/tools/jenkins/website_build.groovy +++ b/tools/jenkins/website_build.groovy @@ -35,9 +35,12 @@ node("git-websites") { git config -l --global git stash git status +git remote -v +git fetch origin git checkout asf-site +git log asf-site -3 git status -rm -rf /tmp/_site +rm -rf /tmp/_site mv _site /tmp/ rm -rf * git status -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org" '].
[incubator-openwhisk] branch master updated: Add test cases to ensure raw encoding of entity does not modify JSON format. (#2798)
This is an automated email from the ASF dual-hosted git repository. dubeejw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git The following commit(s) were added to refs/heads/master by this push: new bf4a411 Add test cases to ensure raw encoding of entity does not modify JSON format. (#2798) bf4a411 is described below commit bf4a41148c5c1073b398fd64c7df0dbbbee7f263 Author: rodric rabbahAuthorDate: Mon Sep 25 10:42:05 2017 -0400 Add test cases to ensure raw encoding of entity does not modify JSON format. (#2798) --- .../core/controller/test/WebActionsApiTests.scala | 45 -- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala b/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala index 3879c80..3a55d9b 100644 --- a/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala +++ b/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala @@ -66,7 +66,6 @@ import whisk.http.Messages * These tests exercise a fresh instance of the service object in memory -- these * tests do NOT communication with a whisk deployment. * - * * @Idioglossia * "using Specification DSL to write unit tests, as in should, must, not, be" * "using Specs2RouteTest DSL to chain HTTP requests for unit testing, as in ~>" @@ -688,8 +687,8 @@ trait WebActionsApiBaseTests extends ControllerTestCommon with BeforeAndAfterEac // ensure response is pretty printed responseAs[String] shouldBe { """{ - | "foobar": "foobar" - |}""".stripMargin +| "foobar": "foobar" +|}""".stripMargin } } } @@ -1563,26 +1562,30 @@ trait WebActionsApiBaseTests extends ControllerTestCommon with BeforeAndAfterEac it should s"invoke raw action ensuring body and query arguments are set properly (auth? ${creds.isDefined})" in { implicit val tid = transid() - val str = "1,2,3" - invocationsAllowed = 1 val queryString = "key1=value1=value2" - Post( -s"$testRoutePath/$systemId/proxy/raw_export_c.json?$queryString", -HttpEntity(ContentTypes.`application/json`, str)) ~> Route.seal(routes(creds)) ~> check { -status should be(OK) -val response = responseAs[JsObject] -response shouldBe JsObject( - "pkg" -> s"$systemId/proxy".toJson, - "action" -> "raw_export_c".toJson, - "content" -> metaPayload( -Post.method.name.toLowerCase, -Map(webApiDirectives.body -> Base64.getEncoder.encodeToString { - str.getBytes -}.toJson, webApiDirectives.query -> queryString.toJson).toJson.asJsObject, -creds, -pkgName = "proxy", -headers = List(`Content-Type`(ContentTypes.`application/json` + Seq( +"1,2,3", +JsObject("a" -> "A".toJson, "b" -> "B".toJson).prettyPrint, +JsObject("a" -> "A".toJson, "b" -> "B".toJson).compactPrint).foreach { str => +Post( + s"$testRoutePath/$systemId/proxy/raw_export_c.json?$queryString", + HttpEntity(ContentTypes.`application/json`, str)) ~> Route.seal(routes(creds)) ~> check { + status should be(OK) + invocationsAllowed += 1 + val response = responseAs[JsObject] + response shouldBe JsObject( +"pkg" -> s"$systemId/proxy".toJson, +"action" -> "raw_export_c".toJson, +"content" -> metaPayload( + Post.method.name.toLowerCase, + Map(webApiDirectives.body -> Base64.getEncoder.encodeToString { +str.getBytes + }.toJson, webApiDirectives.query -> queryString.toJson).toJson.asJsObject, + creds, + pkgName = "proxy", + headers = List(`Content-Type`(ContentTypes.`application/json` +} } } -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org" '].
[incubator-openwhisk-website] branch master updated: use git pull to sync branch asf-site before push (#247)
This is an automated email from the ASF dual-hosted git repository. dubeejw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-website.git The following commit(s) were added to refs/heads/master by this push: new 5921157 use git pull to sync branch asf-site before push (#247) 5921157 is described below commit 5921157a928c2f00a36270238645f98cff44a3db Author: Carlos SantanaAuthorDate: Mon Sep 25 12:39:12 2017 -0400 use git pull to sync branch asf-site before push (#247) --- tools/jenkins/website_build.groovy | 4 1 file changed, 4 insertions(+) diff --git a/tools/jenkins/website_build.groovy b/tools/jenkins/website_build.groovy index ab85428..c58beed 100644 --- a/tools/jenkins/website_build.groovy +++ b/tools/jenkins/website_build.groovy @@ -28,6 +28,7 @@ node("git-websites") { stage('Publish') { // Run git commands to push sh ''' +alias pwd ls echo "Pushing openwhisk site to asf" @@ -49,7 +50,10 @@ node("git-websites") { git diff git add . git status +git log asf-site -3 git commit -m "Automatic Site Publish by Jenkins" +git pull --rebase +git log asf-site -3 git push origin asf-site ''' } -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org" '].
[incubator-openwhisk-wskdeploy] branch master updated: Add strict flag for user defined runtime. (#541)
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 02c5ddd Add strict flag for user defined runtime. (#541) 02c5ddd is described below commit 02c5dddc1f70c4ce3c4ff7d026981cea3226eeba Author: David LiuAuthorDate: Tue Sep 26 02:06:27 2017 +0800 Add strict flag for user defined runtime. (#541) --- cmd/root.go| 1 + parsers/manifest_parser.go | 16 utils/flags.go | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 1aa0f83..1c44e76 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -109,6 +109,7 @@ func init() { RootCmd.Flags().StringVarP(, "pathpath", "p", ".", "path to serverless project") RootCmd.Flags().StringVarP(, "manifest", "m", "", "path to manifest file") RootCmd.Flags().StringVarP(, "deployment", "d", "", "path to deployment file") + RootCmd.PersistentFlags().BoolVarP(,"strict", "s", false, "allow user defined runtime version") RootCmd.PersistentFlags().BoolVarP(, "allow-interactive", "i", false, "allow interactive prompts") RootCmd.PersistentFlags().BoolVarP(, "allow-defaults", "a", false, "allow defaults") RootCmd.PersistentFlags().BoolVarP(, "verbose", "v", false, "verbose output") diff --git a/parsers/manifest_parser.go b/parsers/manifest_parser.go index ef0b014..ef79293 100644 --- a/parsers/manifest_parser.go +++ b/parsers/manifest_parser.go @@ -414,14 +414,14 @@ func (dm *YAMLParser) ComposeActions(filePath string, actions map[string]Action, if action.Runtime != "" { if utils.CheckExistRuntime(action.Runtime, utils.Rts) { wskaction.Exec.Kind = action.Runtime - } else { - errStr := wski18n.T("the runtime is not supported by Openwhisk platform.\n") - whisk.Debug(whisk.DbgWarn, errStr) - } - } else { - errStr := wski18n.T("wskdeploy has chosen a particular runtime for the action.\n") - whisk.Debug(whisk.DbgWarn, errStr) - } + + } else if utils.Flags.Strict { +wskaction.Exec.Kind = action.Runtime +} else { +errStr := wski18n.T("wskdeploy has chosen a particular runtime for the action.\n") + whisk.Debug(whisk.DbgWarn, errStr) +} +} // we can specify the name of the action entry point using main if action.Main != "" { diff --git a/utils/flags.go b/utils/flags.go index 451ddab..59ffce0 100644 --- a/utils/flags.go +++ b/utils/flags.go @@ -32,6 +32,7 @@ var Flags struct { ManifestPathstring UseDefaults bool UseInteractive bool + Strict bool // strict flag to support user defined runtime version. //action flag definition //from go cli -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org" '].
[incubator-openwhisk-client-go] branch master updated: Added changes for classes and variables casing to be get exported and can be used in other places (#2675) (#38)
This is an automated email from the ASF dual-hosted git repository. dubeejw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-go.git The following commit(s) were added to refs/heads/master by this push: new 4a63a30 Added changes for classes and variables casing to be get exported and can be used in other places (#2675) (#38) 4a63a30 is described below commit 4a63a306d52f5dd54454e0ba38e0c7eb9cb2852b Author: VincentAuthorDate: Mon Sep 25 14:12:46 2017 -0400 Added changes for classes and variables casing to be get exported and can be used in other places (#2675) (#38) * Updating classes and variables so that they are exported and usable by other modules * Updating missed debug statements to have case of client -> Client --- whisk/client.go | 161 +--- 1 file changed, 106 insertions(+), 55 deletions(-) diff --git a/whisk/client.go b/whisk/client.go index 3d6b655..aea23ec 100644 --- a/whisk/client.go +++ b/whisk/client.go @@ -32,6 +32,7 @@ import ( "github.com/apache/incubator-openwhisk-client-go/wski18n" "strings" "time" +"regexp" ) const ( @@ -80,6 +81,18 @@ type Config struct { UserAgent string } +type ObfuscateSet struct { +Regex string +Replacement string +} + +var DefaultObfuscateArr = []ObfuscateSet{ +{ +Regex: "\"[Pp]assword\":\\s*\".*\"", +Replacement: `"password": "**"`, +}, +} + func NewClient(httpClient *http.Client, config_input *Config) (*Client, error) { var config *Config @@ -253,7 +266,7 @@ func (c *Client) addAuthHeader(req *http.Request, authRequired bool) error { // bodyTruncator limits the size of Req/Resp Body for --verbose ONLY. // It returns truncated Req/Resp Body, reloaded io.ReadCloser and any errors. -func bodyTruncator(body io.ReadCloser) (string, io.ReadCloser, error) { +func BodyTruncator(body io.ReadCloser) (string, io.ReadCloser, error) { limit := 1000// 1000 byte limit, anything over is truncated data, err := ioutil.ReadAll(body) @@ -279,31 +292,15 @@ func bodyTruncator(body io.ReadCloser) (string, io.ReadCloser, error) { // error if an API error has occurred. If v implements the io.Writer // interface, the raw response body will be written to v, without attempting to // first decode it. -func (c *Client) Do(req *http.Request, v interface{}, ExitWithErrorOnTimeout bool) (*http.Response, error) { +func (c *Client) Do(req *http.Request, v interface{}, ExitWithErrorOnTimeout bool, secretToObfuscate ...ObfuscateSet) (*http.Response, error) { var err error -var truncatedBody string - -if IsVerbose() { -fmt.Println("REQUEST:") -fmt.Printf("[%s]\t%s\n", req.Method, req.URL) - -if len(req.Header) > 0 { -fmt.Println("Req Headers") -PrintJSON(req.Header) -} +var data []byte +secrets := append(DefaultObfuscateArr, secretToObfuscate...) -if req.Body != nil { -fmt.Println("Req Body") -if !IsDebug() { -if truncatedBody, req.Body, err = bodyTruncator(req.Body); err != nil { -return nil, err -} -fmt.Println(truncatedBody) -} else { -fmt.Println(req.Body) -} -Debug(DbgInfo, "Req Body (ASCII quoted string):\n%+q\n", req.Body) -} +req, err = PrintRequestInfo(req, secrets...) +//Putting this based on previous code +if err != nil { +return nil, err } // Issue the request to the Whisk server endpoint @@ -314,38 +311,9 @@ func (c *Client) Do(req *http.Request, v interface{}, ExitWithErrorOnTimeout boo return nil, werr } -// Don't "defer resp.Body.Close()" here because the body is reloaded to allow caller to -// do custom body parsing, such as handling per-route error responses. -Verbose("RESPONSE:") -Verbose("Got response with code %d\n", resp.StatusCode) - -if (IsVerbose() && len(resp.Header) > 0) { -fmt.Println("Resp Headers") -PrintJSON(resp.Header) -} - -// Read the response body -data, err := ioutil.ReadAll(resp.Body) +resp, data, err = PrintResponseInfo(resp, secrets...) if err != nil { -Debug(DbgError, "ioutil.ReadAll(resp.Body) error: %s\n", err) -werr := MakeWskError(err, EXIT_CODE_ERR_NETWORK, DISPLAY_MSG, NO_DISPLAY_USAGE) -return resp, werr -} - -// Reload the response body to allow caller access to the body; otherwise, -// the caller will have any empty body to read -resp.Body = ioutil.NopCloser(bytes.NewBuffer(data)) - -Verbose("Response body size is %d bytes\n", len(data)) - -if !IsDebug() { -if truncatedBody, resp.Body, err = bodyTruncator(resp.Body); err != nil { -return nil, err -
[incubator-openwhisk] branch master updated: ContainerFactory SPI (#2659)
This is an automated email from the ASF dual-hosted git repository. markusthoemmes pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git The following commit(s) were added to refs/heads/master by this push: new be43ad9 ContainerFactory SPI (#2659) be43ad9 is described below commit be43ad90e0dce26c7fa76573605324be22817b30 Author: tysonnorrisAuthorDate: Mon Sep 25 09:50:04 2017 -0700 ContainerFactory SPI (#2659) --- common/scala/src/main/resources/reference.conf | 1 + .../scala/whisk/core/containerpool/Container.scala | 199 + .../core/containerpool/ContainerFactory.scala | 59 ++ .../whisk/core/containerpool}/HttpUtils.scala | 4 +- .../scala/whisk/core/containerpool/Container.scala | 83 - .../whisk/core/containerpool/ContainerProxy.scala | 2 +- .../core/containerpool/docker/DockerClient.scala | 17 +- .../docker/DockerClientWithFileAccess.scala| 10 +- .../containerpool/docker/DockerContainer.scala | 163 +++-- .../docker/DockerContainerFactory.scala| 101 +++ .../core/containerpool/docker/RuncClient.scala | 1 + .../scala/whisk/core/invoker/InvokerReactive.scala | 72 ++-- .../scala/actionContainers/ActionContainer.scala | 2 +- .../docker/test/ContainerConnectionTests.scala | 4 +- .../docker/test/DockerClientTests.scala| 8 +- .../test/DockerClientWithFileAccessTests.scala | 14 +- .../docker/test/DockerContainerTests.scala | 52 -- .../docker/test/RuncClientTests.scala | 2 +- .../containerpool/test/ContainerProxyTests.scala | 22 ++- 19 files changed, 481 insertions(+), 335 deletions(-) diff --git a/common/scala/src/main/resources/reference.conf b/common/scala/src/main/resources/reference.conf index 52f30c3..50a36a5 100644 --- a/common/scala/src/main/resources/reference.conf +++ b/common/scala/src/main/resources/reference.conf @@ -1,4 +1,5 @@ whisk.spi{ ArtifactStoreProvider = whisk.core.database.CouchDbStoreProvider MessagingProvider = whisk.connector.kafka.KafkaMessagingProvider + ContainerFactoryProvider = whisk.core.containerpool.docker.DockerContainerFactoryProvider } \ No newline at end of file diff --git a/common/scala/src/main/scala/whisk/core/containerpool/Container.scala b/common/scala/src/main/scala/whisk/core/containerpool/Container.scala new file mode 100644 index 000..0cecbe6 --- /dev/null +++ b/common/scala/src/main/scala/whisk/core/containerpool/Container.scala @@ -0,0 +1,199 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package whisk.core.containerpool + +import java.time.Instant +import scala.concurrent.ExecutionContext +import scala.concurrent.Future +import scala.concurrent.duration.Duration +import scala.concurrent.duration.FiniteDuration +import scala.concurrent.duration._ +import scala.util.Failure +import scala.util.Success +import spray.json.JsObject +import spray.json.DefaultJsonProtocol._ +import whisk.common.Logging +import whisk.common.LoggingMarkers +import whisk.common.TransactionId +import whisk.core.entity.ActivationResponse +import whisk.core.entity.ActivationResponse.ContainerConnectionError +import whisk.core.entity.ActivationResponse.ContainerResponse +import whisk.core.entity.ByteSize +import whisk.core.entity.size._ +import whisk.http.Messages + +/** + * An OpenWhisk biased container abstraction. This is **not only** an abstraction + * for different container providers, but the implementation also needs to include + * OpenWhisk specific behavior, especially for initialize and run. + */ +case class ContainerId(val asString: String) { + require(asString.nonEmpty, "ContainerId must not be empty") +} +case class ContainerAddress(val host: String, val port: Int = 8080) { + require(host.nonEmpty, "ContainerIp must not be empty") +} + +trait Container { + + protected val id: ContainerId + protected val addr: ContainerAddress + protected implicit val logging: Logging + protected implicit val ec: ExecutionContext + + /** HTTP connection to the container, will be lazily established by callContainer */ + private var
[incubator-openwhisk-cli] annotated tag latest updated (f87b8cf -> de24da0)
This is an automated email from the ASF dual-hosted git repository. csantanapr pushed a change to annotated tag latest in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git. *** WARNING: tag latest was modified! *** from f87b8cf (tag) to de24da0 (tag) tagging 078c74d137104b7157d8d19b1dc437c8c1358c00 (commit) replaces 1.0.0 by Travis CI on Mon Sep 25 19:50:56 2017 + - Log - Generated tag from Travis CI build 543 --- from caf748d Remove heisenbug from test by checking either order for stdout/stderr lines. (#2761) (#105) add 0792cc8 Don't assume apihost is https for sdk and action urls (#2748) add 8282760 Updating the way we print names in the Cli Fixes #1155 (#2462) add 300a2bb Display content-type in __ow_headers for web actions (#2741) add db5d092 Echo Access-Control-Request-Headers as Access-Control-Allow-Headers instead of hardcoding value for header. (#2771) add 95e67fc Don't assume apihost is https for sdk and action urls (#2748) add f85b26a update apigw end-to-end to be more resilient (#2724) add d6ec004 Updating the way we print names in the Cli Fixes #1155 (#2462) add 078c74d Sync openwhisk (#107) No new revisions were added by this update. Summary of changes: Godeps/Godeps.json | 2 +- commands/action.go | 74 ++- commands/activation.go | 58 +++ commands/api.go| 83 ++--- commands/commands.go | 10 +-- commands/namespace.go | 18 ++--- commands/package.go| 86 +++--- commands/property.go | 59 --- commands/qualified_name.go | 8 +- commands/rule.go | 86 +++--- commands/sdk.go| 20 ++--- commands/trigger.go| 72 +- commands/util.go | 30 +--- commands/wsk.go| 2 +- .../apigw/healthtests/ApiGwEndToEndTests.scala | 6 ++ .../src/test/scala/system/basic/WskSdkTests.scala | 21 +- .../whisk/core/cli/test/WskBasicUsageTests.scala | 42 +-- .../whisk/core/cli/test/WskWebActionsTests.scala | 56 +- wski18n/i18n_resources.go | 22 +++--- wski18n/resources/en_US.all.json | 40 +- 20 files changed, 438 insertions(+), 357 deletions(-) -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org"'].
[incubator-openwhisk-cli] branch master updated: Revert "Sync openwhisk (#107)" (#108)
This is an automated email from the ASF dual-hosted git repository. dubeejw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git The following commit(s) were added to refs/heads/master by this push: new 64e75af Revert "Sync openwhisk (#107)" (#108) 64e75af is described below commit 64e75afe3bee9a29d09aefba7b7005cc1f2994e3 Author: VincentAuthorDate: Mon Sep 25 16:10:33 2017 -0400 Revert "Sync openwhisk (#107)" (#108) This reverts commit 078c74d137104b7157d8d19b1dc437c8c1358c00. --- Godeps/Godeps.json | 2 +- commands/action.go | 64 +- commands/activation.go | 54 ++--- commands/api.go| 54 ++--- commands/commands.go | 6 ++-- commands/namespace.go | 18 +- commands/package.go| 84 ++-- commands/property.go | 51 +-- commands/qualified_name.go | 8 ++--- commands/rule.go | 86 +++--- commands/sdk.go| 6 ++-- commands/trigger.go| 72 +++--- commands/util.go | 4 +-- commands/wsk.go| 2 +- wski18n/i18n_resources.go | 20 +-- 15 files changed, 266 insertions(+), 265 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 8348838..8510ec6 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -65,7 +65,7 @@ }, { "ImportPath": "github.com/apache/incubator-openwhisk-client-go/whisk", -"Rev": "4a63a306d52f5dd54454e0ba38e0c7eb9cb2852b" +"Rev": "c6e512b136e8c27bb144c0f8b625e833fbae878a" } ] } diff --git a/commands/action.go b/commands/action.go index b80bfb0..be56dda 100644 --- a/commands/action.go +++ b/commands/action.go @@ -51,12 +51,12 @@ var actionCreateCmd = { Short: wski18n.T("create a new action"), SilenceUsage: true, SilenceErrors: true, -PreRunE: SetupClientConfig, +PreRunE: setupClientConfig, RunE: func(cmd *cobra.Command, args []string) error { var action *whisk.Action var err error -if whiskErr := CheckArgs( +if whiskErr := checkArgs( args, 1, 2, @@ -69,7 +69,7 @@ var actionCreateCmd = { return actionParseError(cmd, args, err) } -if _, _, err = Client.Actions.Insert(action, false); err != nil { +if _, _, err = client.Actions.Insert(action, false); err != nil { return actionInsertError(action, err) } @@ -84,12 +84,12 @@ var actionUpdateCmd = { Short: wski18n.T("update an existing action, or create an action if it does not exist"), SilenceUsage: true, SilenceErrors: true, -PreRunE: SetupClientConfig, +PreRunE: setupClientConfig, RunE: func(cmd *cobra.Command, args []string) error { var action *whisk.Action var err error -if whiskErr := CheckArgs( +if whiskErr := checkArgs( args, 1, 2, @@ -102,7 +102,7 @@ var actionUpdateCmd = { return actionParseError(cmd, args, err) } -if _, _, err = Client.Actions.Insert(action, true); err != nil { +if _, _, err = client.Actions.Insert(action, true); err != nil { return actionInsertError(action, err) } @@ -117,14 +117,14 @@ var actionInvokeCmd = { Short: wski18n.T("invoke action"), SilenceUsage: true, SilenceErrors: true, -PreRunE: SetupClientConfig, +PreRunE: setupClientConfig, RunE: func(cmd *cobra.Command, args []string) error { var err error var parameters interface{} var qualifiedName = new(QualifiedName) var paramArgs []string -if whiskErr := CheckArgs( +if whiskErr := checkArgs( args, 1, 1, @@ -137,7 +137,7 @@ var actionInvokeCmd = { return NewQualifiedNameError(args[0], err) } -Client.Namespace = qualifiedName.GetNamespace() +client.Namespace = qualifiedName.GetNamespace() paramArgs = Flags.common.param if len(paramArgs) > 0 { @@ -148,7 +148,7 @@ var actionInvokeCmd = { if Flags.action.result { Flags.common.blocking = true} -res, _, err := Client.Actions.Invoke( +res, _, err := client.Actions.Invoke( qualifiedName.GetEntityName(), parameters, Flags.common.blocking, @@ -200,14 +200,14 @@ var actionGetCmd = { Short: wski18n.T("get action"), SilenceUsage: true, SilenceErrors: true, -PreRunE: SetupClientConfig, +PreRunE:
[incubator-openwhisk-website] branch asf-site updated: Automatic Site Publish by Jenkins
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-website.git The following commit(s) were added to refs/heads/asf-site by this push: new 03f3eb6 Automatic Site Publish by Jenkins 03f3eb6 is described below commit 03f3eb63c3528cf1591564b2d9e071ee433ef301 Author: jenkinsAuthorDate: Mon Sep 25 20:18:34 2017 + Automatic Site Publish by Jenkins --- about.html| 30 --- contact.html | 28 +++-- contributors.html | 32 + developers.html | 30 --- events.html | 57 +++ faq.html | 28 +++-- feed.xml | 2 +- index.html| 32 + integrations.html | 28 +++-- media.html| 28 +++-- package-creators.html | 32 + package.json | 11 +- serverless.html | 28 +++-- slack.html| 28 +++-- social.html | 28 +++-- supporters.html | 28 +++-- 16 files changed, 209 insertions(+), 241 deletions(-) diff --git a/about.html b/about.html index 4027798..df2690a 100644 --- a/about.html +++ b/about.html @@ -71,7 +71,7 @@ class="site-nav__item site-nav__item--dropdown-item">Serverless FAQ - https://github.com/openwhisk/openwhisk/tree/master/docs; + https://github.com/apache/incubator-openwhisk/tree/master/docs#readme; class="site-nav__item site-nav__item--dropdown-item">Documentation @@ -119,20 +119,16 @@ - https://github.com/openwhisk/openwhisk-external-resources; + https://github.com/apache/incubator-openwhisk-external-resources; class="site-nav__item site-nav__item--dropdown-link site-nav__item--hide-on-small">Resources - https://github.com/openwhisk/openwhisk-external-resources#feed-providers; + https://github.com/apache/incubator-openwhisk-external-resources#feed-providers; class="site-nav__item site-nav__item--dropdown-item">Integrations - https://github.com/openwhisk/openwhisk-external-resources#applications; + https://github.com/apache/incubator-openwhisk-external-resources#applications; class="site-nav__item site-nav__item--dropdown-item">Demos Examples - - https://github.com/openwhisk/openwhisk-external-resources#articles; + https://github.com/apache/incubator-openwhisk-external-resources#articles; class="site-nav__item site-nav__item--dropdown-item">Articles - https://github.com/openwhisk/openwhisk-external-resources#workshops; + https://github.com/apache/incubator-openwhisk-/opennal-resources#workshops; class="site-nav__item site-nav__item--dropdown-item">Tutorials @@ -141,12 +137,12 @@ - https://github.com/openwhisk/; - title="Apache OpenWhisk on GitHub" + https://github.com/apache?q=openwhisk; + title="Apache OpenWhisk project repositories on GitHub" class="site-nav__item"> + alt="Apache OpenWhisk project repositories on GitHub"> https://www.youtube.com/channel/UCbzgShnQk8F43NKsvEYA1SA; title="Apache OpenWhisk on YouTube" @@ -281,7 +277,7 @@ source cloud platform that allows you to execute code in response to events at a Apache OpenWhisk is an effort undergoing incubation at The Apache - Software Foundation (ASF), sponsored by the Incubator. + Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other @@ -317,12 +313,12 @@ source cloud platform that allows you to execute code in response to events at a FAQ - https://github.com/openwhisk/openwhisk; - title="Apache OpenWhisk on GitHub" + https://github.com/apache?q=openwhisk; + title="Apache OpenWhisk project repositories on GitHub" class="site-nav__item site-nav__item--margin-left-auto"> + alt="Apache OpenWhisk project repositories on GitHub"> https://www.youtube.com/channel/UCbzgShnQk8F43NKsvEYA1SA; title="Apache OpenWhisk on YouTube" diff --git a/contact.html b/contact.html index 80a57c0..6340e0a
[incubator-openwhisk-wskdeploy] branch master updated: Update the document for the use case of message hub (#545)
This is an automated email from the ASF dual-hosted git repository. daisyguo 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 2580015 Update the document for the use case of message hub (#545) 2580015 is described below commit 258001556d6174147d69efccc2ae9f13dd90d03a Author: VincentAuthorDate: Mon Sep 25 02:53:38 2017 -0400 Update the document for the use case of message hub (#545) Closes #539 --- tests/src/integration/cloudant/cloudant_test.go | 2 +- tests/src/integration/message-hub/README.md | 15 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/src/integration/cloudant/cloudant_test.go b/tests/src/integration/cloudant/cloudant_test.go index c915add..a9e0452 100644 --- a/tests/src/integration/cloudant/cloudant_test.go +++ b/tests/src/integration/cloudant/cloudant_test.go @@ -30,7 +30,7 @@ import ( func TestCloudant(t *testing.T) { os.Setenv("CLOUDANT_DATABASE", "testdb") wskprops := common.GetWskpropsFromEnvVars(common.BLUEMIX_APIHOST, common.BLUEMIX_NAMESPACE, common.BLUEMIX_AUTH) - err := common.ValidateWskprops(wskprops) +err := common.ValidateWskprops(wskprops) if err != nil { fmt.Println(err.Error()) fmt.Println("Wsk properties are not properly configured, so tests are skipped.") diff --git a/tests/src/integration/message-hub/README.md b/tests/src/integration/message-hub/README.md new file mode 100644 index 000..b497d47 --- /dev/null +++ b/tests/src/integration/message-hub/README.md @@ -0,0 +1,15 @@ +# Test Case of message hub + +This is a test case for message hub. Before running this use case, please make sure you have set the following +environment variables on your machine: MESSAGEHUB_ADMIN_HOST, KAFKA_BROKERS_SASL, SOURCE_TOPIC and DESTINATION_TOPIC. + +The environment variables, SOURCE_TOPIC and DESTINATION_TOPIC, are two topic names in message hub service. Both of them +must be available in the message hub service you are about to use. The variable MESSAGEHUB_ADMIN_HOST specifies the url +link of the admin host for the message hub. The variable KAFKA_BROKERS_SASL specifies the array of the kafka brokers, e.g. +[kafka01-prod01.messagehub.services.net:9093 kafka02-prod01.messagehub.services.net:9093]. + +It can be deployed and tested with: + +```bash +$ wskdeploy -p tests/src/integration/message-hub +``` -- To stop receiving notification emails like this one, please contact ['"commits@openwhisk.apache.org" '].