Another job reference question.

64 views
Skip to first unread message

Itamar Bavli

unread,
Jan 19, 2023, 9:25:34 AM1/19/23
to rundeck-discuss
I have a question regarding job reference.
The only option is the nodes matching from the parent job to the child job when I use the ${node.name} if I use the  Yes, create node intersection with current job nodes.
I do not understand why when I use the "No, use referenced job defined or overridden node filter" no nodes are matched.


Any ideas?

rac...@rundeck.com

unread,
Jan 19, 2023, 1:22:56 PM1/19/23
to rundeck-discuss
Hi!

It seems quite confusing but basically (tested on Rundeck 4.9.0):

"No, use referenced job defined or overridden node filter": overrides the child job nodes with the nodes defined on the "Node Filter" textbox.

"Yes, create node intersection with current job nodes": intersects the nodes defined on the Parent Job with the nodes defined on the "Node filter" textbox.

e.g: if your parent job is defined to be executed on the "node00" node and your Job Reference "Node filter" (configured as "Yes, create node intersection with current job nodes") is defined with "node00 node01 node02", the job should be executed on the node00.

Regards!

Itamar Bavli

unread,
Jan 22, 2023, 6:40:34 AM1/22/23
to rundeck-discuss

Thanks,
Let me explain my issue,
I have one job that tests if a file exists on remote nodes. --> JOB 1
the second job has 2 options for 2 files to check, this job calls JOB 1 twice for each file name the user enters. --- > JOB2

I'm execution job 2 with the 2 options.
When I'm using the "No, use referenced job defined or overridden node filter": overrides the child job nodes with the nodes defined on the "Node Filter" textbox.
I'm expecting the JOB 2 to run and call JOB 1 twice with all the nodes I entered in JOB 2.

The only way this works for me is when I'm using the "Yes, create node intersection with current job nodes": intersects the nodes defined on the Parent Job with the nodes defined on the "Node filter" textbox.
I have to add ${node. name} in the node filter text box, this not seems like the correct way.

Thanks
Itamar

rac...@rundeck.com

unread,
Jan 23, 2023, 12:11:23 PM1/23/23
to rundeck-discuss
Hello Itamar,

Is your Job Reference Step configured as a Node Step?

Regarding this: "I'm expecting the JOB 2 to run and call JOB 1 twice with all the nodes I entered in JOB 2."

If you want to "iterate" a Rundeck job, a (complex) way is to call it via API/RD CLI in a bash loop using curl in a script step.

I think that the best approach is to create a workflow that checks the two files, passes the file names in the data variable using the data passing, and executes it once (e.g: in a script step). In that workflow, you can create an option in a Parent job and use it as a node filter to pass it to the Child Job.

I attached a related example in YAML format.

I think that is the easiest way to achieve this.

Hope it helps!
FileChecker.yaml
FileProcessing.yaml

Itamar Bavli

unread,
Jan 28, 2023, 6:49:18 AM1/28/23
to rundeck-discuss
Thanks,
This is kinda what I did, the question is how do I pass all the nodes from JOB2 to JOB1.
The only way it worked for me was by using the ${node.name} in the node filter.
My other way was to create an option as a list, and I split the list into arrays, and check each item if the file exists.
That worked well. 
But I'm in the process of building larger workflows, I would like to understand what is the best way to pass the node filter into job reference.

Thanks again
Itamar

Reply all
Reply to author
Forward
0 new messages