You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2017/07/01 01:41:08 UTC

[incubator-openwhisk] branch master updated: make swift:3.1.1 default for swift (#2432)

This is an automated email from the ASF dual-hosted git repository.

rabbah 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 b175bbf  make swift:3.1.1 default for swift (#2432)
b175bbf is described below

commit b175bbf5af27bc8970364af20d04ced4fc5b927c
Author: Carlos Santana <cs...@gmail.com>
AuthorDate: Fri Jun 30 21:41:05 2017 -0400

    make swift:3.1.1 default for swift (#2432)
---
 ansible/group_vars/all                             |  2 +-
 docs/actions.md                                    |  7 ++-
 docs/reference.md                                  |  6 +-
 .../system/basic/WskBasicSwift3DefaultTest.scala   | 70 ----------------------
 .../scala/whisk/core/entity/test/ExecHelpers.scala |  3 +-
 5 files changed, 12 insertions(+), 76 deletions(-)

diff --git a/ansible/group_vars/all b/ansible/group_vars/all
index da24b84..621d48a 100644
--- a/ansible/group_vars/all
+++ b/ansible/group_vars/all
@@ -64,11 +64,11 @@ runtimesManifest:
         name: "swiftaction"
       deprecated: true
     - kind: "swift:3"
-      default: true
       image:
         name: "swift3action"
       deprecated: false
     - kind: "swift:3.1.1"
+      default: true
       image:
         name: "action-swift-v3.1.1"
       deprecated: false
diff --git a/docs/actions.md b/docs/actions.md
index 5f623d9..7dcae8d 100644
--- a/docs/actions.md
+++ b/docs/actions.md
@@ -610,9 +610,10 @@ follows:
 wsk action create helloSwift hello.swift
 ```
 
-When you use the command line and a `.swift` source file, you do not need to
-specify that you are creating a Swift action (as opposed to a JavaScript action);
-the tool determines that from the file extension.
+The CLI automatically infers the type of the action from the source file extension. For `.swift` source files, the action runs using a Swift 3.1.1 runtime. You can also create an action that runs with Swift 3.0 by explicitly specifying the parameter `--kind swift:3`. See the Swift [reference](./reference.md#swift-actions) for more information about Swift 3.0 vs. 3.1. 
+
+**Note:** The actions you created using the kind `swift:3` will continue to work for a short period, however you should begin migrating your deployment scripts and recompiling your swift actions using the new kind `swift:3.1.1`. Support for Swift 3.0 is deprecated and will be removed soon.
+
 
 Action invocation is the same for Swift actions as it is for JavaScript actions:
 
diff --git a/docs/reference.md b/docs/reference.md
index c6d826e..ee81cc7 100644
--- a/docs/reference.md
+++ b/docs/reference.md
@@ -357,7 +357,11 @@ Python 2 actions are executed using Python 2.7.12. This is the default runtime f
 ## Swift actions
 
 ### Swift 3
-Swift 3 actions are executed using Swift 3.0.2  `--kind swift:3` or Swift 3.1.1 `--kind swift:3.1.1`, respectively.  The default `--kind swift:default` is Swift 3.0.2.
+Swift 3 actions are executed using Swift 3.1.1  `--kind swift:3.1.1` or Swift 3.0.2 `--kind swift:3`, respectively.  
+The default `--kind swift:default` is Swift 3.1.1.
+
+**Note:** The actions you created using the kind `swift:3` will continue to work for a short period, however you should begin migrating your deployment scripts and recompiling your swift actions using the new kind `swift:3.1.1`.
+
 
 Swift 3.0.2 actions can use the following packages:
 - KituraNet version 1.0.1, https://github.com/IBM-Swift/Kitura-net
diff --git a/tests/src/test/scala/system/basic/WskBasicSwift3DefaultTest.scala b/tests/src/test/scala/system/basic/WskBasicSwift3DefaultTest.scala
deleted file mode 100644
index 71de8c2..0000000
--- a/tests/src/test/scala/system/basic/WskBasicSwift3DefaultTest.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 system.basic
-
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-
-import common.JsHelpers
-import common.TestHelpers
-import common.TestUtils
-import common.Wsk
-import common.WskProps
-import common.WskTestHelpers
-import spray.json.DefaultJsonProtocol.StringJsonFormat
-import spray.json.pimpAny
-import spray.json.pimpString
-import common.TestUtils.RunResult
-import spray.json.JsObject
-
-@RunWith(classOf[JUnitRunner])
-class WskBasicSwift3DefaultTests
-    extends TestHelpers
-    with WskTestHelpers
-    with JsHelpers {
-
-    implicit val wskprops = WskProps()
-    val wsk = new Wsk
-    val defaultAction = Some(TestUtils.getTestActionFilename("hello.swift"))
-    lazy val currentSwiftDefaultKind = "swift:3"
-
-    behavior of "Swift runtime"
-
-    it should "Map a kind of swift:default to the current default swift runtime" in withAssetCleaner(wskprops) {
-        (wp, assetHelper) =>
-            val name = "usingDefaultSwiftAlias"
-
-            assetHelper.withCleaner(wsk.action, name) {
-                (action, _) =>
-                    action.create(name, defaultAction, kind = Some("swift:default"))
-            }
-
-            val result = wsk.action.get(name)
-            withPrintOnFailure(result) {
-                () =>
-                    val action = convertRunResultToJsObject(result)
-                    action.getFieldPath("exec", "kind") should be(Some(currentSwiftDefaultKind.toJson))
-            }
-    }
-
-    def convertRunResultToJsObject(result: RunResult): JsObject = {
-        val stdout = result.stdout
-        val firstNewline = stdout.indexOf("\n")
-        stdout.substring(firstNewline + 1).parseJson.asJsObject
-    }
-}
diff --git a/tests/src/test/scala/whisk/core/entity/test/ExecHelpers.scala b/tests/src/test/scala/whisk/core/entity/test/ExecHelpers.scala
index eb89e47..01f2c4c 100644
--- a/tests/src/test/scala/whisk/core/entity/test/ExecHelpers.scala
+++ b/tests/src/test/scala/whisk/core/entity/test/ExecHelpers.scala
@@ -60,7 +60,8 @@ trait ExecHelpers
     }
 
     protected def swift3(code: String, main: Option[String] = None) = {
-        CodeExecAsString(RuntimeManifest(SWIFT3, imagename(SWIFT3), default = Some(true), deprecated = Some(false)), trim(code), main.map(_.trim))
+        val default = ExecManifest.runtimesManifest.resolveDefaultRuntime(SWIFT3).flatMap(_.default)
+        CodeExecAsString(RuntimeManifest(SWIFT3, imagename(SWIFT3), default = default, deprecated = Some(false)), trim(code), main.map(_.trim))
     }
 
     protected def sequence(components: Vector[FullyQualifiedEntityName]) = SequenceExec(components)

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].