Documentation
¶
Index ¶
- func BranchRefName(branch string) string
- func CheckoutBranch(g *WithT, repo *extgogit.Repository, branch string)
- func Clone(ctx context.Context, repoURL, branchName, remote string) (*extgogit.Repository, string, error)
- func CommitIdFromBranch(repo *extgogit.Repository, branchName string) string
- func CommitInRepo(ctx context.Context, g *WithT, repoURL, branch, remote, msg string, ...) plumbing.Hash
- func CommitWorkDir(g *WithT, repo *extgogit.Repository, branchName, message string) plumbing.Hash
- func ExpectMatchingDirectories(g *WithT, actualRoot, expectedRoot string)
- func GetRemoteHead(repo *extgogit.Repository, branchName, remote string) (plumbing.Hash, error)
- func GetSSHSigningKey(g *WithT, passphrase string) ([]byte, gossh.PublicKey)
- func GetSSHSigningKeyECDSAP256(g *WithT, passphrase string) ([]byte, gossh.PublicKey)
- func GetSSHSigningKeySecret(g *WithT, name, namespace string) (*corev1.Secret, gossh.PublicKey)
- func GetSigningKeyPair(g *WithT, passphrase string) (*openpgp.Entity, []byte)
- func GetSigningKeyPairSecret(g *WithT, name, namespace string) (*corev1.Secret, *openpgp.Entity)
- func HeadFromBranch(repo *extgogit.Repository, branchName string) (*object.Commit, error)
- func ImageToRef(image string) *reflectorv1.ImageRef
- func InitGitRepo(g *WithT, gitServer *gittestserver.GitServer, fixture, branch, repoPath string) *extgogit.Repository
- func InitGitRepoPlain(g *WithT, fixture, repoPath string) *extgogit.Repository
- func ReplaceMarker(path string, policyKey types.NamespacedName) error
- func ReplaceMarkerWithMarker(path string, policyKey types.NamespacedName, marker string) error
- func SetUpGitTestServer(g *WithT) *gittestserver.GitServer
- func TagCommit(g *WithT, repo *extgogit.Repository, commit plumbing.Hash, annotated bool, ...) (*plumbing.Reference, error)
- func WaitForNewHead(g *WithT, repo *extgogit.Repository, branch, remote, preChangeHash string)
- type Diff
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BranchRefName ¶
func CheckoutBranch ¶
func CheckoutBranch(g *WithT, repo *extgogit.Repository, branch string)
func CommitIdFromBranch ¶
func CommitIdFromBranch(repo *extgogit.Repository, branchName string) string
func CommitInRepo ¶
func CommitWorkDir ¶
func CommitWorkDir(g *WithT, repo *extgogit.Repository, branchName, message string) plumbing.Hash
func ExpectMatchingDirectories ¶ added in v1.0.0
func ExpectMatchingDirectories(g *WithT, actualRoot, expectedRoot string)
ExpectMatchingDirectories compares two directories, recursively, and expects them to match. It will fail if there are files that are present in one directory but not the other, or if files that are present in both directories have different contents.
func GetRemoteHead ¶
func GetSSHSigningKey ¶ added in v1.2.0
GetSSHSigningKey generates an ed25519 SSH keypair and returns the PEM-encoded private key plus the matching gossh.PublicKey for use in signature verification assertions. If passphrase is non-empty, the returned PEM is encrypted with it.
func GetSSHSigningKeyECDSAP256 ¶ added in v1.2.0
GetSSHSigningKeyECDSAP256 mirrors GetSSHSigningKey but generates an ecdsa-sha2-nistp256 key. Exercises the non-ed25519 signing path.
func GetSSHSigningKeySecret ¶ added in v1.2.0
GetSSHSigningKeySecret returns a corev1.Secret in the shape the controller expects for SSH signing: 'identity' holds the PEM-encoded private key, 'password' holds the passphrase.
func GetSigningKeyPair ¶
func GetSigningKeyPairSecret ¶
func HeadFromBranch ¶
func ImageToRef ¶ added in v0.41.0
func ImageToRef(image string) *reflectorv1.ImageRef
func InitGitRepo ¶
func InitGitRepo(g *WithT, gitServer *gittestserver.GitServer, fixture, branch, repoPath string) *extgogit.Repository
Initialise a git server with a repo including the files in dir.
func InitGitRepoPlain ¶
func InitGitRepoPlain(g *WithT, fixture, repoPath string) *extgogit.Repository
func ReplaceMarker ¶
func ReplaceMarker(path string, policyKey types.NamespacedName) error
func ReplaceMarkerWithMarker ¶
func ReplaceMarkerWithMarker(path string, policyKey types.NamespacedName, marker string) error
func SetUpGitTestServer ¶
func SetUpGitTestServer(g *WithT) *gittestserver.GitServer
SetUpGitTestServer creates and returns a git test server. The caller must ensure it's stopped and cleaned up.
func WaitForNewHead ¶
func WaitForNewHead(g *WithT, repo *extgogit.Repository, branch, remote, preChangeHash string)
Types ¶
type Diff ¶ added in v1.0.0
type Diff interface {
Path() string
FailedExpectation(g *WithT)
}
func DiffDirectories ¶ added in v1.0.0
func DiffDirectories(actual, expected string) (actualonly []string, expectedonly []string, different []Diff)
DiffDirectories walks the two given directories, recursively, and reports relative paths for any files that are:
(in actual but not expected, in expected but not actual, in both but different)
It ignores dot directories (e.g., `.git/`) and Emacs backups (e.g., `foo.yaml~`). It panics if it encounters any error apart from a file not found.