Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSCMToken ¶ added in v0.3.0
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 NewTagFromLatest ¶ added in v0.5.0
func RegisterProvider ¶ added in v0.3.0
func RegisterProvider(scmType api.SCMType, provider SCMProvider) error
RegisterProvider registers SCM providers.
Types ¶
type SCMProvider ¶ added in v0.3.0
type SCMProvider interface { GetToken(scm *api.SCMConfig) (string, error) ListRepos(scm *api.SCMConfig) ([]api.Repository, error) ListBranches(scm *api.SCMConfig, repo string) ([]string, error) ListTags(scm *api.SCMConfig, repo string) ([]string, error) CheckToken(scm *api.SCMConfig) bool NewTagFromLatest(scm *api.SCMConfig, tagName, description, commitID, url string) error CreateWebHook(scm *api.SCMConfig, repoURL string, webHook *WebHook) error DeleteWebHook(scm *api.SCMConfig, repoURL string, webHookUrl string) error // gitlib oauth function GetAuthCodeURL(state string, scmType api.SCMType) (string, error) Authcallback(code, state string) (string, error) }
SCMProvider represents the interface of SCM provider. TODO(robin) Refactor this interface to avoid the SCM config param for each method.
func GetSCMProvider ¶ added in v0.3.0
func GetSCMProvider(scmType api.SCMType) (SCMProvider, error)
GetSCMProvider gets the SCM provider by the type.
Click to show internal directories.
Click to hide internal directories.