Documentation
¶
Index ¶
- func CollectManifestFiles(vendorFile string) ([]string, error)
- func ComponentVersionPath(vendorFile, component string) (string, error)
- func Diff(atmosConfig *schema.AtmosConfiguration, params *DiffParams) (string, error)
- func FindSource(files []string, component string) (*schema.AtmosVendorSource, string, error)
- func SetComponentVersion(vendorFile, component, version string) error
- type DiffParams
- type GitDiffer
- type GoGitDiffer
- type SourceUpdateResult
- type UpdateParams
- type UpdateReport
- type UpdateStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectManifestFiles ¶
CollectManifestFiles returns the ordered list of physical vendor manifest files reachable from vendorFile: the file itself followed by the files it imports (resolved relative to each importing file's directory, recursively and de-duplicated). Editing operates on these concrete files so changes land in the file that declares each source.
func ComponentVersionPath ¶
ComponentVersionPath resolves the dot-notation path addressing a component's pinned version in a vendor manifest file (e.g. "spec.sources[2].version"). The source is matched by component name, so manifest ordering does not matter; the returned path reflects the component's current array index. Returns an error wrapping atmosyaml.ErrYAMLPathNotFound if the component is not declared in the manifest.
func Diff ¶
func Diff(atmosConfig *schema.AtmosConfiguration, params *DiffParams) (string, error)
Diff returns a unified diff between two versions of a vendored Git component.
func FindSource ¶
FindSource scans the given manifest files for a source declaring component and returns it along with the file that declares it.
func SetComponentVersion ¶
SetComponentVersion sets the version for a component in a vendor manifest file, preserving comments/anchors/formatting. The edit targets the matching source by component name (not by index), so reordering the manifest is safe. Returns an error wrapping atmosyaml.ErrYAMLPathNotFound if the component is not declared in the manifest.
Types ¶
type DiffParams ¶
type DiffParams struct {
// Source is the Git source URL of the component.
Source string
// From is the starting ref; defaults to the component's current pinned version.
From string
// To is the ending ref; when empty, the latest semver tag is used.
To string
// File optionally restricts the diff to a single path.
File string
// Lister resolves the latest tag when To is empty; defaults to version.DefaultLister.
Lister version.RemoteLister
// Differ performs the clone+diff; defaults to DefaultDiffer.
Differ GitDiffer
}
DiffParams configures a vendor diff.
type GitDiffer ¶
type GitDiffer interface {
Diff(ctx context.Context, gitURI, fromRef, toRef, file string) (string, error)
}
GitDiffer produces a unified diff between two refs of a remote Git repository. It is an interface so the diff command can be unit-tested without network.
var DefaultDiffer GitDiffer = &GoGitDiffer{}
DefaultDiffer is the production GitDiffer backed by go-git.
type GoGitDiffer ¶
type GoGitDiffer struct{}
GoGitDiffer clones a repository (with tags, no checkout) into a temp directory and produces a patch between two commits using go-git — no `git` binary.
type SourceUpdateResult ¶
type SourceUpdateResult struct {
File string
Component string
CurrentVersion string
LatestVersion string
Status UpdateStatus
Reason string // Populated for StatusSkipped and StatusFailed.
}
SourceUpdateResult is the per-source outcome of an update run.
type UpdateParams ¶
type UpdateParams struct {
// VendorFiles are the physical manifest files to process (a vendor.yaml plus
// any imported files). Edits are applied to the file that declares each source.
VendorFiles []string
// Component, when set, restricts updates to that component.
Component string
// Tags, when set, restricts updates to sources carrying any of these tags.
Tags []string
// Type, when set, restricts updates to sources targeting components of this type.
Type string
// DryRun reports what would change without writing files.
DryRun bool
// Lister lists remote tags; defaults to version.DefaultLister when nil.
Lister version.RemoteLister
}
UpdateParams configures an update run.
type UpdateReport ¶
type UpdateReport struct {
Results []SourceUpdateResult
}
UpdateReport summarizes an update run.
func Update ¶
func Update(atmosConfig *schema.AtmosConfiguration, params *UpdateParams) (*UpdateReport, error)
Update checks each Git-backed source for a newer allowed version and updates the version field in place (preserving comments, anchors, and templates), unless DryRun is set. Non-Git and templated-version sources are skipped.
func (*UpdateReport) UpdatedCount ¶
func (r *UpdateReport) UpdatedCount() int
UpdatedCount returns how many sources were (or would be) updated.
type UpdateStatus ¶
type UpdateStatus string
UpdateStatus enumerates the outcome for a single source in an update run.
const ( // StatusUpdated means the source's version was (or would be) changed. StatusUpdated UpdateStatus = "updated" // StatusUpToDate means the source already pins the latest allowed version. StatusUpToDate UpdateStatus = "up-to-date" // StatusSkipped means the source was not checked (templated, non-Git, etc.). StatusSkipped UpdateStatus = "skipped" // StatusFailed means the source could not be checked or updated because of a hard error. StatusFailed UpdateStatus = "failed" )
Directories
¶
| Path | Synopsis |
|---|---|
|
Package version resolves the latest allowed upstream version for a vendored Git source: it lists remote tags, parses semantic versions, and applies the configured version constraints.
|
Package version resolves the latest allowed upstream version for a vendored Git source: it lists remote tags, parses semantic versions, and applies the configured version constraints. |