Documentation ¶
Index ¶
- Constants
- type Manager
- func (vm *Manager) CheckRepoValid(event *api.Event) error
- func (vm *Manager) CheckoutTag(service *api.Service, version *api.Version) error
- func (vm *Manager) CloneVersionRepository(event *api.Event) error
- func (vm *Manager) GetCloneDir(service *api.Service, version *api.Version) string
- func (vm *Manager) GetTagCommit(service *api.Service, version *api.Version) (string, error)
- func (vm *Manager) NewTagFromLatest(event *api.Event) error
- type VCS
Constants ¶
const (
// The dir which the repo clone to.
CLONE_DIR = "/root/code"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct { }
Manager manages all version control operations, like clone, cherry-pick. Based on the operations, some are handled asychronously and some are not. Asynchronous operations are time consuming and usually involve stream output to clients, like clone, fetch, etc; synchronous operations are not time consuming and usually don't have to send output, like checkout a tag, etc. The above constants define all async operations; all other operations are synchronous. Manager is also responsible for managing repository status; it knows whether a repository is healthy or not, and set repository status accordingly. synchronous.
func (*Manager) CheckRepoValid ¶
CheckRepoValid check whether the repo is a valid repo
func (*Manager) CheckoutTag ¶
CheckoutTag checkout to given tag in version.
func (*Manager) CloneVersionRepository ¶
CloneVersionRepository clones a version's repo
func (*Manager) GetCloneDir ¶
GetCloneDir returns the directory where a repository should be cloned to.
func (*Manager) GetTagCommit ¶
GetTagCommit finds commit/revision hash of a given tag.
type VCS ¶
type VCS interface { // Ping checks if the url is a valid repository, like ping cmd on linux Ping(url, destPath string, event *api.Event) error // Clone pulls repository from url into destination path. Code base lives // directly under 'destPath', do not nest the code base. E.g. // Clone("https://github.com/caicloud/cyclone", /tmp/xxx/yyy") // should clone cyclone directly under /tmp/xxx/yyy, not /tmp/xxx/yyy/cyclone/ // You can always assume 'destPath' doesn't exist, but its parent direcotry // exists. Clone(url, destPath string, event *api.Event) error // NewTagFromLatest creates a new tag from latest source for a service. NewTagFromLatest(repoPath string, event *api.Event) error // CheckoutTag checkout to given tag. CheckoutTag(repoPath string, tag string) error // GetTagCommit finds commit/revision hash of a given tag. GetTagCommit(repoPath string, tag string) (string, error) // CheckOutByCommitID checks out code in repo by special commit id. CheckOutByCommitID(commitID string, repoPath string, event *api.Event) error }
VCS is the interface of all operations needed for managing repository.