Documentation ¶
Index ¶
- Constants
- Variables
- func Init() error
- func Logger() *log.Logger
- func SetLogger(l *log.Logger)
- func SetOS(os gitos.OS)
- func Start(repo *Repo)
- type BitbucketHook
- type GenericHook
- type Git
- type GithubHook
- type GitlabHook
- type GogsHook
- type HookConfig
- type Repo
- type RepoURL
- type Then
- type TravisHook
- type WebHook
Constants ¶
const ( // DefaultInterval is the minimum interval to delay before // requesting another git pull DefaultInterval time.Duration = time.Hour * 1 )
Variables ¶
var ( // Services holds all git pulling services and provides the function to // stop them. Services = &services{} )
Functions ¶
func Init ¶
func Init() error
Init validates git installation, locates the git executable binary in PATH and check for available shell to use.
Types ¶
type BitbucketHook ¶
type BitbucketHook struct{}
BitbucketHook is webhook for BitBucket.org.
func (BitbucketHook) DoesHandle ¶
func (b BitbucketHook) DoesHandle(h http.Header) bool
DoesHandle satisfies hookHandler.
func (BitbucketHook) Handle ¶
func (b BitbucketHook) Handle(w http.ResponseWriter, r *http.Request, repo *Repo) (int, error)
Handle satisfies hookHandler.
type GenericHook ¶
type GenericHook struct{}
GenericHook is generic webhook.
func (GenericHook) DoesHandle ¶
func (g GenericHook) DoesHandle(h http.Header) bool
DoesHandle satisfies hookHandler.
func (GenericHook) Handle ¶
func (g GenericHook) Handle(w http.ResponseWriter, r *http.Request, repo *Repo) (int, error)
Handle satisfies hookhandler.
type GithubHook ¶
type GithubHook struct{}
GithubHook is webhook for Github.com.
func (GithubHook) DoesHandle ¶
func (g GithubHook) DoesHandle(h http.Header) bool
DoesHandle satisfies hookHandler.
func (GithubHook) Handle ¶
func (g GithubHook) Handle(w http.ResponseWriter, r *http.Request, repo *Repo) (int, error)
Handle satisfies hookHandler.
type GitlabHook ¶
type GitlabHook struct{}
GitlabHook is webhook for gitlab.com
func (GitlabHook) DoesHandle ¶
func (g GitlabHook) DoesHandle(h http.Header) bool
DoesHandle satisfies hookHandler.
func (GitlabHook) Handle ¶
func (g GitlabHook) Handle(w http.ResponseWriter, r *http.Request, repo *Repo) (int, error)
Handle satisfies hookHandler.
type GogsHook ¶
type GogsHook struct{}
GogsHook is the webhook for gogs.io.
func (GogsHook) DoesHandle ¶
DoesHandle satisfies hookHandler.
type HookConfig ¶
type HookConfig struct { URL string // url to listen on for webhooks Secret string // secret to validate hooks Type string // type of Webhook }
HookConfig is a webhook handler configuration.
type Repo ¶
type Repo struct { URL RepoURL // Repository URL Path string // Directory to pull to Host string // Git domain host e.g. github.com Branch string // Git branch KeyPath string // Path to private ssh key Interval time.Duration // Interval between pulls CloneArgs []string // Additonal cli args to pass to git clone PullArgs []string // Additonal cli args to pass to git pull Then []Then // Commands to execute after successful git pull Hook HookConfig // Webhook configuration sync.Mutex // contains filtered or unexported fields }
Repo is the structure that holds required information of a git repository.
type RepoURL ¶
type RepoURL string
RepoURL is the repository url.
type Then ¶
Then is the command executed after successful pull.
func NewLongThen ¶
NewLongThen creates a new long running Then comand.
type TravisHook ¶
type TravisHook struct{}
TravisHook is webhook for travis-ci.org
func (TravisHook) DoesHandle ¶
func (t TravisHook) DoesHandle(h http.Header) bool
DoesHandle satisfies hookHandler.
func (TravisHook) Handle ¶
func (t TravisHook) Handle(w http.ResponseWriter, r *http.Request, repo *Repo) (int, error)
Handle satisfies hookHandler.