vcs

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneGitRepo

func CloneGitRepo(ctx context.Context, link, dir string, skipTLSVerify bool) (*git.Repository, error)

CloneGitRepo clones a git repository to a specific directory.

func GetGitRepoVersions

func GetGitRepoVersions(r *git.Repository) ([]*version.Version, error)

GetGitRepoVersions returns all versions of a git repository in descending order.

func GetGitSource

func GetGitSource(link string) (string, error)

GetGitSource get git source for template. When source's protocol is http or https, the prefix git:: will be added for template to use.

func GetOrgFromGitURL added in v0.3.1

func GetOrgFromGitURL(source string) (string, error)

GetOrgFromGitURL parses the organization from the given URL.

func GetOrgRepos added in v0.3.1

func GetOrgRepos(ctx context.Context, client *scm.Client, orgName string) ([]*scm.Repository, error)

GetOrgRepos returns full repositories list from the given org.

func GetRepoRef

func GetRepoRef(r *git.Repository, name string) (*plumbing.Reference, error)

GetRepoRef returns a reference from a git repository.

func HardResetGitRepo

func HardResetGitRepo(r *git.Repository, ref string) error

HardResetGitRepo hard resets a git repository to a specific hash.

func NewClient

func NewClient(conn *model.Connector, opts ...options.ClientOption) (*scm.Client, error)

func NewClientFromURL

func NewClientFromURL(driver, rawURL string, opts ...options.ClientOption) (*scm.Client, error)

Types

type Repository

type Repository struct {
	Namespace   string `json:"namespace"`
	Name        string `json:"name"`
	Description string `json:"description"`
	// Link is the link of the repository.
	Link string `json:"link"`
	// Reference is the reference of the repository. E.G: main, dev, v0.0.1.
	Reference string `json:"reference"`
	// Topics of the repository.
	Topics []string `json:"topics"`
	// Driver is the driver of the repository. E.G: github.
	Driver string `json:"driver"`
	// SubPath is the sub path of the repository.
	SubPath string `json:"subPath"`
}

func ParseURLToRepo

func ParseURLToRepo(rawURL string) (*Repository, error)

ParseURLToRepo parses a raw URL to a git repository. Since the return repository only contains the namespace and name, It only used for create template from catalog.

func (*Repository) FileRawURL added in v0.6.0

func (r *Repository) FileRawURL(file string) (string, error)

FileRawURL returns raw URL of a file in a git repository.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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