githelper

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGitHostname added in v0.8.0

func BuildGitHostname(ns string) (string, error)

BuildGitHostname builds the hostname of a cluster-local git repo from the provided namespace.

func CreateKnownHosts added in v0.6.0

func CreateKnownHosts(path string, host string) (string, error)

CreateKnownHosts works around https://github.com/go-git/go-git/issues/411

func GetExternalRepoAddr added in v0.8.0

func GetExternalRepoAddr(env *testenv.Env, port int, repoName string) (string, error)

GetExternalRepoAddr retrieves the external URL where our local git server can be reached, based on the provided port and repo name.

Types

type Git

type Git struct {
	User   string
	Branch string
	Auth   gitAuth
}

Git represents a git repo with auth.

func NewHTTP added in v0.8.0

func NewHTTP(addr string) *Git

NewHTTP creates a new Git instance with HTTP auth, using environment variables.

func NewSSH added in v0.8.0

func NewSSH() *Git

NewSSH creates a new Git instance with SSH auth, using environment variables.

func (*Git) CheckoutRemote added in v0.9.1

func (g *Git) CheckoutRemote(repo *git.Repository, branch string) error

Checkouts the specified remote branch from the given repository

func (*Git) Create

func (g *Git) Create(repodir string, from string, subdir string) (*git.Repository, error)

Create creates a git repository at the specified repodir, with contents from `from/subdir`, and sets a remote using g's URL.

func (*Git) GetInClusterURL added in v0.8.0

func (g *Git) GetInClusterURL(host string, port int, repoName string) string

func (*Git) GetURL added in v0.8.0

func (g *Git) GetURL() string

func (*Git) Update

func (g *Git) Update(repo *git.Repository) (string, error)

Update commits and pushes the current state of the worktree to the remote.

type HTTPAuth added in v0.8.0

type HTTPAuth struct {
	URL      string
	Username string
	Password string
}

type SSHAuth added in v0.8.0

type SSHAuth struct {
	URL       string
	User      string
	SSHKey    string
	SSHPubKey string
}

Jump to

Keyboard shortcuts

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