rundeck-opensource有什么方法可以在失败的工作流步骤触发作业吗



我们有插件吗?或者有什么方法可以让作业在失败的工作流步骤中恢复执行吗?

如果我的作业1和作业2通过了,那么作业3必须触发。如果作业1通过了,作业2失败了,当我们为作业2修复它并手动触发它时,如果它通过了,那么作业3应该知道作业2通过了,并且作业1以前的状态通过了。然后作业3应该自动触发。我们有任何插件或方法来实现rundeck开源吗?

最好的方法是在您的步骤上附加一个错误处理程序(在您的作业引用步骤中(,该错误处理程序调用另一个作业,我留下一个基本示例:

补救作业(如果任何ParentJob作业引用通过错误处理程序失败,则必须调用的作业(:

<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>67c56627-9dbd-4ad2-b6c1-04436ab3d0b2</id>
<loglevel>INFO</loglevel>
<name>RemediationJob</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<fileExtension>.sh</fileExtension>
<script><![CDATA[echo "fixing..."
echo "fixed! try run the job again"]]></script>
<scriptargs />
<scriptinterpreter>/bin/bash</scriptinterpreter>
</command>
</sequence>
<uuid>67c56627-9dbd-4ad2-b6c1-04436ab3d0b2</uuid>
</job>
</joblist>

工作A:

<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>5d19ea42-0431-4a68-a061-623f498222f6</id>
<loglevel>INFO</loglevel>
<name>ChildA</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>echo "hi"</exec>
</command>
</sequence>
<uuid>5d19ea42-0431-4a68-a061-623f498222f6</uuid>
</job>
</joblist>

JobB(步骤上有故意错误(:

<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>00f5aaa5-5726-4f65-86a3-2a3c404bff08</id>
<loglevel>INFO</loglevel>
<name>ChildB</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>eco "hi"</exec>
</command>
</sequence>
<uuid>00f5aaa5-5726-4f65-86a3-2a3c404bff08</uuid>
</job>
</joblist>

ParentJob(它调用JobA和JobB,并在任何作业引用步骤上使用错误处理程序(

<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>c2e0a05e-4fdd-4c33-9b4e-c9109d3667c6</id>
<loglevel>INFO</loglevel>
<name>ParentJob</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<errorhandler>
<jobref name='RemediationJob' nodeStep='true'>
<uuid>67c56627-9dbd-4ad2-b6c1-04436ab3d0b2</uuid>
</jobref>
</errorhandler>
<jobref name='ChildA' nodeStep='true'>
<uuid>5d19ea42-0431-4a68-a061-623f498222f6</uuid>
</jobref>
</command>
<command>
<errorhandler>
<jobref name='RemediationJob' nodeStep='true'>
<uuid>67c56627-9dbd-4ad2-b6c1-04436ab3d0b2</uuid>
</jobref>
</errorhandler>
<jobref name='ChildB' nodeStep='true'>
<uuid>00f5aaa5-5726-4f65-86a3-2a3c404bff08</uuid>
</jobref>
</command>
</sequence>
<uuid>c2e0a05e-4fdd-4c33-9b4e-c9109d3667c6</uuid>
</job>
</joblist>

在本例中,第二个作业引用总是故意失败,这样,如果步骤(在您的情况下为作业引用步骤(失败,您就可以看到如何触发另一个作业。

最新更新