Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Action Versioning #4986

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1189caf
Implement action versioning
jiangpengcheng Sep 15, 2020
8409b85
Fix tests
jiangpengcheng Sep 28, 2020
7d72c53
Make SemVer sortable
jiangpengcheng Sep 29, 2020
595df67
Updates:
jiangpengcheng Oct 9, 2020
1b2088b
Allow to replace specify version
jiangpengcheng Oct 10, 2020
171b9dc
Fix bug
jiangpengcheng Oct 10, 2020
e69240a
Implement action-version view for memoryDB and cosmosDB
jiangpengcheng Oct 12, 2020
9f5c1d8
Fix view bug
jiangpengcheng Oct 13, 2020
5d041c4
Fix DocumentHandlerTests
jiangpengcheng Oct 13, 2020
a880b97
Ensure data consistency
jiangpengcheng Oct 29, 2020
d1b2c54
Add deleteAll parameter for action#remove
jiangpengcheng Oct 29, 2020
2b1c4e8
Add deleteOld parameter for action#create
jiangpengcheng Oct 29, 2020
e030b4b
Revert "Allow to replace specify version"
jiangpengcheng Nov 3, 2020
4d0e220
add default version feature
jiangpengcheng Nov 3, 2020
af0d7c2
Some updates:
jiangpengcheng Nov 11, 2020
5e4bc9f
Fix format style
jiangpengcheng Nov 11, 2020
4dc8147
Fix test
jiangpengcheng Nov 13, 2020
ef1711c
Remove some useless code
jiangpengcheng Nov 16, 2020
5278fdc
Fix bug
jiangpengcheng Nov 16, 2020
f2b348a
Fix rebase error
jiangpengcheng May 8, 2021
becdb02
Fix tests error
jiangpengcheng May 8, 2021
6fe1d7f
Fix tests
jiangpengcheng May 8, 2021
a3939ed
Use version mappings to get doc id from an version
jiangpengcheng May 10, 2021
fc564c9
Update some return errors
jiangpengcheng May 12, 2021
9fad6e3
Rebase master
jiangpengcheng May 12, 2021
0205d2e
Fix rebase errors
jiangpengcheng Jun 3, 2021
54cb3de
Merge branch 'master' into feature/implement_code_versioning
bdoyle0182 Feb 15, 2023
6a41968
Update Actions.scala
bdoyle0182 Feb 15, 2023
482c05e
fix compilation w/ new scheduler code
Feb 15, 2023
cc56908
fix versioned action read on fpcs invoker
Feb 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test
  • Loading branch information
jiangpengcheng committed Jun 3, 2021
commit 4dc81470f814e71cf1838cfe1356329187018987
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ abstract class SimpleHandler extends DocumentHandler {
provider: DocumentProvider)(implicit transid: TransactionId, ec: ExecutionContext): Future[Seq[JsObject]] = {
//Query result from CouchDB have below object structure with actual result in `value` key
//So transform the result to confirm to that structure
val viewResult = JsObject(
"id" -> js.fields("_id"),
"key" -> createKey(ddoc, view, startKey, js),
"value" -> computeView(ddoc, view, js))
val value = computeView(ddoc, view, js)
val viewResult = JsObject("id" -> js.fields("_id"), "key" -> createKey(ddoc, view, startKey, js), "value" -> value)

val result = if (includeDocs) JsObject(viewResult.fields + ("doc" -> js)) else viewResult
Future.successful(Seq(result))
if (includeDocs) value.fields.get("_id") match {
case Some(JsString(id)) if id != js.fields("_id") =>
provider.get(DocId(id)).map { doc =>
Seq(JsObject(viewResult.fields + ("doc" -> doc.getOrElse(js))))
}
case _ =>
Future.successful(Seq(JsObject(viewResult.fields + ("doc" -> js))))
} else Future.successful(Seq(viewResult))
}

/**
Expand Down Expand Up @@ -207,7 +211,7 @@ object WhisksHandler extends SimpleHandler {
val FULL_NAME = "fullname"
private val commonFields = Set("namespace", "name", "version", "publish", "annotations", "updated")
private val actionFields = commonFields ++ Set("limits", "exec.binary")
private val actionVersionFields = commonFields ++ Set("_id")
private val actionVersionFields = commonFields ++ Set("_id", "id")
private val packageFields = commonFields ++ Set("binding")
private val packagePublicFields = commonFields
private val ruleFields = commonFields
Expand Down Expand Up @@ -302,12 +306,9 @@ object WhisksHandler extends SimpleHandler {
}

private def computeActionVersionsView(js: JsObject): JsObject = {
val publish = annotationValue(js, "publish", { v =>
v.convertTo[Boolean]
}, true)

val base = js.fields.filterKeys(actionVersionFields).toMap
JsObject(base + ("publish" -> publish.toJson))
val defaultId = js.fields("namespace") + "/" + js.fields("name") + "/default"
JsObject(base + ("_id" -> JsString(defaultId), "id" -> js.fields("_id")))
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/src/test/scala/system/basic/WskActionTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class WskActionTests extends TestHelpers with WskTestHelpers with JsHelpers with
}

// set the default version
wsk.action.create(name, None, defaultVersion = Some("0.0.2"))
wsk.action.create(name, Some(TestUtils.getTestActionFilename("hello.js")), defaultVersion = Some("0.0.2"))

// invoke the default version
val run = wsk.action.invoke(name, Map("payload" -> "world".toJson))
Expand Down