github.com/argoproj/argo-cd/v3@v3.2.1/resource_customizations/promoter.argoproj.io/CommitStatus/health.lua (about)

     1  local hs = {}
     2  hs.status = "Progressing"
     3  hs.message = "Initializing commit status"
     4  
     5  -- Check for deletion timestamp
     6  if obj.metadata.deletionTimestamp then
     7      hs.status = "Progressing"
     8      hs.message = "Commit status is being deleted"
     9      return hs
    10  end
    11  
    12  -- Check if status exists
    13  if not obj.status then
    14      return hs
    15  end
    16  
    17  -- Check for reconciliation conditions
    18  local hasReadyCondition = false
    19  if obj.status.conditions then
    20      for _, condition in ipairs(obj.status.conditions) do
    21          if condition.type == "Ready" then
    22              hasReadyCondition = true
    23              if condition.observedGeneration and obj.metadata.generation and condition.observedGeneration ~= obj.metadata.generation then
    24                  hs.status = "Progressing"
    25                  hs.message = "Waiting for commit status spec update to be observed"
    26                  return hs
    27              end
    28              -- Check for any False condition status
    29              if condition.status == "False" then
    30                  hs.status = "Degraded"
    31                  local msg = condition.message or "Unknown error"
    32                  local reason = condition.reason or "Unknown"
    33                  -- Don't include ReconciliationError in the message since it's redundant
    34                  if reason == "ReconciliationError" then
    35                      hs.message = "Commit status reconciliation failed: " .. msg
    36                  else
    37                      hs.message = "Commit status reconciliation failed (" .. reason .. "): " .. msg
    38                  end
    39                  return hs
    40              end
    41          end
    42      end
    43  end
    44  if not hasReadyCondition then
    45      hs.status = "Progressing"
    46      hs.message = "Commit status is not ready yet"
    47      return hs
    48  end
    49  
    50  if not obj.status.sha or not obj.status.phase then
    51      hs.status = "Healthy"
    52      hs.message = "Commit status is healthy"
    53      return hs
    54  end
    55  
    56  hs.status = "Healthy"
    57  hs.message = "Commit status for commit " .. obj.status.sha .. " reports " .. obj.status.phase
    58  return hs