mirror of
https://github.com/hanzoai/deploy.git
synced 2026-10-07 08:44:50 +00:00
* chore(action): add newlines at eof Signed-off-by: Josh Soref <[email protected]> * chore(action): fix whitespace indentation Signed-off-by: Josh Soref <[email protected]> * chore(action): use local annotations Signed-off-by: Josh Soref <[email protected]> --------- Signed-off-by: Josh Soref <[email protected]>
40 lines
1.2 KiB
Lua
40 lines
1.2 KiB
Lua
local hs = {}
|
|
|
|
function messageOrDefault(field, default)
|
|
if field ~= nil then
|
|
return field
|
|
end
|
|
return default
|
|
end
|
|
|
|
if obj.status ~= nil then
|
|
if obj.status.phase == "Pending" then
|
|
hs.status = "Progressing"
|
|
hs.message = "Analysis run is running"
|
|
end
|
|
if obj.status.phase == "Running" then
|
|
hs.status = "Progressing"
|
|
hs.message = "Analysis run is running"
|
|
end
|
|
if obj.status.phase == "Successful" then
|
|
hs.status = "Healthy"
|
|
hs.message = messageOrDefault(obj.status.message, "Analysis run completed successfully")
|
|
end
|
|
if obj.status.phase == "Failed" then
|
|
hs.status = "Degraded"
|
|
hs.message = messageOrDefault(obj.status.message, "Analysis run failed")
|
|
end
|
|
if obj.status.phase == "Error" then
|
|
hs.status = "Degraded"
|
|
hs.message = messageOrDefault(obj.status.message, "Analysis run had an error")
|
|
end
|
|
if obj.status.phase == "Inconclusive" then
|
|
hs.status = "Unknown"
|
|
hs.message = messageOrDefault(obj.status.message, "Analysis run was inconclusive")
|
|
end
|
|
return hs
|
|
end
|
|
|
|
hs.status = "Progressing"
|
|
hs.message = "Waiting for analysis run to finish: status has not been reconciled."
|
|
return hs |