update

package
v0.0.0-...-c7d747a Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 26 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

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 kptfilev1.UpdateStrategyType
	// contains filtered or unexported fields
}

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

func (Command) GetCachedUpstreamRepos

func (u Command) GetCachedUpstreamRepos() map[string]*gitutil.GitUpstreamRepo

GetCachedUpstreamRepos returns repos cached during update

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 Options) error

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

type Options

type Options 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 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 Options) 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 Options) error

type Updater

type Updater interface {
	Update(options Options) error
}

Updater updates a local package

Jump to

Keyboard shortcuts

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