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

passing parameters between manifest and deploy.yml #884

Open
chosun41 opened this issue May 1, 2018 · 8 comments
Open

passing parameters between manifest and deploy.yml #884

chosun41 opened this issue May 1, 2018 · 8 comments

Comments

@chosun41
Copy link

chosun41 commented May 1, 2018

basically have two triggers tied to same action, where i am trying to pass the inputs from triggers to the action. right now the action doesn't recognize the value of these trigger arguments.

followed the pattern on this site.

https://github.com/apache/incubator-openwhisk-wskdeploy/blob/master/docs/wskdeploy_triggerrule_trigger_bindings.md#triggers-and-rules

also this is what it says as far as my packages
when i run "bx wsk package list"

packages
/adam-johnson-sandbox_walmart-watering-dev/walmart_watering private
/adam-johnson-sandbox_walmart-watering-dev/Bluemix_walmart-watering-dev-db_wsk private

can't attach yamls so stored in zip file the manifest and deploy.yml files
yamls.zip

@pritidesai
Copy link
Member

Once the trigger is defined as alarm type, the trigger inputs are not propagated to actions:

I modified manifest to:

    triggers:
      meetPerson:
        feed: /whisk.system/alarms/alarm
        inputs:
          name: string
          place: string
          children: integer
          height: float

deployment to:

            inputs:
              name: Elrond
              place: Rivendell
              children: 3
              height: 1.88
              cron: "0 7 29,30 6 *"

wsk activation returns:

        "result": {
            "details": "You have 0 children and are 0 m. tall.",
            "greeting": "Hello,  from "
        }

instead of:

        "result": {
            "details": "You have 3 children and are 1.88 m. tall.",
            "greeting": "Hello, Elrond from Rivendell"
        }

@pritidesai
Copy link
Member

pritidesai commented May 2, 2018

the same behavior is seen with wsk CLI:

wsk trigger create my-alarm-trigger-1 --feed /whisk.system/alarms/alarm --param name Priti --param place Home --param cron "* * * * *"

Creating rule:

wsk rule create my-rule-1 my-alarm-trigger-1 hello_world_package/hello_world_triggerrule

Fire trigger:

wsk trigger fire my-alarm-trigger-1

Result had no name and place assigned:

wsk activation get 1b150c7339ab4074950c7339ab40741a ... "result": {
            "details": "You have 0 children and are 0 m. tall.",
            "greeting": "Hello,  from "

V/S Non Feed Trigger:

wsk trigger create my-no-alarm-trigger --param name Priti --param place Home

Creating rule with:

wsk rule create my-rule-2 my-no-alarm-trigger hello_world_package/hello_world_triggerrule

Fire trigger and check the result:

            "details": "You have 0 children and are 0 m. tall.",
            "greeting": "Hello, Priti from Home"
        }

@pritidesai
Copy link
Member

Confirmed with @beemarie that it does work through IBM Cloud Functions UI.

@csantanapr
Copy link
Member

@pritidesai @beemarie

With alarm feed you need to use the parameter trigger_payload

For example:

wsk trigger create my-alarm-trigger-1 --feed /whisk.system/alarms/alarm --param cron "30 2 * * *" --param trigger_payload "{\"name\":\"Priti\",\"place\":\"Home\"}"

More info in the alarm docs:
https://github.com/apache/incubator-openwhisk-package-alarms#firing-a-trigger-on-a-time-based-schedule-using-cron

@pritidesai
Copy link
Member

thanks @csantanapr I talked to @dubee and tried the same with trigger_payload without any success:

Trigger create with:

wsk trigger create locationUpdate --param name Odin --param place Asgard

Creates parameters under Parameters section in UI

image

But when I create alarm trigger with:

wsk trigger create periodic --feed /whisk.system/alarms/alarm --param cron "*/2 * * * *" --param trigger_payload "{\"name\":\"Odin\",\"place\":\"Asgard\"}"

doesnt show any parameters in UI

@pritidesai
Copy link
Member

It does show payload on trigger with:

wsk trigger get periodic
   "response": {
        "result": {
            "config": {
                "cron": "*/2 * * * *",
                "name": "periodic",
                "namespace": "",
                "payload": {
                    "name": "Odin",
                    "place": "Asgard"
                }
            },

@jasonpet
Copy link

jasonpet commented May 3, 2018

the action should also show the trigger_payload. It will be under a param called payload though just as it shows for trigger get.

@pritidesai
Copy link
Member

@jasonpet nope action doesn't show such parameter, also, @dubee referenced couple of issues from CLI repo ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants