git

package
v3.10.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckoutSource

func CheckoutSource(source *Source, secrets map[string]string) (string, error)

CheckoutSource checks out a git repo (source) into a local temp directory. It will return the source of the local repo an an error if one occured. Secrets can optionally be passed if the repo is private.

func GetRepoRoot

func GetRepoRoot(fullPath string) (string, error)

GetRepoRoot determines the repo root from a full path. Returns empty string and no error if not found

func IsLocal

func IsLocal(workDir, source string, pathExistsFunc ...func(path string) (bool, error)) (bool, string)

IsLocal tries returns true and full path of directory if the path is a local one, and false and empty string if not.

func Uncompress

func Uncompress(src string, dst string) error

Uncompress is a modified version of: https://gist.github.com/mimoo/25fc9716e0f1353791f5908f94d6e726

Types

type Gitter

type Gitter interface {
	Checkout(repo, branchOrCommit string) error
	RepoDir() string
}

func NewGitter

func NewGitter(secrets map[string]string) Gitter

type Source

type Source struct {
	// is it a local folder intended for a local runtime?
	Local bool
	// absolute path to service folder in local mode
	FullPath string
	// path of folder to repo root
	// be it local or github repo
	Folder string
	// github ref
	Ref string
	// for cloning purposes
	// blank for local
	Repo string
	// dir to repo root
	// blank for non local
	LocalRepoRoot string
}

Source is not just git related @todo move

func ParseSource

func ParseSource(source string) (*Source, error)

ParseSource parses a `micro run/update/kill` source.

func ParseSourceLocal

func ParseSourceLocal(workDir, source string, pathExistsFunc ...func(path string) (bool, error)) (*Source, error)

ParseSourceLocal a version of ParseSource that detects and handles local paths. Workdir should be used only from the CLI @todo better interface for this function. PathExistsFunc exists only for testing purposes, to make the function side effect free.

func (*Source) RuntimeName

func (s *Source) RuntimeName() string

Name to be passed to RPC call runtime.Create Update Delete eg: `helloworld/api`, `crufter/myrepo/helloworld/api`, `localfolder`

func (*Source) RuntimeSource

func (s *Source) RuntimeSource() string

Source to be passed to RPC call runtime.Create Update Delete eg: `helloworld`, `github.com/crufter/myrepo/helloworld`, `/path/to/localrepo/localfolder`

Jump to

Keyboard shortcuts

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