Skip to content
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

Skipping disabled components on atmos describe afffected #942

Merged
merged 6 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions internal/exec/describe_affected_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ func findAffected(
continue
}
}
// Use helper function to skip disabled components
if !isComponentEnabled(metadataSection, componentName, atmosConfig) {
continue
}
// Check `metadata` section
if !isEqual(remoteStacks, stackName, "terraform", componentName, metadataSection, "metadata") {
affected := schema.Affected{
Expand Down Expand Up @@ -793,6 +797,10 @@ func findAffected(
continue
}
}
// Use helper function to skip disabled components
if !isComponentEnabled(metadataSection, componentName, atmosConfig) {
continue
}
// Check `metadata` section
if !isEqual(remoteStacks, stackName, "helmfile", componentName, metadataSection, "metadata") {
affected := schema.Affected{
Expand Down Expand Up @@ -1512,3 +1520,14 @@ func processIncludedInDependenciesForDependents(dependents *[]schema.Dependent,
}
return false
}

// isComponentEnabled checks if a component is enabled based on its metadata
func isComponentEnabled(metadataSection map[string]any, componentName string, atmosConfig schema.AtmosConfiguration) bool {
if enabled, ok := metadataSection["enabled"].(bool); ok {
if !enabled {
u.LogTrace(atmosConfig, fmt.Sprintf("Skipping disabled component %s", componentName))
return false
}
}
return true
}
Loading