passing dynamic options from one job to next

1,065 views
Skip to first unread message

Krzysztof Barański

unread,
Sep 8, 2017, 3:53:03 PM9/8/17
to rundeck-discuss
Hi

Is there a way to pass arguments to next job in workflow from environment variable of other (main) job bash script?
In my case I want to generate in bash argument and pass it to all dependent jobs in workflow (date & hour of starting the workflow)

using current time in each job in workflow is not appropriate because if I schedule job at 5:55 next job could start 6:05 so will have different run argument

There is no way to pass current date as an option to job - then It would be possible to pass it to next job it this way:
Screen: Edit Job
Section: Workflow
Job Name/Group: Task1
Arguments: -referenceTime "${option.referenceTime}" -timeShift "${option.timeShift}"

Thanks

Alex Honor

unread,
Sep 8, 2017, 3:54:13 PM9/8/17
to rundeck...@googlegroups.com
Hi Krzysztof,
Yes, I believe that should be possible now with 2.9 using the Log Filter and Key Value capture. What version are you running?

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to rundeck-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/919db261-b40f-44e5-b4ce-a58eca63d0c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Alex Honor

[Rundeck | a...@rundeck.com ]

Krzysztof Barański

unread,
Sep 8, 2017, 3:59:07 PM9/8/17
to rundeck-discuss
We have Rundeck 2.8.2-1

This is documented somewhere rundeck.org/docs ? I couldn't find it


On Friday, September 8, 2017 at 12:54:13 PM UTC-7, Alex Honor wrote:
Hi Krzysztof,
Yes, I believe that should be possible now with 2.9 using the Log Filter and Key Value capture. What version are you running?
On Fri, Sep 8, 2017 at 12:52 PM, Krzysztof Barański <kma...@gmail.com> wrote:
Hi

Is there a way to pass arguments to next job in workflow from environment variable of other (main) job bash script?
In my case I want to generate in bash argument and pass it to all dependent jobs in workflow (date & hour of starting the workflow)

using current time in each job in workflow is not appropriate because if I schedule job at 5:55 next job could start 6:05 so will have different run argument

There is no way to pass current date as an option to job - then It would be possible to pass it to next job it this way:
Screen: Edit Job
Section: Workflow
Job Name/Group: Task1
Arguments: -referenceTime "${option.referenceTime}" -timeShift "${option.timeShift}"

Thanks

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To post to this group, send email to rundeck...@googlegroups.com.



--

Alex Honor

[Rundeck | a....@rundeck.com ]

Alex Honor

unread,
Sep 8, 2017, 4:06:04 PM9/8/17
to rundeck...@googlegroups.com
Not in the docs yet but there is some user info inside the GUI.

To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to rundeck-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/de8fc4b0-c517-4321-abbc-b3053053e3f7%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Alex Honor

[Rundeck | a...@rundeck.com ]

Krzysztof Barański

unread,
Sep 8, 2017, 4:08:12 PM9/8/17
to rundeck-discuss
Thanks I'll try to setup this



--

Alex Honor

[Rundeck | a....@rundeck.com ]

Krzysztof Barański

unread,
Sep 8, 2017, 7:48:35 PM9/8/17
to rundeck-discuss
Confirmed it works when strategy is set to sequential.

Important note:
Strategy need to be set as sequential to all types of jobs receive real parameters
with without this "Job Reference" step gets variable name as string for example: "${data.reftime}"
and inline script gets empty value

Not sure why it don't work on Node First strategy (which is default) - I always use one node so sequential strategy is fine for me.

For reference with "Node First" strategy:
running Job Reference step with Arguments: -referenceTime ${data.reftime} -timeShift ${option.timeShift}
I get:
/tmp/31-13-localhost-dispatch-script.tmp.sh: line 3: ${data.reftime}: bad substitution
timeShift=-1 hour
 
where script in referenced job is:
#!/bin/bash

echo referenceTime="@option.referenceTime@"
echo timeShift="@option.timeShift@"
 

also with inline script I get empty output
#!/bin/bash
set -x
echo "@data.reftime@"

Command and script with argument works:
Command: /bin/echo ${data.reftime}
2017-09-08 23:30:49+00:00

Script with argument: ${data.reftime}
command parameter data.reftime=2017-09-08 23:30:49+00:00


Results from Rundeck 2.9.3-1 from https://github.com/rundeck/anvils-demo.git

Documentation of this feature is here: https://github.com/rundeck/rundeck/issues/2577

step 1 outputs saved values:
Key Value Data: Results
Key    Value
reftime    2017-09-08 22:50:14+00:00
starttime    20170908/2100
endtime    20170908/2200

Krzysztof Barański

unread,
Sep 12, 2017, 2:03:51 AM9/12/17
to rundeck-discuss
Actually it doesn't work for passing data.refdate to other job via argument to "Job Reference"

/tmp/41-16-localhost-dispatch-script.tmp.sh: line 3: ${data.reftime}: bad substitution
Reply all
Reply to author
Forward
0 new messages