工作条件报告以前的工作 "Never Run"

Job Conditional Reports Previous Job "Never Run"

我有一个作业将其他作业称为主 运行 文件。我执行初步检查,在管理服务器上设置一些值,我必须确保我不会因为更新 运行.

而收到任何错误警报

初步作业执行得很好,但紧随其后的条件总是输出以下状态:

{{UUID}} is NOT RUNNING AND previously NEVER. Expected NOT RUNNING AND 'Succeeded'

无论我做什么,我都无法弄清楚是我做错了什么,还是我配置有误,或者条件是否被破坏了。这是我的家庭实验室的一个小型安装,大约有 10 台服务器,所以我 运行 默认数据库后端,而不是 MySQL 或其他东西,所以我不知道这是否是个问题。

我的 Rundeck 详情

Rundeck version: Rundeck 3.2.8-20200608
Install type: deb
OS Name/version: Ubuntu 18.04
DB Type/version: H2? (whatever the default is)

验证工作状态条件期望,我在 3.2.8 上留下了一个有效的例子。基本上 Job Step Conditional 期望另一个作业最后执行成功,任何不同都会使条件失败。

HelloWorld 作业:

<joblist>
  <job>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <group>test1</group>
    <id>0bdd6fe5-addb-4051-b072-bb4430130a80</id>
    <loglevel>INFO</loglevel>
    <name>HelloWorld</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <exec>echo "hello world"</exec>
      </command>
    </sequence>
    <uuid>0bdd6fe5-addb-4051-b072-bb4430130a80</uuid>
  </job>
</joblist>

CheckerJob(带有作业步骤条件步骤,预计 HelloWorld 作业成功执行):

<joblist>
  <job>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <group>test1</group>
    <id>c6f2be75-81e8-4f8e-ba35-234d5c8a97d6</id>
    <loglevel>INFO</loglevel>
    <name>CheckerJob</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <exec>echo "starting..."</exec>
      </command>
      <command>
        <step-plugin type='job-state-conditional'>
          <configuration>
            <entry key='condition' value='Equals' />
            <entry key='executionState' value='Succeeded' />
            <entry key='fail' value='true' />
            <entry key='halt' value='true' />
            <entry key='jobName' value='test1/HelloWorld' />
            <entry key='jobProject' value='${job.project}' />
            <entry key='jobUUID' value='0bdd6fe5-addb-4051-b072-bb4430130a80' />
            <entry key='running' value='false' />
          </configuration>
        </step-plugin>
      </command>
    </sequence>
    <uuid>c6f2be75-81e8-4f8e-ba35-234d5c8a97d6</uuid>
  </job>
</joblist>

如果作业从未 运行s before.

如果工作运行s before(工作状态条件期望)。

另一种方式

如果你想 运行 在同一个父作业中有条件的作业状态,你需要单独执行 "child" 作业,方法是执行那个作业 "externally"(使用RD-CLI或者API,我留个例子):

你好词:

<joblist>
  <job>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <id>dd33434e-5b6e-40e1-88b0-e9b5b52a3801</id>
    <loglevel>INFO</loglevel>
    <name>HelloWorld</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <exec>echo "hello world!"</exec>
      </command>
    </sequence>
    <uuid>dd33434e-5b6e-40e1-88b0-e9b5b52a3801</uuid>
  </job>
</joblist>

CheckerFakeParentJob(执行 HelloWorld vi RD-CLI 并稍后评估该执行):

<joblist>
  <job>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <id>a90ec790-b856-4f00-8b66-2f37da1d00cb</id>
    <loglevel>INFO</loglevel>
    <name>CheckerFakeParentJob</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <exec>echo "starting"</exec>
      </command>
      <command>
        <fileExtension>.sh</fileExtension>
        <script><![CDATA[# print a message
echo "running HelloWorld job"

# run the hello world job via RD-CLI to get the individual execution and evaluate later
rd run -j HelloWorld -p ProjectEXAMPLE

# some time depending of job
sleep 3

# print a message
echo "done"]]></script>
        <scriptargs />
        <scriptinterpreter>/bin/bash</scriptinterpreter>
      </command>
      <command>
        <step-plugin type='job-state-conditional'>
          <configuration>
            <entry key='condition' value='Equals' />
            <entry key='executionState' value='Succeeded' />
            <entry key='fail' value='true' />
            <entry key='halt' value='true' />
            <entry key='jobUUID' value='dd33434e-5b6e-40e1-88b0-e9b5b52a3801' />
            <entry key='running' value='false' />
          </configuration>
        </step-plugin>
      </command>
    </sequence>
    <uuid>a90ec790-b856-4f00-8b66-2f37da1d00cb</uuid>
  </job>
</joblist>

结果here.

您有更多信息here

编辑:如果您引用的是基于作业引用步骤的工作流,则必须采用父作业状态(即使子作业是通过父作业执行的)。