git

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchShas

type BranchShas struct {
	Dry      string
	Hydrated string
}

type GitOperations

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

func NewGitOperations

func NewGitOperations(ctx context.Context, k8sClient client.Client, gap scms.GitOperationsProvider, repoRef v1alpha1.ObjectReference, obj v1.Object, pathConext string) (*GitOperations, error)

func (*GitOperations) CloneRepo

func (g *GitOperations) CloneRepo(ctx context.Context) error

CloneRepo clones the gitRepo to a temporary directory if needed does nothing if the repo is already cloned.

func (*GitOperations) GetBranchShas

func (g *GitOperations) GetBranchShas(ctx context.Context, branch string) (BranchShas, error)

func (*GitOperations) GetShaAuthor added in v0.6.0

func (g *GitOperations) GetShaAuthor(ctx context.Context, sha string) (string, error)

func (*GitOperations) GetShaBody added in v0.6.0

func (g *GitOperations) GetShaBody(ctx context.Context, sha string) (string, error)

GetShaBody retrieves the body of a commit given its SHA.

func (*GitOperations) GetShaMetadataFromFile added in v0.6.0

func (g *GitOperations) GetShaMetadataFromFile(ctx context.Context, sha string) (v1alpha1.CommitShaState, error)

func (*GitOperations) GetShaMetadataFromGit added in v0.6.0

func (g *GitOperations) GetShaMetadataFromGit(ctx context.Context, sha string) (v1alpha1.CommitShaState, error)

func (*GitOperations) GetShaSubject added in v0.6.0

func (g *GitOperations) GetShaSubject(ctx context.Context, sha string) (string, error)

func (*GitOperations) GetShaTime

func (g *GitOperations) GetShaTime(ctx context.Context, sha string) (v1.Time, error)

func (*GitOperations) HasConflict added in v0.5.0

func (g *GitOperations) HasConflict(ctx context.Context, proposedBranch, activeBranch string) (bool, error)

HasConflict checks if there is a merge conflict between the proposed branch and the active branch. It assumes that origin/<branch> is currently fetched and updated in the local repository. This should happen via GetBranchShas function earlier in the reconcile.

func (*GitOperations) IsPullRequestRequired

func (g *GitOperations) IsPullRequestRequired(ctx context.Context, environmentNextBranch, environmentBranch string) (bool, error)

IsPullRequestRequired will compare the environment branch with the next environment branch and return true if a PR is required. The PR is required if the diff between the two branches contain edits to yaml files.

func (*GitOperations) LsRemote

func (g *GitOperations) LsRemote(ctx context.Context, branch string) (string, error)

func (*GitOperations) MergeWithOursStrategy added in v0.5.0

func (g *GitOperations) MergeWithOursStrategy(ctx context.Context, proposedBranch, activeBranch string) error

func (*GitOperations) PromoteEnvironmentWithMerge

func (g *GitOperations) PromoteEnvironmentWithMerge(ctx context.Context, environmentBranch, environmentNextBranch string) error

type HydratorMetadata added in v0.6.0

type HydratorMetadata struct {
	// RepoURL is the URL of the repository where the commit is located.
	RepoURL string `json:"repoURL,omitempty"`
	// DrySha is the SHA of the commit that was used as the dry source for hydration.
	DrySha string `json:"drySha,omitempty"`
	// Author is the author of the dry commit that was used to hydrate the branch.
	Author string `json:"author,omitempty"`
	// Date is the date of the dry commit that was used to hydrate the branch.
	Date v1.Time `json:"date,omitempty"`
	// Subject is the subject line of the dry commit that was used to hydrate the branch.
	Subject string `json:"subject,omitempty"`
	// Body is the body of the dry commit that was used to hydrate the branch without the subject.
	Body string `json:"body,omitempty"`
	// References are the references to other commits, that went into the hydration of the branch.
	References []v1alpha1.RevisionReference `json:"references,omitempty"`
}

HydratorMetadata contains metadata about the commit that is used to hydrate a branch. It is used to store

Jump to

Keyboard shortcuts

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