That sounds correct Michele, is what the other runtimes do today when parsing /run endpoint on every call. The "value" field JSON object is used as input parameter to the function, and the rest of the fields are upper cased and append __OW_ and make them available as environment variables to the function.
On Wed, Sep 12, 2018 at 12:41 PM Michele Sciabarra <[email protected]> wrote: > And I have to change the runtime. It does not have just to read the json > posted by the run request and extract the value. > It has to extract the value, READ the other keys, set environment > variables and then finally invoke the function with the value. > > -- > Michele Sciabarra > [email protected] > > ----- Original message ----- > From: Rodric Rabbah <[email protected]> > To: [email protected] > Subject: Re: Is it me or there is a bug in the mandatory tests? > Date: Tue, 11 Sep 2018 22:20:47 +0000 > > For posterity: > > 1. the docs here describe the values sent to the actions and how: > > https://github.com/apache/incubator-openwhisk/blob/master/docs/actions-new.md#activation > (this was a recent addition to the docs) > 2. this is the line of code in the test harness that sends context > information as an environment variable > > https://github.com/apache/incubator-openwhisk/blob/967f00525149544628961eb1a8a1e404679167b7/tests/src/test/scala/actionContainers/ActionContainer.scala#L187 > 3. and this is the rest of values that are sent on run: > > https://github.com/apache/incubator-openwhisk/blob/master/core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala#L361 > > -r > > > On Tue, Sep 11, 2018 at 8:00 PM Michele Sciabarra <[email protected]> > wrote: > > > Ok I reply to myself to close the discussion. > > > > Rodric explained me on Slack the other keys are passed in the run > request, > > something important that I missed entirely. I always assumed those values > > were fixed and passed as environment variables in the docker run. I was > > wrong. > > > > This adds a level of complexity to the runtimes but luckily not so > large... > > > > > > -- > > Michele Sciabarra > > [email protected] > > > > ----- Original message ----- > > From: Michele Sciabarra <[email protected]> > > To: [email protected] > > Subject: Re: Is it me or there is a bug in the mandatory tests? > > Date: Tue, 11 Sep 2018 21:40:06 +0200 > > > > Sorry but I do not get it. Are not the values in the map of the test > > supposed to be passed to the runtime as enviroment variables? > > > > The test checks the values of the environment variables read by the code > > are the same in the map. > > the "take(1)" is passing only ONE enviroment variables. > > > > And I keep getting > > > > runtime.actionContainers.ActionLoopBasicGoTests > runtime proxy should > > confirm expected environment variables FAILED > > org.scalatest.exceptions.TestFailedException: api_key "" was not > equal > > to "abc" > > > > If I remove the "take(1)" the test works. > > > > If the variables are not passed by the withContainer(env.toMap) in which > > other way are the enviroment variables are sent to the runtime? > > > > > > -- > > Michele Sciabarra > > [email protected] > > > > ----- Original message ----- > > From: Rodric Rabbah <[email protected]> > > To: [email protected] > > Subject: Re: Is it me or there is a bug in the mandatory tests? > > Date: Tue, 11 Sep 2018 19:29:32 +0000 > > > > it's not a bug in that the API host is provided as an environment > variable > > at container startup. > > so the data passed into the container at /run does not include the > > environment variable (today). > > > > -r > > > > On Tue, Sep 11, 2018 at 7:09 PM Michele Sciabarra <[email protected] > > > > wrote: > > > > > This is a separate issue related to the test 'it should confirm > expected > > > environment variables' > > > > > > I was trying hard to pass this test and failing, and finally > investigated > > > the test code. > > > > > > I see this line: > > > > > > > > > > > > https://github.com/apache/incubator-openwhisk/blob/cfd50eee4194142e95bad6dfd8bf96ff08187050/tests/src/test/scala/actionContainers/BasicActionRunnerTests.scala#L276 > > > > > > val (out, err) = withActionContainer(env.take(1).toMap) > > > > > > is it me, or that "take(1)" will limit the env to only one environment > > > variable? > > > Indeed, removing that take(1) I pass the test. > > > > > > Please let me know because that bug is preventing me to submit the PR > and > > > release a heavily tested and robust "golang" runtime > > > > > > > > > -- > > > Michele Sciabarra > > > [email protected] > > > > > >
