On Tue, Feb 27, 2018, at 7:56 PM, Carlos Santana wrote: > Michele > > Sorry about that, I think I got confused the exec in code with the ability > to uploading a string/executable file like a shell/bash script or perl > script. I know that if binary is false then it treats as a script and if it is true as a zip file. Problem is with Go actions an executable and a zip looks the same...
> > I think we can take a todo after implementing exec inside zip and add > improvements. > > We should be able at the proxy level when binary=true (base64) distinguish > the `code` by parsing the first bytes and tell if it's a zip, tgz, or > executable related [1] Great! It is exactly what I already implemented in the Go runtime. it is based on this library: https://github.com/h2non/filetype At the moment I am busy trying to make things robust and write unit tests... > That way support just uploading a exec without the extra step to zip, or > even support tgz which have come up for other runtimes like nodejs8 [1] > > [1] https://github.com/apache/incubator-openwhisk-runtime-nodejs/pull/16 > [2] https://github.com/apache/incubator-openwhisk-runtime-nodejs/issues/15 > > -- Carlos > > > On Tue, Feb 27, 2018 at 8:47 AM Michele Sciabarra <[email protected]> > wrote: > > > On Mon, Feb 26, 2018, at 6:06 PM, Carlos Santana wrote: > > > Hi Michele > > > > > > >There is only one "annoyance" here: I noticed the dockerskeleton always > > > expects a zip file including an "exec" > > > > > > dockerskeleton suppports adding an exec straight, it will take the file > > do > > > a chmod +x and executed. > > > > > > So not sure what you are referring here as this is possible, maybe I miss > > > understood > > > > I use this script to post: > > --- init.sh --- > > #!/bin/bash > > FILE=${1:?file} > > echo '{"value":{"binary":true,"code":"'$(base64 $FILE)'"}}' >$FILE.json > > curl -XPOST http://localhost:${PORT:-8080}/init -d @$FILE.json > > ---- > > > > exec is the compilation of this sample: > > http://jamesthom.as/blog/2016/06/21/serverless-go-actions/ > > > > I launch the docker skeleton: > > > > docker -p 8080:8080 -ti openwhisk/dockerskeleton > > > > If I post it as is: > > > > ./init.sh exec > > I get: > > err File is not a zip file > > > > if I zip it: > > > > zip exec.zip exec > > ./init.sh exec.zip > > > > it works > > > > Where am I wrong? > > > >
