Documentation ¶
Index ¶
- func CloneGitRepo(ctx context.Context, link, dir string, skipTLSVerify bool) (*git.Repository, error)
- func GetGitRepoVersions(r *git.Repository) ([]*version.Version, error)
- func GetGitSource(link string) (string, error)
- func GetOrgFromGitURL(source string) (string, error)
- func GetOrgRepos(ctx context.Context, client *scm.Client, orgName string) ([]*scm.Repository, error)
- func GetRepoRef(r *git.Repository, name string) (*plumbing.Reference, error)
- func HardResetGitRepo(r *git.Repository, ref string) error
- func NewClient(conn *model.Connector, opts ...options.ClientOption) (*scm.Client, error)
- func NewClientFromURL(driver, rawURL string, opts ...options.ClientOption) (*scm.Client, error)
- type Repository
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 ¶
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
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 ¶
GetRepoRef returns a reference from a git repository.
func HardResetGitRepo ¶
HardResetGitRepo hard resets a git repository to a specific hash.
func NewClientFromURL ¶
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.