mirror of
https://github.com/hanzoai/deploy.git
synced 2026-10-30 14:56:59 +00:00
Every command is cd-*: cd, cd-server, cd-repo-server, cd-application-controller, cd-applicationset-controller, cd-cmp-server, cd-commit-server, cd-dex, cd-git-ask-pass, cd-k8s-auth, cd-notification. util/argo is util/cd; util/notification/argocd is util/notification/cd. Preserved deliberately: github.com/argoproj/argocd-example-apps is an EXTERNAL repo used as an e2e fixture, and notifications-engine + pkg/v2 are real dependencies. Renaming a URL we do not own would break the tests. Two bugs I made and caught, both from a careless sed: - s/argo/cd/g turned 'argocd' into 'cdcd' in two directory names - renaming the package declaration left every call site saying argo.X go build ./... exit 0. Co-authored-by: Hanzo Dev <[email protected]>
61 lines
2.0 KiB
Lua
61 lines
2.0 KiB
Lua
-- CRD spec: https://gitops-promoter.readthedocs.io/en/latest/crd-specs/#commitstatus
|
|
|
|
local hs = {}
|
|
hs.status = "Progressing"
|
|
hs.message = "Initializing commit status"
|
|
|
|
-- Check for deletion timestamp
|
|
if obj.metadata.deletionTimestamp then
|
|
hs.status = "Progressing"
|
|
hs.message = "Commit status is being deleted"
|
|
return hs
|
|
end
|
|
|
|
-- Check if status exists
|
|
if not obj.status then
|
|
return hs
|
|
end
|
|
|
|
-- Check for reconciliation conditions
|
|
local hasReadyCondition = false
|
|
if obj.status.conditions then
|
|
for _, condition in ipairs(obj.status.conditions) do
|
|
if condition.type == "Ready" then
|
|
hasReadyCondition = true
|
|
if condition.observedGeneration and obj.metadata.generation and condition.observedGeneration ~= obj.metadata.generation then
|
|
hs.status = "Progressing"
|
|
hs.message = "Waiting for commit status spec update to be observed"
|
|
return hs
|
|
end
|
|
-- Check for any False condition status
|
|
if condition.status == "False" then
|
|
hs.status = "Degraded"
|
|
local msg = condition.message or "Unknown error"
|
|
local reason = condition.reason or "Unknown"
|
|
-- Don't include ReconciliationError in the message since it's redundant
|
|
if reason == "ReconciliationError" then
|
|
hs.message = "Commit status reconciliation failed: " .. msg
|
|
else
|
|
hs.message = "Commit status reconciliation failed (" .. reason .. "): " .. msg
|
|
end
|
|
return hs
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if not hasReadyCondition then
|
|
hs.status = "Progressing"
|
|
hs.message = "Commit status is not ready yet"
|
|
return hs
|
|
end
|
|
|
|
if not obj.status.sha or not obj.status.phase then
|
|
hs.status = "Healthy"
|
|
hs.message = "Commit status is healthy"
|
|
return hs
|
|
end
|
|
|
|
hs.status = "Healthy"
|
|
hs.message = "Commit status for commit " .. obj.status.sha .. " reports " .. obj.status.phase
|
|
return hs
|