[英]How can I skip a failing Rundeck job?
I have a Rundeck job to update servers using a custom script that is run as local command.我有一个 Rundeck 作业来使用作为本地命令运行的自定义脚本来更新服务器。 If the server update needs to be postponed due to running jobs on it, the custom local command will return a special return code.如果由于在其上运行作业而需要推迟服务器更新,则自定义本地命令将返回一个特殊的返回码。 The Rundeck job is configured to fail the step without running on any remaining nodes if a node fails.如果节点发生故障,Rundeck 作业被配置为使步骤失败,而不在任何剩余节点上运行。
I want to skip a node and continue with the next node if this node return the special return code.如果此节点返回特殊返回码,我想跳过一个节点并继续下一个节点。
I tried to experiment with an error handler using code like:我尝试使用以下代码尝试错误处理程序:
/bin/sh -c 'if test "${result.resultCode}" = "125"; then exit 0; fi; exit "${result.resultCode}"'
The stripped down job configuration looks like:精简的作业配置如下所示:
- defaultTab: summary
executionEnabled: true
loglevel: INFO
multipleExecutions: true
name: Server update
nodeFilterEditable: true
nodefilters:
dispatch:
excludePrecedence: true
keepgoing: false
successOnEmptyNodeFilter: false
threadcount: ${option.parallelity}
filter: ''
nodesSelectedByDefault: true
notification:
onfailure:
email:
recipients: me@example.com
subject: 'rundeck: server update failed'
onsuccess:
email:
recipients: me@example.com
subject: 'rundeck: server update finished'
notifyAvgDurationThreshold: null
options:
- description: Maximum number of server updates in parallel.
name: parallelity
regex: ^[0-9]+$
required: true
value: '1'
scheduleEnabled: true
sequence:
commands:
- configuration:
command: /usr/bin/custom-server-update "${node.name}"
nodeStep: true
type: localexec
keepgoing: false
strategy: parallel
在创建或编辑您的作业时,向下滚动并设置:如果节点失败 -> 在该步骤失败之前继续在任何剩余节点上运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.