vcs

package
v0.3.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: Apache-2.0 Imports: 17 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) (*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"`
	// Driver is the driver of the repository. E.G: github.
	Driver string `json:"driver"`
}

func ParseURLToRepo

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

ParseURLToGit 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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