update

package
v1.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package update contains libraries for updating packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PkgHasUpdatedUpstream

func PkgHasUpdatedUpstream(local, origin string) (bool, error)

PkgHasUpdatedUpstream checks if the the local package has different upstream information than origin.

func ReplaceNonKRMFiles added in v0.18.0

func ReplaceNonKRMFiles(updatedDir, originalDir, localDir string) error

replaceNonKRMFiles replaces the non KRM files in localDir with the corresponding files in updatedDir, it also deletes non KRM files and sub dirs which are present in localDir and not in updatedDir

Types

type Command

type Command struct {
	// Pkg captures information about the package that should be updated.
	Pkg *pkg.Pkg

	// Ref is the ref to update to
	Ref string

	// Strategy is the update strategy to use
	Strategy kptfilev1alpha2.UpdateStrategyType
}

Command updates the contents of a local package to a different version.

func (Command) Run

func (u Command) Run(ctx context.Context) error

Run runs the Command.

type FastForwardUpdater

type FastForwardUpdater struct{}

Updater updates a package to a new upstream version.

If the package at pkgPath differs from the upstream ref it was fetch from, then Update will fail without making any changes.

func (FastForwardUpdater) Update

func (u FastForwardUpdater) Update(options UpdateOptions) error

We should try to pull the common code up into the Update command.

type PkgNotGitRepoError

type PkgNotGitRepoError struct {
	Path types.UniquePath
}

PkgNotGitRepoError is the error type returned if the package being updated is not inside a git repository.

func (*PkgNotGitRepoError) Error

func (p *PkgNotGitRepoError) Error() string

type PkgRepoDirtyError

type PkgRepoDirtyError struct {
	Path types.UniquePath
}

PkgRepoDirtyError is the error type returned if the package being updated contains uncommitted changes.

func (*PkgRepoDirtyError) Error

func (p *PkgRepoDirtyError) Error() string

type ReplaceUpdater

type ReplaceUpdater struct{}

Updater updates a package to a new upstream version.

If the package at pkgPath differs from the upstream ref it was fetch from, then Update will delete the local package. This will wipe all local changes.

func (ReplaceUpdater) Update

func (u ReplaceUpdater) Update(options UpdateOptions) error

type ResourceMergeUpdater

type ResourceMergeUpdater struct{}

ResourceMergeUpdater updates a package by fetching the original and updated source packages, and performing a 3-way merge of the Resources.

func (ResourceMergeUpdater) Update

func (u ResourceMergeUpdater) Update(options UpdateOptions) error

type UpdateOptions

type UpdateOptions struct {
	// RelPackagePath is the relative path of a subpackage to the root. If the
	// package is root, the value here will be ".".
	RelPackagePath string

	// LocalPath is the absolute path to the package on the local fork.
	LocalPath string

	// OriginPath is the absolute path to the package in the on-disk clone
	// of the origin ref of the repo.
	OriginPath string

	// UpdatedPath is the absolute path to the package in the on-disk clone
	// of the updated ref of the repo.
	UpdatedPath string

	// IsRoot is true if the package is the root, i.e. the clones of
	// updated and origin were fetched based on the information in the
	// Kptfile from this package.
	IsRoot bool
}

type Updater

type Updater interface {
	Update(options UpdateOptions) error
}

Updater updates a local package

Jump to

Keyboard shortcuts

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