0

I'm developing a webhook to trigger a job, but I can't find a way to specified the target Node who is in charge to execute it, it is possible send in the json payload a param to overwrite the Node Filter before start an execution?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

0

A good way to do that is to put an option in your job, put that option in your node filter nodes tab (in this format: ${option.myoption}) and then call the webhook in this way.

I left a job definition example:

- defaultTab: nodes
  description: ''
  executionEnabled: true
  id: 70a8bdb2-3ff6-419b-8311-394eeb470992
  loglevel: INFO
  name: HelloWorld
  nodeFilterEditable: false
  nodefilters:
    dispatch:
      excludePrecedence: true
      keepgoing: false
      rankOrder: ascending
      successOnEmptyNodeFilter: false
      threadcount: '1'
    filter: ${option.opt1}
  nodesSelectedByDefault: true
  options:
  - name: opt1
  plugins:
    ExecutionLifecycle: null
  scheduleEnabled: true
  sequence:
    commands:
    - exec: whoami
    keepgoing: false
    strategy: node-first
  uuid: 70a8bdb2-3ff6-419b-8311-394eeb470992

And the webhook call example:

curl -H "Content-Type: application/json" -X POST -d '{"field1":"localhost"}' http://localhost:4440/api/41/webhook/98d1Bp0Pcb8QpIc2OzLodQ5AThtmuP1y#TestWebhook
MegaDrive68k
  • 3,768
  • 2
  • 9
  • 51