Documentation
¶
Overview ¶
Package update contains libraries for updating packages.
Index ¶
- func GetUpdater(strategy string) updatetypes.Updater
- func PkgHasUpdatedUpstream(local, origin string) (bool, error)
- func ReplaceNonKRMFiles(updatedDir, originalDir, localDir string) error
- type Command
- type CopyMergeUpdater
- type FastForwardUpdater
- type Options
- type PkgNotGitRepoError
- type PkgRepoDirtyError
- type PruningLocalPackageReader
- type ReplaceUpdater
- type ResourceMergeUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUpdater ¶
func GetUpdater(strategy string) updatetypes.Updater
func PkgHasUpdatedUpstream ¶
PkgHasUpdatedUpstream checks if the the local package has different upstream information than origin.
func ReplaceNonKRMFiles ¶
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]*internalgitutil.GitUpstreamRepo
GetCachedUpstreamRepos returns repos cached during update
type CopyMergeUpdater ¶
type CopyMergeUpdater struct{}
CopyMergeUpdater is responsible for synchronizing the destination package with the source package by updating the Kptfile and copying and replacing package contents.
func (CopyMergeUpdater) Update ¶
func (u CopyMergeUpdater) Update(options updatetypes.Options) error
Update synchronizes the destination/local package with the source/update package by updating the Kptfile and copying package contents. It deletes resources from the destination package if they were present in the original package, but not present anymore in the source package. It takes an Options struct as input, which specifies the paths and other parameters for the update operation. Returns an error if the update fails.
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 updatetypes.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 kptfilev1.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 kptfilev1.UniquePath
}
PkgRepoDirtyError is the error type returned if the package being updated contains uncommitted changes.
func (*PkgRepoDirtyError) Error ¶
func (p *PkgRepoDirtyError) Error() string
type PruningLocalPackageReader ¶
type PruningLocalPackageReader struct {
LocalPackageReader kio.LocalPackageReader
Exclusions []string
}
PruningLocalPackageReader implements the Reader interface. It is similar to the LocalPackageReader but allows for exclusion of subdirectories.
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 updatetypes.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 updatetypes.Options) error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package merge3 executes a 3-way merge update
|
Package merge3 executes a 3-way merge update |
|
Package updatetypes holds the exposed types for updates in kpt
|
Package updatetypes holds the exposed types for updates in kpt |