Documentation ¶
Index ¶
Constants ¶
const (
// ListPerPageOpt represents the value for PerPage in list options.
ListPerPageOpt = 30
)
Variables ¶
This section is empty.
Functions ¶
func GenerateSCMToken ¶
GenerateSCMToken generates the SCM token according to the config. Make sure the type, server of the SCM is provided. If the SCM is Github, the username is required. If the access token is provided, it should be checked whether has authority of repos. Generate new token only when the username and password are provided at the same time.
func ParseRepo ¶
ParseRepo parses owner and name from full repo name. For example, parse caicloud/cyclone will return owner(caicloud) and name(cyclone).
func ParseServerURL ¶
ParseServerURL is a helper func to parse the server url, such as https://github.com/ to return server(github.com).
func RegisterProvider ¶
RegisterProvider registers SCM providers.
Types ¶
type EventData ¶
type EventData struct { Type EventType Repo string Ref string Branch string Comment string CommitSHA string }
EventData represents the data parsed from SCM events.
type EventType ¶
type EventType string
EventType represents event types of SCM.
const ( // PullRequestEventType represents pull request events. PullRequestEventType EventType = "scm-pull-request" // PullRequestCommentEventType represents pull request comment events. PullRequestCommentEventType EventType = "scm-pull-request-comment" // PushEventType represents commit push events. PushEventType EventType = "scm-push" // TagReleaseEventType represents tag release events. TagReleaseEventType EventType = "scm-tag-release" )
type Provider ¶
type Provider interface { GetToken() (string, error) ListRepos() ([]Repository, error) // ListBranches list branches of repo, repo format must be {owner}/{repo}. ListBranches(repo string) ([]string, error) // ListTags list tags of repo, repo format must be {owner}/{repo}. ListTags(repo string) ([]string, error) ListDockerfiles(repo string) ([]string, error) CreateStatus(status c_v1alpha1.StatusPhase, targetURL, repoURL, commitSHA string) error GetPullRequestSHA(repoURL string, number int) (string, error) CheckToken() error CreateWebhook(repo string, webhook *Webhook) error DeleteWebhook(repo string, webhookURL string) error }
Provider represents the interface of SCM provider.
type Repository ¶
Repository represents the information of a repository.