Documentation ¶
Index ¶
- Constants
- func NewTypeMismatchError(expected string, actual string) error
- type App
- type Auth
- type Branch
- type BuildArtifact
- type BuildDetail
- type Check
- type Client
- type Commit
- type CommitRef
- type Config
- type KeyRing
- type Metadata
- type MockClient
- func (m *MockClient) GetBranch(ctx context.Context, details BuildDetail, name string) (Branch, error)
- func (m *MockClient) GetCommit(ctx context.Context, details BuildDetail) (Commit, error)
- func (m *MockClient) GetDefaultBranch(ctx context.Context, details BuildDetail) (Branch, error)
- func (m *MockClient) GetOrganization(ctx context.Context, details BuildDetail) (Organization, error)
- type Organization
- type PullRequest
Constants ¶
const ( Protocol = "((?P<protocol>https?|git)(?:://|@))?" VCSName = "(?P<vcs>[^/:]+)" OrgName = "(?P<org>[^/.]+)" RepoName = "(?P<repo>[^/.]+)" RepoExtension = "(?:.git)?" VCSRegex = "^" + Protocol + VCSName + "/?$" OrgRegex = "^" + Protocol + VCSName + "[/:]" + OrgName + "/?$" RepoRegex = "^" + Protocol + VCSName + "[/:]" + OrgName + "/" + RepoName + RepoExtension + "$" )
const ( CommitStatusError = "ERROR" CommitStatusExpected = "EXPECTED" CommitStatusFAilure = "FAILURE" CommitStatusPending = "PENDING" CommitStatusSuccess = "SUCCESS" )
const GithubInstallType = "githubinstall"
GithubInstallType is the type representing a Github install
const TokenAuthType = "token"
TokenAuthType is the type representing a token-based authentication method
const UserPasswordAuthType = "userpassword"
UserPasswordAuthType is the type representing a token-based authentication method
Variables ¶
This section is empty.
Functions ¶
func NewTypeMismatchError ¶
NewTypeMismatchError creates a new TypeMismatchError
Types ¶
type Auth ¶
type Auth struct { Token string `json:"token"` Username string `json:"username"` Password string `json:"password"` AppID string `json:"_app_id"` InstallationID string `json:"_installation_id"` PrivateKey string `json:"private_key"` }
Auth holds the necessary information to connect to a repository source
type BuildArtifact ¶
BuildArtifact is a type that describes the artifact info related to a build
func (*BuildArtifact) String ¶
func (b *BuildArtifact) String() string
type BuildDetail ¶
type BuildDetail struct { RepositoryURL string `json:"repository"` Commit string `json:"commit"` BuildCreator string `json:"build_creator"` BuildURL string `json:"build_url"` ProjectID string `json:"project_id"` Artifacts []BuildArtifact `json:"artifacts"` }
BuildDetail is a type that describes the details/metadata info related to a build
func (*BuildDetail) String ¶
func (b *BuildDetail) String() string
type Check ¶
Check is a collection of the check runs created by a single CI/CD App for a specific commit
type Client ¶
type Client interface { GetCommit(ctx context.Context, details BuildDetail) (Commit, error) GetOrganization(ctx context.Context, details BuildDetail) (Organization, error) GetBranch(ctx context.Context, details BuildDetail, name string) (Branch, error) GetDefaultBranch(ctx context.Context, details BuildDetail) (Branch, error) }
Client is a client for a version control source
type Commit ¶
type Commit struct { URL string Checks []Check Status string IsSigned bool AssociatedPullRequests []PullRequest }
Commit contains information pertaining to the validity of a commit
type CommitRef ¶
type CommitRef struct {
URL string
}
CommitRef contains a URL referencing a commit
func NewCommitRef ¶
NewCommitRef returns a new CommitRef object
type Config ¶
type Config struct { Auth KeyRing Organization string `json:"org-name"` OrganizationURL string `json:"org-url"` }
Config contains the necessary parameters to authenticate/communicate with a source repository
type KeyRing ¶
KeyRing contains all the authentication keys needed to communicate an org's repository source
type Metadata ¶
type Metadata struct { VCS string `json:"vcs"` Organization string `json:"organization"` Name string `json:"name"` }
Metadata describes the top level metadata information about a repo that one can get from the gitUrl
func NewRepositoryMetadata ¶
type MockClient ¶
func (*MockClient) GetBranch ¶
func (m *MockClient) GetBranch(ctx context.Context, details BuildDetail, name string) (Branch, error)
func (*MockClient) GetCommit ¶
func (m *MockClient) GetCommit(ctx context.Context, details BuildDetail) (Commit, error)
func (*MockClient) GetDefaultBranch ¶
func (m *MockClient) GetDefaultBranch(ctx context.Context, details BuildDetail) (Branch, error)
func (*MockClient) GetOrganization ¶
func (m *MockClient) GetOrganization(ctx context.Context, details BuildDetail) (Organization, error)
type Organization ¶
Organization contains repository information pertaining to an organization
func NewOrganization ¶
func NewOrganization(alias string, url string) *Organization
type PullRequest ¶
type PullRequest struct { BaseBranchName string HeadBranchName string IsMerged bool MergeCommit CommitRef HasRequiredApprovals bool }
PullRequest contains information pertaining to a pull request
func NewPullRequest ¶
func NewPullRequest(baseBranchName string, headBranchName string, isMerged bool, mergeCommit CommitRef, hasRequiredApprovals bool) PullRequest
NewPullRequest returns a new PullRequest object