Skip to content
Open
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
23 changes: 16 additions & 7 deletions pkg/checks/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ import (
)

type CheckUpdateOptions struct {
Dir string
OverrideVersion string
Logger *log.Logger
Dir string
OverrideVersion string
Logger *log.Logger
EnableDependencyCleanup bool
}

// SetupUpdate will create the options needed to call wolfictl update functions
Expand Down Expand Up @@ -240,11 +241,19 @@ func (o CheckUpdateOptions) processUpdates(ctx context.Context, latestVersions m
return err
}

// Skip any processing for definitions with a single pipeline
if len(updated.Pipeline) > 1 {
if err := o.updateGoBumpDeps(updated, o.Dir, packageName, mutations); err != nil {
return fmt.Errorf("error cleaning up go/bump deps: %v", err)
if o.EnableDependencyCleanup {
msg := fmt.Sprintf("cleaning up go/bump dependencies for %s. To disable, run command with --enable-dependency-cleanup=false", packageName)
log.Print(color.YellowString(msg))

// Skip any processing for definitions with a single pipeline
if len(updated.Pipeline) > 1 {
if err := o.updateGoBumpDeps(updated, tempDir, packageName, mutations); err != nil {
return fmt.Errorf("error cleaning up go/bump deps: %v", err)
}
}
} else {
msg := fmt.Sprintf("skip cleaning up go/bump dependencies for %s. To enable, run command with --enable-dependency-cleanup=true", packageName)
log.Print(color.YellowString(msg))
}

// if manual update is expected then let's not try to validate pipelines
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/check_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ func checkUpdateFlags(cmd *cobra.Command, o *checks.CheckUpdateOptions) {

cmd.Flags().StringVarP(&o.Dir, "directory", "d", cwd, "directory containing melange configs")
cmd.Flags().StringVarP(&o.OverrideVersion, "override-version", "", "", "override the local melange config version to test an update works as expected")
cmd.Flags().BoolVarP(&o.EnableDependencyCleanup, "enable-dependency-cleanup", "", false, "cleanup of dependencies after testing an update")
}