I use Rundeck to execute the Job A. In Job A, I have a Global Log Filter that captures key/value data using the default regex (RUNDECK:DATA:...
).
I call another job - Job B - that prints stuff starting with RUNDECK:DATA:key = value. I execute Job B from Job A. Somehow the Global Log Filter that I setup in Job A doesn't parse the output of Job B.
I added the same Global Log Filter to Job B, and see that the data is captured correctly, but it is not available on Job A so that it can be used on the following steps.
Does anyone know if it is possible to capture key/value from the output of a another job? I managed to capture values from steps of the same job, but not when the output comes from an execution of another called job.
Checking your last comment the easiest way to do that is to use a file that stores the value (on JobB) and later is processed by the JobA next steps. Basically the JobA launches JobB via Job Reference Step, then JobB generates the data on a file, and the JobA recovers that value from the temporal file on the next steps.
JobA:
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>a0daf1e3-e918-43dc-b232-bc46a7a287b6</id>
<loglevel>INFO</loglevel>
<name>JobA</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>echo "starting Job A"</exec>
</command>
<command>
<description>Job B call that geneates the temp value</description>
<jobref name='JobB' nodeStep='true'>
<uuid>ba183d3b-67d9-4499-b863-da8b7ac8aef3</uuid>
</jobref>
</command>
<command>
<exec>echo "printing the Job B value"</exec>
</command>
<command>
<exec>cat tempfile.txt</exec>
<plugins>
<LogFilter type='key-value-data'>
<config>
<invalidKeyPattern>\s|\$|\{|\}|\\</invalidKeyPattern>
<logData>true</logData>
<regex>^(mykey)\s*=\s*(.+)$</regex>
</config>
</LogFilter>
</plugins>
</command>
<command>
<exec>echo "the value is ${data.mykey}"</exec>
</command>
</sequence>
<uuid>a0daf1e3-e918-43dc-b232-bc46a7a287b6</uuid>
</job>
</joblist>
JobB:
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>ba183d3b-67d9-4499-b863-da8b7ac8aef3</id>
<loglevel>INFO</loglevel>
<name>JobB</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>echo "Generating the value..."</exec>
</command>
<command>
<exec>echo "mykey=myvalue" > tempfile.txt</exec>
</command>
<command>
<exec>echo "Value generated on temp file"</exec>
</command>
</sequence>
<uuid>ba183d3b-67d9-4499-b863-da8b7ac8aef3</uuid>
</job>
</joblist>