Skip to content
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
10 changes: 6 additions & 4 deletions internal/validate/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ type GitHub struct {
}

type Insight struct {
Title string `yaml:"title"`
DataSeries []map[string]any `yaml:"dataSeries"`
Title string `yaml:"title"`
DataSeries []map[string]any `yaml:"dataSeries"`
DeleteWhenDone bool `yaml:"deleteWhenDone"`
}

type ValidationSpec struct {
Expand Down Expand Up @@ -114,6 +115,7 @@ func DefaultConfig() *ValidationSpec {
"timeScopeValue": 1,
},
},
DeleteWhenDone: true,
},
}
}
Expand Down Expand Up @@ -171,7 +173,7 @@ func Validate(ctx context.Context, client api.Client, config *ValidationSpec) er

cloned, err := repoCloneTimeout(ctx, client, config.ExternalService)
if err != nil {
return err //TODO make sure errors are wrapped once
return err
}
if !cloned {
return errors.Newf("%s validate failed, repo did not clone\n", validate.FailureEmoji)
Expand Down Expand Up @@ -207,7 +209,7 @@ func Validate(ctx context.Context, client api.Client, config *ValidationSpec) er
log.Printf("%s insight successfully added", validate.SuccessEmoji)

defer func() {
if insightId != "" {
if insightId != "" && config.Insight.DeleteWhenDone {
_ = removeInsight(ctx, client, insightId)
log.Printf("%s insight %s has been removed", validate.SuccessEmoji, config.Insight.Title)

Expand Down