commit

package
v3.3.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoteNamespace = "hydrator.metadata" // NoteNamespace is the custom git notes namespace used by the hydrator to store and retrieve commit-related metadata.
	ManifestYaml  = "manifest.yaml"     // ManifestYaml constant for the manifest yaml
)

Variables

This section is empty.

Functions

func AddNote

func AddNote(gitClient git.Client, drySha, commitSha string) error

AddNote attaches a commit note containing the specified dry SHA (`drySha`) to the given commit (`commitSha`) in the configured note namespace. The note is marshaled as JSON and pushed to the remote repository using the provided gitClient. Returns an error if marshalling or note addition fails.

func IsHydrated

func IsHydrated(gitClient git.Client, drySha, commitSha string) (bool, error)

IsHydrated checks whether the given commit (commitSha) has already been hydrated with the specified Dry SHA (drySha). It does this by retrieving the commit note in the NoteNamespace and examining the DrySHA value. Returns true if the stored DrySHA matches the provided drySha, false if not or if no note exists. Gracefully handles missing notes as a normal outcome (not an error), but returns an error on retrieval or parse failures.

func WriteForPaths

func WriteForPaths(root *os.Root, repoUrl, drySha string, dryCommitMetadata *appv1.RevisionMetadata, paths []*apiclient.PathDetails, gitClient git.Client) (bool, error)

WriteForPaths writes the manifests, hydrator.metadata, and README.md files for each path in the provided paths. It also writes a root-level hydrator.metadata file containing the repo URL and dry SHA.

Types

type CommitNote

type CommitNote struct {
	DrySHA string `json:"drySha"` // SHA of original commit that triggerd the hydrator
}

CommitNote represents the structure of the git note associated with a hydrated commit. This struct is used to serialize/deserialize commit metadata (such as the dry run SHA) stored in the custom note namespace by the hydrator.

type RepoClientFactory

type RepoClientFactory interface {
	NewClient(repo *v1alpha1.Repository, rootPath string) (git.Client, error)
}

RepoClientFactory is a factory for creating git clients for a repository.

func NewRepoClientFactory

func NewRepoClientFactory(gitCredsStore git.CredsStore, metricsServer *metrics.Server) RepoClientFactory

NewRepoClientFactory returns a new instance of the repo client factory.

type Service

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

Service is the service that handles commit requests.

func NewService

func NewService(gitCredsStore git.CredsStore, metricsServer *metrics.Server) *Service

NewService returns a new instance of the commit service.

func (*Service) CommitHydratedManifests

CommitHydratedManifests handles a commit request. It clones the repository, checks out the sync branch, checks out the target branch, clears the repository contents, writes the manifests to the repository, commits the changes, and pushes the changes. It returns the hydrated revision SHA and an error if one occurred.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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