-
Notifications
You must be signed in to change notification settings - Fork 7.1k
feat(health): additional promoter.argoproj.io health checks #27170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
crenshaw-dev
merged 2 commits into
argoproj:master
from
crenshaw-dev:gitcommitstatus-health-check
Apr 13, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
resource_customizations/promoter.argoproj.io/ClusterScmProvider/health.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| local hs = {} | ||
| hs.status = "Progressing" | ||
| hs.message = "Initializing cluster SCM provider" | ||
|
|
||
| -- ClusterScmProvider (gitops-promoter v1alpha1): cluster-scoped SCM provider; same Ready semantics as ScmProvider. | ||
|
|
||
| if obj.metadata.deletionTimestamp then | ||
| hs.status = "Progressing" | ||
| hs.message = "ClusterScmProvider is being deleted" | ||
| return hs | ||
| end | ||
|
|
||
| if not obj.status then | ||
| return hs | ||
| end | ||
|
|
||
| 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 ClusterScmProvider spec update to be observed" | ||
| return hs | ||
| end | ||
| if condition.status == "False" then | ||
| hs.status = "Degraded" | ||
| local msg = condition.message or "Unknown error" | ||
| local reason = condition.reason or "Unknown" | ||
| if reason == "ReconciliationError" then | ||
| hs.message = "Cluster SCM provider validation failed: " .. msg | ||
| else | ||
| hs.message = "Cluster SCM provider not ready (" .. reason .. "): " .. msg | ||
| end | ||
| return hs | ||
| end | ||
| if condition.status == "Unknown" then | ||
| hs.status = "Progressing" | ||
| local msg = condition.message or "Unknown" | ||
| local reason = condition.reason or "Unknown" | ||
| hs.message = "Cluster SCM provider readiness unknown (" .. reason .. "): " .. msg | ||
| return hs | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| if not hasReadyCondition then | ||
| hs.status = "Progressing" | ||
| hs.message = "ClusterScmProvider Ready condition is missing" | ||
| return hs | ||
| end | ||
|
|
||
| hs.status = "Healthy" | ||
| hs.message = "Cluster SCM provider is ready" | ||
| return hs |
29 changes: 29 additions & 0 deletions
29
resource_customizations/promoter.argoproj.io/ClusterScmProvider/health_test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| tests: | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: Initializing cluster SCM provider | ||
| inputPath: testdata/no-status.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: ClusterScmProvider is being deleted | ||
| inputPath: testdata/deleting.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: Waiting for ClusterScmProvider spec update to be observed | ||
| inputPath: testdata/observed-generation-outdated.yaml | ||
| - healthStatus: | ||
| status: Degraded | ||
| message: "Cluster SCM provider validation failed: Reconciliation failed: invalid credentials" | ||
| inputPath: testdata/reconcile-error.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: ClusterScmProvider Ready condition is missing | ||
| inputPath: testdata/no-ready-condition.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: "Cluster SCM provider readiness unknown (ValidationPending): Probing SCM endpoint" | ||
| inputPath: testdata/ready-unknown.yaml | ||
| - healthStatus: | ||
| status: Healthy | ||
| message: Cluster SCM provider is ready | ||
| inputPath: testdata/healthy.yaml |
10 changes: 10 additions & 0 deletions
10
resource_customizations/promoter.argoproj.io/ClusterScmProvider/testdata/deleting.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: promoter.argoproj.io/v1alpha1 | ||
| kind: ClusterScmProvider | ||
| metadata: | ||
| name: github-enterprise | ||
| deletionTimestamp: "2025-07-04T12:00:00Z" | ||
| spec: | ||
| secretRef: | ||
| name: github-app-secret | ||
| github: | ||
| appID: 1 |
17 changes: 17 additions & 0 deletions
17
resource_customizations/promoter.argoproj.io/ClusterScmProvider/testdata/healthy.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| apiVersion: promoter.argoproj.io/v1alpha1 | ||
| kind: ClusterScmProvider | ||
| metadata: | ||
| name: github-enterprise | ||
| generation: 1 | ||
| spec: | ||
| secretRef: | ||
| name: github-app-secret | ||
| github: | ||
| appID: 1 | ||
| status: | ||
| conditions: | ||
| - type: Ready | ||
| status: "True" | ||
| reason: ReconciliationSuccess | ||
| message: Reconciliation successful | ||
| observedGeneration: 1 |
17 changes: 17 additions & 0 deletions
17
...e_customizations/promoter.argoproj.io/ClusterScmProvider/testdata/no-ready-condition.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| apiVersion: promoter.argoproj.io/v1alpha1 | ||
| kind: ClusterScmProvider | ||
| metadata: | ||
| name: github-enterprise | ||
| generation: 1 | ||
| spec: | ||
| secretRef: | ||
| name: github-app-secret | ||
| github: | ||
| appID: 1 | ||
| status: | ||
| conditions: | ||
| - type: Example | ||
| status: "True" | ||
| reason: Example | ||
| message: ok | ||
| observedGeneration: 1 |
9 changes: 9 additions & 0 deletions
9
resource_customizations/promoter.argoproj.io/ClusterScmProvider/testdata/no-status.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: promoter.argoproj.io/v1alpha1 | ||
| kind: ClusterScmProvider | ||
| metadata: | ||
| name: github-enterprise | ||
| spec: | ||
| secretRef: | ||
| name: github-app-secret | ||
| github: | ||
| appID: 1 |
17 changes: 17 additions & 0 deletions
17
...ations/promoter.argoproj.io/ClusterScmProvider/testdata/observed-generation-outdated.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| apiVersion: promoter.argoproj.io/v1alpha1 | ||
| kind: ClusterScmProvider | ||
| metadata: | ||
| name: github-enterprise | ||
| generation: 2 | ||
| spec: | ||
| secretRef: | ||
| name: github-app-secret | ||
| github: | ||
| appID: 1 | ||
| status: | ||
| conditions: | ||
| - type: Ready | ||
| status: "True" | ||
| reason: ReconciliationSuccess | ||
| message: Reconciliation successful | ||
| observedGeneration: 1 |
17 changes: 17 additions & 0 deletions
17
resource_customizations/promoter.argoproj.io/ClusterScmProvider/testdata/ready-unknown.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| apiVersion: promoter.argoproj.io/v1alpha1 | ||
| kind: ClusterScmProvider | ||
| metadata: | ||
| name: github-enterprise | ||
| generation: 1 | ||
| spec: | ||
| secretRef: | ||
| name: github-app-secret | ||
| github: | ||
| appID: 1 | ||
| status: | ||
| conditions: | ||
| - type: Ready | ||
| status: Unknown | ||
| reason: ValidationPending | ||
| message: Probing SCM endpoint | ||
| observedGeneration: 1 |
17 changes: 17 additions & 0 deletions
17
...urce_customizations/promoter.argoproj.io/ClusterScmProvider/testdata/reconcile-error.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| apiVersion: promoter.argoproj.io/v1alpha1 | ||
| kind: ClusterScmProvider | ||
| metadata: | ||
| name: github-enterprise | ||
| generation: 1 | ||
| spec: | ||
| secretRef: | ||
| name: github-app-secret | ||
| github: | ||
| appID: 1 | ||
| status: | ||
| conditions: | ||
| - type: Ready | ||
| status: "False" | ||
| reason: ReconciliationError | ||
| message: "Reconciliation failed: invalid credentials" | ||
| observedGeneration: 1 |
96 changes: 96 additions & 0 deletions
96
resource_customizations/promoter.argoproj.io/GitCommitStatus/health.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| local hs = {} | ||
| hs.status = "Progressing" | ||
| hs.message = "Initializing git commit validation" | ||
|
|
||
| -- GitCommitStatus (gitops-promoter) reports per-environment validation in status.environments | ||
| -- (branch, phase, proposedHydratedSha, targetedSha, expressionResult). It is not CommitStatus: | ||
| -- there is no top-level status.sha / status.phase. | ||
|
|
||
| if obj.metadata.deletionTimestamp then | ||
| hs.status = "Progressing" | ||
| hs.message = "GitCommitStatus is being deleted" | ||
| return hs | ||
| end | ||
|
|
||
| if not obj.status then | ||
| return hs | ||
| end | ||
|
|
||
| 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 GitCommitStatus spec update to be observed" | ||
| return hs | ||
| end | ||
| if condition.status == "False" then | ||
| hs.status = "Degraded" | ||
| local msg = condition.message or "Unknown error" | ||
| local reason = condition.reason or "Unknown" | ||
| if reason == "ReconciliationError" then | ||
| hs.message = "Git commit validation failed: " .. msg | ||
| else | ||
| hs.message = "Git commit validation not ready (" .. reason .. "): " .. msg | ||
| end | ||
| return hs | ||
| end | ||
| if condition.status == "Unknown" then | ||
| hs.status = "Progressing" | ||
| local msg = condition.message or "Unknown" | ||
| local reason = condition.reason or "Unknown" | ||
| hs.message = "Git commit validation status unknown (" .. reason .. "): " .. msg | ||
| return hs | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| if not hasReadyCondition then | ||
| hs.status = "Progressing" | ||
| hs.message = "GitCommitStatus Ready condition is missing" | ||
| return hs | ||
| end | ||
|
|
||
| local envs = obj.status.environments | ||
| if not envs or #envs == 0 then | ||
| hs.status = "Healthy" | ||
| hs.message = "Git commit validation reconciled" | ||
| return hs | ||
| end | ||
|
|
||
| local pendingBranches = {} | ||
| local failureBranches = {} | ||
| local successCount = 0 | ||
|
|
||
| for _, env in ipairs(envs) do | ||
| local branch = env.branch or "?" | ||
| local phase = env.phase or "pending" | ||
| if phase == "failure" then | ||
| table.insert(failureBranches, branch) | ||
| elseif phase == "pending" then | ||
| table.insert(pendingBranches, branch) | ||
| elseif phase == "success" then | ||
| successCount = successCount + 1 | ||
| else | ||
| table.insert(pendingBranches, branch) | ||
| end | ||
| end | ||
|
|
||
| if #failureBranches > 0 then | ||
| hs.status = "Degraded" | ||
| hs.message = "Git commit validation failed for branch(es): " .. table.concat(failureBranches, ", ") | ||
| return hs | ||
| end | ||
|
|
||
| if #pendingBranches > 0 then | ||
| hs.status = "Progressing" | ||
| hs.message = "Git commit validation pending for branch(es): " .. table.concat(pendingBranches, ", ") | ||
| return hs | ||
| end | ||
|
|
||
| hs.status = "Healthy" | ||
| hs.message = "Git commit validation passed for " .. tostring(successCount) .. " environment(s)" | ||
| return hs |
49 changes: 49 additions & 0 deletions
49
resource_customizations/promoter.argoproj.io/GitCommitStatus/health_test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| tests: | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: Initializing git commit validation | ||
| inputPath: testdata/no-status.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: GitCommitStatus is being deleted | ||
| inputPath: testdata/deleting.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: Waiting for GitCommitStatus spec update to be observed | ||
| inputPath: testdata/observed-generation-outdated.yaml | ||
| - healthStatus: | ||
| status: Degraded | ||
| message: "Git commit validation failed: Something went wrong" | ||
| inputPath: testdata/reconcile-error.yaml | ||
| - healthStatus: | ||
| status: Degraded | ||
| message: "Git commit validation not ready (CommitStatusesNotReady): CommitStatus \"git-commit-check-env-dev-git-commit-check\" is not Ready because \"ReconciliationError\": Failed to sync to SCM" | ||
| inputPath: testdata/commit-statuses-not-ready.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: GitCommitStatus Ready condition is missing | ||
| inputPath: testdata/no-ready-condition.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: "Git commit validation status unknown (CommitStatusesNotReady): CommitStatus \"child\" Ready condition is missing" | ||
| inputPath: testdata/ready-unknown.yaml | ||
| - healthStatus: | ||
| status: Healthy | ||
| message: Git commit validation reconciled | ||
| inputPath: testdata/empty-environments.yaml | ||
| - healthStatus: | ||
| status: Healthy | ||
| message: Git commit validation passed for 2 environment(s) | ||
| inputPath: testdata/all-success.yaml | ||
| - healthStatus: | ||
| status: Progressing | ||
| message: "Git commit validation pending for branch(es): env/dev" | ||
| inputPath: testdata/environment-pending.yaml | ||
| - healthStatus: | ||
| status: Degraded | ||
| message: "Git commit validation failed for branch(es): env/dev" | ||
| inputPath: testdata/environment-failure.yaml | ||
| - healthStatus: | ||
| status: Degraded | ||
| message: "Git commit validation failed: Reconciliation failed: failed to process environments: failed to evaluate expression for branch \"env/dev\": failed to compile expression: failed to compile expression: type string has no method startsWith (1:16)\n | Commit.Subject.startsWith(\"chore:\")\n | ...............^" | ||
| inputPath: testdata/expression-compile-error.yaml |
32 changes: 32 additions & 0 deletions
32
resource_customizations/promoter.argoproj.io/GitCommitStatus/testdata/all-success.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| apiVersion: promoter.argoproj.io/v1alpha1 | ||
| kind: GitCommitStatus | ||
| metadata: | ||
| name: gitcommitstatus-proposed-mode | ||
| generation: 1 | ||
| spec: | ||
| promotionStrategyRef: | ||
| name: promotion-strategy-sample | ||
| key: commit-format-check | ||
| description: Commit message format validation | ||
| target: proposed | ||
| expression: 'Commit.Subject matches "^(feat|fix|docs|chore)(\\(.+\\))?: .+"' | ||
| status: | ||
| conditions: | ||
| - type: Ready | ||
| status: "True" | ||
| reason: ReconciliationSuccess | ||
| message: Reconciliation successful | ||
| observedGeneration: 1 | ||
| environments: | ||
| - branch: env/dev | ||
| proposedHydratedSha: "0123456789abcdef0123456789abcdef01234567" | ||
| targetedSha: "0123456789abcdef0123456789abcdef01234567" | ||
| activeHydratedSha: "fedcba0987654321fedcba0987654321fedcba09" | ||
| phase: success | ||
| expressionResult: true | ||
| - branch: env/staging | ||
| proposedHydratedSha: "abcdef0123456789abcdef0123456789abcdef01" | ||
| targetedSha: "abcdef0123456789abcdef0123456789abcdef01" | ||
| activeHydratedSha: "0123456789abcdef0123456789abcdef01234567" | ||
| phase: success | ||
| expressionResult: true |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General question: What do you think if we add a comment to those health checks with at link to the Go type that they are based on? It could serve as a reference to CRD version that used to base the check. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I'm gonna open a follow up PR to add some nicer messages for finalizers, I'll add some comments with links in that PR.