簡體   English   中英

如何跳過失敗的 Rundeck 作業?

[英]How can I skip a failing Rundeck job?

我有一個 Rundeck 作業來使用作為本地命令運行的自定義腳本來更新服務器。 如果由於在其上運行作業而需要推遲服務器更新,則自定義本地命令將返回一個特殊的返回碼。 如果節點發生故障,Rundeck 作業被配置為使步驟失敗,而不在任何剩余節點上運行。

如果此節點返回特殊返回碼,我想跳過一個節點並繼續下一個節點。

我嘗試使用以下代碼嘗試錯誤處理程序:

/bin/sh -c 'if test "${result.resultCode}" = "125"; then exit 0; fi; exit "${result.resultCode}"'

精簡的作業配置如下所示:

- 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM