Multiline Data Capture output, is it possible to transfer to another job?

68 views
Skip to first unread message

mutlu...@gmail.com

unread,
Jan 24, 2021, 11:27:45 PM1/24/21
to rundeck-discuss
Hello All,

I want to transfer multiline data capture output to another job. do we have any way?

When i'm checking to variable "${data.tblTop}" i didn't see any data in the same step.

How do i transfer multi data to another job?

Best Regards

tblTop.png

Kobi

unread,
Jan 25, 2021, 1:05:05 AM1/25/21
to rundeck...@googlegroups.com

You can use log filters.


Sent from my Galaxy


rac...@rundeck.com

unread,
Jan 25, 2021, 7:04:23 AM1/25/21
to rundeck-discuss

Hi,

The best way to pass a data value to another job is to use a “receiver option” in the second job, in that way you can use the job reference step and pass the data value as an argument from the first job, let me share an example:

JobA (creates a multiline data capture output and store it on a data value, later pass that data value to JobB using job reference step):

<joblist>
  <job>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <id>710dc75c-1409-4e11-a7e0-5f87a537094b</id>
    <loglevel>INFO</loglevel>
    <name>JobA</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <fileExtension>.sh</fileExtension>
        <plugins>
          <LogFilter type='key-value-data-multilines'>
            <config>
              <hideOutput>false</hideOutput>
              <logData>true</logData>
              <name>mydata</name>
              <regex>^(.*)</regex>
            </config>
          </LogFilter>
        </plugins>
        <script><![CDATA[echo "one"
echo "two"
echo "three"
echo "four"
echo "five"]]></script>
        <scriptargs />
        <scriptinterpreter>/bin/bash</scriptinterpreter>
      </command>
      <command>
        <jobref name='JobB' nodeStep='true'>
          <arg line='-optb ${data.mydata}' />
          <uuid>4b229654-f441-4530-a859-4cd528fea9d2</uuid>
        </jobref>
      </command>
    </sequence>
    <uuid>710dc75c-1409-4e11-a7e0-5f87a537094b</uuid>
  </job>
</joblist>

JobB (receives the JobA data value using an option):

<joblist>
  <job>
    <context>
      <options preserveOrder='true'>
        <option name='optb' />
      </options>
    </context>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <id>4b229654-f441-4530-a859-4cd528fea9d2</id>
    <loglevel>INFO</loglevel>
    <name>JobB</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <exec>echo ${option.optb}</exec>
      </command>
    </sequence>
    <uuid>4b229654-f441-4530-a859-4cd528fea9d2</uuid>
  </job>
</joblist>

Hope it helps!

mutlu...@gmail.com

unread,
Jan 28, 2021, 10:08:11 AM1/28/21
to rundeck-discuss

Thank you so much.
Reply all
Reply to author
Forward
0 new messages