Documentation ¶
Index ¶
- func MustConstraint(constraint string) version.Constraints
- type Client
- type ClientProxy
- type DefaultClientProxy
- func (d *DefaultClientProxy) CreateComment(repo models.Repo, pullNum int, comment string) error
- func (d *DefaultClientProxy) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)
- func (d *DefaultClientProxy) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)
- func (d *DefaultClientProxy) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error)
- func (d *DefaultClientProxy) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, ...) error
- type GithubClient
- func (g *GithubClient) CreateComment(repo models.Repo, pullNum int, comment string) error
- func (g *GithubClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)
- func (g *GithubClient) GetPullRequest(repo models.Repo, num int) (*github.PullRequest, error)
- func (g *GithubClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)
- func (g *GithubClient) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error)
- func (g *GithubClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, ...) error
- type GitlabClient
- func (g *GitlabClient) CreateComment(repo models.Repo, pullNum int, comment string) error
- func (g *GitlabClient) GetMergeRequest(repoFullName string, pullNum int) (*gitlab.MergeRequest, error)
- func (g *GitlabClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)
- func (g *GitlabClient) GetVersion() (*version.Version, error)
- func (g *GitlabClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)
- func (g *GitlabClient) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error)
- func (g *GitlabClient) SupportsCommonMark() bool
- func (g *GitlabClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, ...) error
- type NotConfiguredVCSClient
- func (a *NotConfiguredVCSClient) CreateComment(repo models.Repo, pullNum int, comment string) error
- func (a *NotConfiguredVCSClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)
- func (a *NotConfiguredVCSClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)
- func (a *NotConfiguredVCSClient) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error)
- func (a *NotConfiguredVCSClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustConstraint ¶ added in v0.4.12
func MustConstraint(constraint string) version.Constraints
MustConstraint returns a constraint. It panics on error.
Types ¶
type Client ¶
type Client interface { GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error) CreateComment(repo models.Repo, pullNum int, comment string) error PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, description string) error }
Client is used to make API calls to a VCS host like GitHub or GitLab.
type ClientProxy ¶
type ClientProxy interface { GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error) CreateComment(repo models.Repo, pullNum int, comment string) error PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, description string) error }
ClientProxy proxies calls to the correct VCS client depending on which VCS host is required.
type DefaultClientProxy ¶
type DefaultClientProxy struct {
// contains filtered or unexported fields
}
DefaultClientProxy proxies calls to the correct VCS client depending on which VCS host is required.
func NewDefaultClientProxy ¶
func NewDefaultClientProxy(githubClient Client, gitlabClient Client, bitbucketCloudClient Client, bitbucketServerClient Client) *DefaultClientProxy
func (*DefaultClientProxy) CreateComment ¶
func (*DefaultClientProxy) GetModifiedFiles ¶
func (d *DefaultClientProxy) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)
func (*DefaultClientProxy) PullIsApproved ¶
func (d *DefaultClientProxy) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)
func (*DefaultClientProxy) PullIsMergeable ¶ added in v0.4.13
func (d *DefaultClientProxy) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error)
func (*DefaultClientProxy) UpdateStatus ¶
func (d *DefaultClientProxy) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, description string) error
type GithubClient ¶
type GithubClient struct {
// contains filtered or unexported fields
}
GithubClient is used to perform GitHub actions.
func NewGithubClient ¶
func NewGithubClient(hostname string, user string, pass string) (*GithubClient, error)
NewGithubClient returns a valid GitHub client.
func (*GithubClient) CreateComment ¶
CreateComment creates a comment on the pull request. If comment length is greater than the max comment length we split into multiple comments.
func (*GithubClient) GetModifiedFiles ¶
func (g *GithubClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)
GetModifiedFiles returns the names of files that were modified in the pull request. The names include the path to the file from the repo root, ex. parent/child/file.txt.
func (*GithubClient) GetPullRequest ¶
func (g *GithubClient) GetPullRequest(repo models.Repo, num int) (*github.PullRequest, error)
GetPullRequest returns the pull request.
func (*GithubClient) PullIsApproved ¶
func (g *GithubClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)
PullIsApproved returns true if the pull request was approved.
func (*GithubClient) PullIsMergeable ¶ added in v0.4.13
func (g *GithubClient) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error)
PullIsMergeable returns true if the pull request is mergeable.
func (*GithubClient) UpdateStatus ¶
func (g *GithubClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, description string) error
UpdateStatus updates the status badge on the pull request. See https://github.com/blog/1227-commit-status-api.
type GitlabClient ¶
type GitlabClient struct { Client *gitlab.Client // Version is set to the server version. Version *version.Version }
func NewGitlabClient ¶ added in v0.4.12
func NewGitlabClient(hostname string, token string, logger *logging.SimpleLogger) (*GitlabClient, error)
NewGitlabClient returns a valid GitLab client.
func (*GitlabClient) CreateComment ¶
CreateComment creates a comment on the merge request.
func (*GitlabClient) GetMergeRequest ¶
func (g *GitlabClient) GetMergeRequest(repoFullName string, pullNum int) (*gitlab.MergeRequest, error)
func (*GitlabClient) GetModifiedFiles ¶
func (g *GitlabClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)
GetModifiedFiles returns the names of files that were modified in the merge request. The names include the path to the file from the repo root, ex. parent/child/file.txt.
func (*GitlabClient) GetVersion ¶ added in v0.4.12
func (g *GitlabClient) GetVersion() (*version.Version, error)
GetVersion returns the version of the Gitlab server this client is using.
func (*GitlabClient) PullIsApproved ¶
func (g *GitlabClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)
PullIsApproved returns true if the merge request was approved.
func (*GitlabClient) PullIsMergeable ¶ added in v0.4.13
func (g *GitlabClient) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error)
PullIsMergeable returns true if the merge request can be merged. In GitLab, there isn't a single field that tells us if the pull request is mergeable so for now we check the merge_status and approvals_before_merge fields. We aren't checking if there are unresolved discussions or failing pipelines because those only block merges if the repo is set to require that. In order to check if the repo required these, we'd need to make another API call to get the repo settings. For now I'm going to leave this as is and if some users require checking this as well then we can revisit. It's also possible that GitLab implements their own "mergeable" field in their API in the future. See: - https://gitlab.com/gitlab-org/gitlab-ee/issues/3169 - https://gitlab.com/gitlab-org/gitlab-ce/issues/42344
func (*GitlabClient) SupportsCommonMark ¶ added in v0.4.12
func (g *GitlabClient) SupportsCommonMark() bool
SupportsCommonMark returns true if the version of Gitlab this client is using supports the CommonMark markdown format.
func (*GitlabClient) UpdateStatus ¶
func (g *GitlabClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, description string) error
UpdateStatus updates the build status of a commit.
type NotConfiguredVCSClient ¶
type NotConfiguredVCSClient struct {
Host models.VCSHostType
}
NotConfiguredVCSClient is used as a placeholder when Atlantis isn't configured on startup to support a certain VCS host. For example, if there is no GitHub config then this client will be used which will error if it's ever called.
func (*NotConfiguredVCSClient) CreateComment ¶
func (*NotConfiguredVCSClient) GetModifiedFiles ¶
func (a *NotConfiguredVCSClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)
func (*NotConfiguredVCSClient) PullIsApproved ¶
func (a *NotConfiguredVCSClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)
func (*NotConfiguredVCSClient) PullIsMergeable ¶ added in v0.4.13
func (a *NotConfiguredVCSClient) PullIsMergeable(repo models.Repo, pull models.PullRequest) (bool, error)
func (*NotConfiguredVCSClient) UpdateStatus ¶
func (a *NotConfiguredVCSClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, description string) error