Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func run(cfg *Config) error {
cfg.Concurrency,
baseApps.SelectedApps,
targetApps.SelectedApps,
cfg.Repo,
)
} else {
// Extract resources from the cluster based on each branch, passing the manifests directly
Expand Down
21 changes: 21 additions & 0 deletions pkg/extract/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ func RenderApplicationsFromBothBranches(
return nil, nil, time.Since(startTime), err
}

if err := VerifyNoApplicationSets(baseApps); err != nil {
return nil, nil, time.Since(startTime), err
}

if err := VerifyNoApplicationSets(targetApps); err != nil {
return nil, nil, time.Since(startTime), err
}

// print how many applications are being rendered for each branch
log.Info().Msgf("📌 Final number of Applications planned to be rendered: [Base: %d], [Target: %d]", len(baseApps), len(targetApps))

Expand Down Expand Up @@ -461,6 +469,19 @@ func verifyNoDuplicateAppIds(apps []argoapplication.ArgoResource) error {
return nil
}

// VerifyNoApplicationSets returns an error if any of the supplied resources is
// an ApplicationSet. ApplicationSets must be converted to Applications by
// argoapplication.ConvertAppSetsToAppsInBothBranches before reaching the
// extract path; finding one here indicates a bug in the call chain.
func VerifyNoApplicationSets(apps []argoapplication.ArgoResource) error {
for _, app := range apps {
if app.Kind == argoapplication.ApplicationSet {
return fmt.Errorf("unexpected ApplicationSet %q reached the extract path — ApplicationSets must be converted to Applications before rendering", app.GetLongName())
}
}
return nil
}

func labelApplicationWithRunID(a *argoapplication.ArgoResource, runID string) error {
labels := a.Yaml.GetLabels()
if labels == nil {
Expand Down
Loading