migrate

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MPL-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conflict

type Conflict struct {
	Context     string
	KeyPath     string
	SourceValue any
	SourceFile  string
	ValuesValue any
	ValuesFile  string
}

Conflict is a key that holds different values in a v1alpha1 source and in values.yaml.

type FileWrite

type FileWrite struct {
	Path string
	Data []byte
}

FileWrite is a file that Apply writes, with the planned content.

type Migrator

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator reads and writes the files of a project through its shims.

func NewMigrator

func NewMigrator(s *shims.Shims) *Migrator

NewMigrator creates a Migrator. A nil argument selects the real file system.

func (*Migrator) Apply

func (m *Migrator) Apply(plan *Plan) error

Apply writes the files of a plan and deletes the context windsor.yaml files. It writes the root file last, so that a failure leaves a project that migrate can read again. A plan with conflicts writes nothing and returns an error.

func (*Migrator) LegacyFiles

func (m *Migrator) LegacyFiles(projectRoot string) []string

LegacyFiles lists the v1alpha1 files of a project. They are the root windsor.yaml when its version is v1alpha1 or missing, and each contexts/<name>/windsor.yaml or windsor.yml. It returns nil when the project holds none.

func (*Migrator) Plan

func (m *Migrator) Plan(projectRoot string) (*Plan, error)

Plan reads the v1alpha1 sources of the project and compares them with each values.yaml. For each context it merges the root contexts.<name> map and then contexts/<name>/windsor.yaml. It maps provider to platform, and copies a root terraform.driver into every context. A key that only the sources hold is added to values.yaml. A key with a different value is a conflict. A root key other than version, environment, paths, contexts, and terraform.driver fails the plan.

type Plan

type Plan struct {
	Writes    []FileWrite
	Deletes   []string
	Conflicts []Conflict
}

Plan is the result of reading a project. It lists the files to write and delete and the conflicts that stop the migration. A plan with conflicts writes nothing.

func (*Plan) Empty

func (p *Plan) Empty() bool

Empty reports whether the plan has nothing to write or delete and no conflict.

func (*Plan) Format

func (p *Plan) Format(dryRun bool) string

Format returns the text that migrate prints for a plan. It lists each conflict with the key path, both values, and both file names. Without conflicts it lists the files to write and delete. A dry run words the list as a plan.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL