-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.go
36 lines (30 loc) · 905 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package api
import (
"fmt"
"regexp"
)
// Hook is a very basic representation of a WebHook
// that links a Github repository to an OpenShift BuildConfig
// through the hook's TargetURL (OpenShift endpoint used to trigger a new build)
type Hook struct {
Enabled bool
TargetURL string
GithubRepository GithubRepository
}
// GithubRepository is a very basic representation of a GitHub repository
type GithubRepository struct {
Owner string
Name string
}
func (r GithubRepository) String() string {
return fmt.Sprintf("%s/%s", r.Owner, r.Name)
}
const (
// IgnoreAnnotation is an annotation whose boolean value
// is used to ignore a buildconfig
IgnoreAnnotation = "openshift-github-hooks-sync/ignore"
)
var (
// GithubURIRegexp is a regexp that can extract the repository owner and name from its URI
GithubURIRegexp = regexp.MustCompile(`github\.com[:/]([^/]+)/([^.]+)`)
)