Skip to content

Commit

Permalink
Decouple running deprecated migrations and adding package warnings fr…
Browse files Browse the repository at this point in the history
…om readZarfYAML

The goal here is separation of concerns
  • Loading branch information
Lucas Rodriguez committed Jan 11, 2024
1 parent 83a3cf2 commit f8e6569
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pkg/packager/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ func (p *Packager) Deploy() (err error) {
return err
}

p.runMigrations()

if err := p.validateLastNonBreakingVersion(); err != nil {
return err
}
Expand Down
19 changes: 19 additions & 0 deletions src/pkg/packager/migrate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2021-Present The Zarf Authors

// Package packager contains functions for interacting with, managing and deploying Zarf packages.
package packager

import "github.com/defenseunicorns/zarf/src/pkg/packager/deprecated"

func (p *Packager) runMigrations() {
var warnings []string

if len(p.cfg.Pkg.Build.Migrations) > 0 {
for idx, component := range p.cfg.Pkg.Components {
// Handle component configuration deprecations
p.cfg.Pkg.Components[idx], warnings = deprecated.MigrateComponent(p.cfg.Pkg.Build, component)
p.warnings = append(p.warnings, warnings...)
}
}
}

0 comments on commit f8e6569

Please sign in to comment.