Reputation: 1
I'm trying to assemble a system which will require multiple jobs being run in a variable number of nodes in a variable order with possibility for duplication.
I'm attempting to solve this by having a single job for each node (note each node runs different jobs as well) and then having which job is executed decided at runtime.
But when running the job I get:
"2: Workflow step executing: JobReferenceItem{label='Step 1 job, jobIdentifier='${data.DEPLOY_SYSTEM_1}', nodeStep=true}"
The variable doesn't seem to be getting expanded. Is this not possible or could I be doing it wrong? I've not been able to find any information on using variables to dynamically choose which job is run
Any help is appreciated. Thanks
Upvotes: 0
Views: 1148
Reputation: 4380
You're right, I tested calling using data and option variable on Job Reference Step and doesn't work:
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>97979d11-6ff8-45ef-9843-8b90e4e135d1</id>
<loglevel>INFO</loglevel>
<name>JobONE</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>echo "MYJOB=JobTWO"</exec>
<plugins>
<LogFilter type='key-value-data'>
<config>
<logData>true</logData>
<regex>^(MYJOB)\s*=\s*(.+)$</regex>
</config>
</LogFilter>
</plugins>
</command>
<command>
<exec>echo ${data.MYJOB}</exec>
</command>
<command>
<jobref name='${data.MYJOB}' nodeStep='true'>
<useName>true</useName>
</jobref>
</command>
</sequence>
<uuid>97979d11-6ff8-45ef-9843-8b90e4e135d1</uuid>
</job>
</joblist>
A good workaround is to embed RD CLI command to call the job (using the data or option) on inline script step like this:
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>97979d11-6ff8-45ef-9843-8b90e4e135d1</id>
<loglevel>INFO</loglevel>
<name>JobONE</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>echo "MYJOB=JobTWO"</exec>
<plugins>
<LogFilter type='key-value-data'>
<config>
<logData>true</logData>
<regex>^(MYJOB)\s*=\s*(.+)$</regex>
</config>
</LogFilter>
</plugins>
</command>
<command>
<exec>echo ${data.MYJOB}</exec>
</command>
<command>
<script><![CDATA[# call another job, more info: rd run help
rd run -j @data.MYJOB@ -p ProjectLOCAL]]></script>
<scriptargs />
</command>
</sequence>
<uuid>97979d11-6ff8-45ef-9843-8b90e4e135d1</uuid>
</job>
</joblist>
Using Ruleset (only for Rundeck Enterprise) you can decide the way depending on the value of some variable, take a look.
Also, you can suggest that issue in the official GitHub space.
Upvotes: 0