-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Treat action code as attachments #3945 8000
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
91c795a
Treat action code as attachments for all newly created or update acti…
dubee 0dd9f66
Fix issues post rebase
chetanmeh 58d0f92
Store base64 encoded streams in raw form
chetanmeh 6ddada3
Fix testcases
chetanmeh 79684ef
Add test for exec deserialization compatibility
chetanmeh 3b3baa0
Support code stored in jar property
chetanmeh fe7dac2
Use octet stream type for binary and text/plain otherwise
chetanmeh 152fa79
Reword exception message to state that code can be string on object
chetanmeh 1bb3986
Drop rewrite of jar files as base64 encoded file
chetanmeh a649de4
Remove unnecessary special handling of java code
chetanmeh a25b0f3
Fix expected attachmentType
chetanmeh 3e3eb3a
Remove unused variable
chetanmeh 745c9f6
Add some more compat tests
chetanmeh 7ab5666
Simplify json deserialization based on Markus patch
chetanmeh dd3d942
Use std charset
chetanmeh b142bc1
Remove dead code
chetanmeh ac5baab
Add support for tweaking code size via CODE_SIZE
chetanmeh 0982e1e
Use attachment for php runtime also
chetanmeh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,14 +140,14 @@ protected[core] case class CodeExecMetaDataAsString(manifest: RuntimeManifest, | |
|
||
protected[core] case class CodeExecAsAttachment(manifest: RuntimeManifest, | ||
override val code: Attachment[String], | ||
override val entryPoint: Option[String]) | ||
override val entryPoint: Option[String], | ||
override val binary: Boolean = false) | ||
extends CodeExec[Attachment[String]] { | ||
override val kind = manifest.kind | ||
override val image = manifest.image | ||
override val sentinelledLogs = manifest.sentinelledLogs.getOrElse(true) | ||
override val deprecated = manifest.deprecated.getOrElse(false) | ||
override val pull = false | ||
override lazy val binary = true | ||
override def codeAsJson = code.toJson | ||
|
||
def inline(bytes: Array[Byte]): CodeExecAsAttachment = { | ||
|
@@ -301,22 +301,24 @@ protected[core] object Exec extends ArgNormalizer[Exec] with DefaultJsonProtocol | |
} | ||
|
||
manifest.attached | ||
.map { a => | ||
val jar: Attachment[String] = { | ||
// java actions once stored the attachment in "jar" instead of "code" | ||
obj.fields.get("code").orElse(obj.fields.get("jar")) | ||
} map { | ||
attFmt[String].read(_) | ||
} getOrElse { | ||
.map { _ => | ||
// java actions once stored the attachment in "jar" instead of "code" | ||
val code = obj.fields.get("code").orElse(obj.fields.get("jar")).getOrElse { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can remove this code or jar (separately). It’s been a long time since I made this schema change. |
||
throw new DeserializationException( | ||
s"'code' must be a valid base64 string in 'exec' for '$kind' actions") | ||
s"'code' must be a string or attachment object defined in 'exec' for '$kind' actions") | ||
} | ||
val binary: Boolean = code match { | ||
case JsString(c) => isBinaryCode(c) | ||
case _ => obj.fields.get("binary").map(_.convertTo[Boolean]).getOrElse(false) | ||
} | ||
|
||
val main = optMainField.orElse { | ||
if (manifest.requireMain.exists(identity)) { | ||
throw new DeserializationException(s"'main' must be a string defined in 'exec' for '$kind' actions") | ||
} else None | ||
} | ||
CodeExecAsAttachment(manifest, jar, main) | ||
|
||
CodeExecAsAttachment(manifest, attFmt[String].read(code), main, binary) | ||
} | ||
.getOrElse { | ||
val code: String = obj.fields.get("code") match { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won’t break pre-existing java actions I presume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
attachmentName
andattachmentType
are not used in actual flow. ContentType is just stored but not interpreted so far for any purpose