Documentation ¶
Index ¶
- func GitStatusContextFromSrc(src string) *azuredevops.GitStatusContext
- func MustConstraint(constraint string) version.Constraints
- func SetGitScopeTags(scope tally.Scope, repoFullName string, pullNum int) tally.Scope
- func SplitAzureDevopsRepoFullName(repoFullName string) (owner string, project string, repo string)
- func WriteGitCreds(gitUser string, gitToken string, gitHostname string, home string, ...) error
- type AzureDevopsClient
- func (g *AzureDevopsClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, ...) error
- func (g *AzureDevopsClient) DiscardReviews(repo models.Repo, pull models.PullRequest) error
- func (g *AzureDevopsClient) GetCloneURL(_ logging.SimpleLogging, VCSHostType models.VCSHostType, repo string) (string, error)
- func (g *AzureDevopsClient) GetFileContent(_ logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
- func (g *AzureDevopsClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (g *AzureDevopsClient) GetPullLabels(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest) ([]string, error)
- func (g *AzureDevopsClient) GetPullRequest(logger logging.SimpleLogging, repo models.Repo, num int) (*azuredevops.GitPullRequest, error)
- func (g *AzureDevopsClient) GetTeamNamesForUser(repo models.Repo, user models.User) ([]string, error)
- func (g *AzureDevopsClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, ...) error
- func (g *AzureDevopsClient) MarkdownPullLink(pull models.PullRequest) (string, error)
- func (g *AzureDevopsClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, ...) error
- func (g *AzureDevopsClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (approvalStatus models.ApprovalStatus, err error)
- func (g *AzureDevopsClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) (bool, error)
- func (g *AzureDevopsClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, ...) error
- func (g *AzureDevopsClient) SupportsSingleFileDownload(repo models.Repo) bool
- func (g *AzureDevopsClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) error
- type Client
- type ClientProxy
- func (d *ClientProxy) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, ...) error
- func (d *ClientProxy) DiscardReviews(repo models.Repo, pull models.PullRequest) error
- func (d *ClientProxy) GetCloneURL(logger logging.SimpleLogging, VCSHostType models.VCSHostType, repo string) (string, error)
- func (d *ClientProxy) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
- func (d *ClientProxy) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (d *ClientProxy) GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (d *ClientProxy) GetTeamNamesForUser(repo models.Repo, user models.User) ([]string, error)
- func (d *ClientProxy) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, ...) error
- func (d *ClientProxy) MarkdownPullLink(pull models.PullRequest) (string, error)
- func (d *ClientProxy) MergePull(logger logging.SimpleLogging, pull models.PullRequest, ...) error
- func (d *ClientProxy) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)
- func (d *ClientProxy) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) (bool, error)
- func (d *ClientProxy) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, ...) error
- func (d *ClientProxy) SupportsSingleFileDownload(repo models.Repo) bool
- func (d *ClientProxy) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) error
- type GitCredsTokenRotator
- type GithubAnonymousCredentials
- type GithubAppCredentials
- type GithubAppTemporarySecrets
- type GithubClient
- func (g *GithubClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, ...) error
- func (g *GithubClient) DiscardReviews(repo models.Repo, pull models.PullRequest) error
- func (g *GithubClient) ExchangeCode(logger logging.SimpleLogging, code string) (*GithubAppTemporarySecrets, error)
- func (g *GithubClient) GetCloneURL(logger logging.SimpleLogging, _ models.VCSHostType, repo string) (string, error)
- func (g *GithubClient) GetCombinedStatusMinusApply(logger logging.SimpleLogging, repo models.Repo, pull *github.PullRequest, ...) (bool, error)
- func (g *GithubClient) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
- func (g *GithubClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (g *GithubClient) GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (g *GithubClient) GetPullRequest(logger logging.SimpleLogging, repo models.Repo, num int) (*github.PullRequest, error)
- func (g *GithubClient) GetPullReviewDecision(repo models.Repo, pull models.PullRequest) (approvalStatus bool, err error)
- func (g *GithubClient) GetTeamNamesForUser(repo models.Repo, user models.User) ([]string, error)
- func (g *GithubClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, ...) error
- func (g *GithubClient) MarkdownPullLink(pull models.PullRequest) (string, error)
- func (g *GithubClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, ...) error
- func (g *GithubClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (approvalStatus models.ApprovalStatus, err error)
- func (g *GithubClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) (bool, error)
- func (g *GithubClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, _ int, commentID int64, ...) error
- func (g *GithubClient) SupportsSingleFileDownload(_ models.Repo) bool
- func (g *GithubClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) error
- type GithubConfig
- type GithubCredentials
- type GithubPRReviewSummary
- type GithubPullRequestGetter
- type GithubReview
- type GithubUserCredentials
- type GitlabClient
- func (g *GitlabClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, ...) error
- func (g *GitlabClient) DiscardReviews(_ models.Repo, _ models.PullRequest) error
- func (g *GitlabClient) GetCloneURL(logger logging.SimpleLogging, _ models.VCSHostType, repo string) (string, error)
- func (g *GitlabClient) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
- func (g *GitlabClient) GetMergeRequest(logger logging.SimpleLogging, repoFullName string, pullNum int) (*gitlab.MergeRequest, error)
- func (g *GitlabClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (g *GitlabClient) GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (g *GitlabClient) GetTeamNamesForUser(_ models.Repo, _ models.User) ([]string, error)
- func (g *GitlabClient) GetVersion(logger logging.SimpleLogging) (*version.Version, error)
- func (g *GitlabClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, ...) error
- func (g *GitlabClient) MarkdownPullLink(pull models.PullRequest) (string, error)
- func (g *GitlabClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, ...) error
- func (g *GitlabClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (approvalStatus models.ApprovalStatus, err error)
- func (g *GitlabClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) (bool, error)
- func (g *GitlabClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, ...) error
- func (g *GitlabClient) SupportsCommonMark() bool
- func (g *GitlabClient) SupportsDetailedMergeStatus(logger logging.SimpleLogging) (bool, error)
- func (g *GitlabClient) SupportsSingleFileDownload(_ models.Repo) bool
- func (g *GitlabClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) error
- func (g *GitlabClient) WaitForSuccessPipeline(logger logging.SimpleLogging, ctx context.Context, pull models.PullRequest)
- type IGithubClient
- type InstrumentedClient
- func (c *InstrumentedClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, ...) error
- func (c *InstrumentedClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (c *InstrumentedClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, ...) error
- func (c *InstrumentedClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, ...) error
- func (c *InstrumentedClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)
- func (c *InstrumentedClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) (bool, error)
- func (c *InstrumentedClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, ...) error
- func (c *InstrumentedClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) error
- type InstrumentedGithubClient
- type NotConfiguredVCSClient
- func (a *NotConfiguredVCSClient) CreateComment(_ logging.SimpleLogging, _ models.Repo, _ int, _ string, _ string) error
- func (a *NotConfiguredVCSClient) DiscardReviews(_ models.Repo, _ models.PullRequest) error
- func (a *NotConfiguredVCSClient) GetCloneURL(_ logging.SimpleLogging, _ models.VCSHostType, _ string) (string, error)
- func (a *NotConfiguredVCSClient) GetFileContent(_ logging.SimpleLogging, _ models.PullRequest, _ string) (bool, []byte, error)
- func (a *NotConfiguredVCSClient) GetModifiedFiles(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest) ([]string, error)
- func (a *NotConfiguredVCSClient) GetPullLabels(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest) ([]string, error)
- func (a *NotConfiguredVCSClient) GetTeamNamesForUser(_ models.Repo, _ models.User) ([]string, error)
- func (a *NotConfiguredVCSClient) HidePrevCommandComments(_ logging.SimpleLogging, _ models.Repo, _ int, _ string, _ string) error
- func (a *NotConfiguredVCSClient) MarkdownPullLink(_ models.PullRequest) (string, error)
- func (a *NotConfiguredVCSClient) MergePull(_ logging.SimpleLogging, _ models.PullRequest, _ models.PullRequestOptions) error
- func (a *NotConfiguredVCSClient) PullIsApproved(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest) (models.ApprovalStatus, error)
- func (a *NotConfiguredVCSClient) PullIsMergeable(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest, _ string) (bool, error)
- func (a *NotConfiguredVCSClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, ...) error
- func (a *NotConfiguredVCSClient) SupportsSingleFileDownload(_ models.Repo) bool
- func (a *NotConfiguredVCSClient) UpdateStatus(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest, ...) error
- type PullReqStatusFetcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GitStatusContextFromSrc ¶ added in v0.15.1
func GitStatusContextFromSrc(src string) *azuredevops.GitStatusContext
GitStatusContextFromSrc parses an Atlantis formatted src string into a context suitable for the status update API. In the AzureDevops branch policy UI there is a single string field used to drive these contexts where all text preceding the final '/' character is treated as the 'genre'.
func MustConstraint ¶ added in v0.4.12
func MustConstraint(constraint string) version.Constraints
MustConstraint returns a constraint. It panics on error.
func SetGitScopeTags ¶ added in v0.21.0
func SplitAzureDevopsRepoFullName ¶ added in v0.10.0
SplitAzureDevopsRepoFullName splits a repo full name up into its owner, repo and project name segments. If the repoFullName is malformed, may return empty strings for owner, repo, or project. Azure DevOps uses repoFullName format owner/project/repo.
Ex. runatlantis/atlantis => (runatlantis, atlantis)
gitlab/subgroup/runatlantis/atlantis => (gitlab/subgroup/runatlantis, atlantis) azuredevops/project/atlantis => (azuredevops, project, atlantis)
func WriteGitCreds ¶ added in v0.23.4
func WriteGitCreds(gitUser string, gitToken string, gitHostname string, home string, logger logging.SimpleLogging, ghAccessToken bool) error
WriteGitCreds generates a .git-credentials file containing the username and token used for authenticating with git over HTTPS It will create the file in home/.git-credentials If ghAccessToken is true we will look for a line starting with https://x-access-token and ending with gitHostname and replace it.
Types ¶
type AzureDevopsClient ¶ added in v0.10.0
type AzureDevopsClient struct { Client *azuredevops.Client UserName string // contains filtered or unexported fields }
AzureDevopsClient represents an Azure DevOps VCS client
func NewAzureDevopsClient ¶ added in v0.10.0
func NewAzureDevopsClient(hostname string, userName string, token string) (*AzureDevopsClient, error)
NewAzureDevopsClient returns a valid Azure DevOps client.
func (*AzureDevopsClient) CreateComment ¶ added in v0.10.0
func (g *AzureDevopsClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, command string) error
CreateComment creates a comment on a pull request.
If comment length is greater than the max comment length we split into multiple comments.
func (*AzureDevopsClient) DiscardReviews ¶ added in v0.22.0
func (g *AzureDevopsClient) DiscardReviews(repo models.Repo, pull models.PullRequest) error
func (*AzureDevopsClient) GetCloneURL ¶ added in v0.19.8
func (g *AzureDevopsClient) GetCloneURL(_ logging.SimpleLogging, VCSHostType models.VCSHostType, repo string) (string, error)
func (*AzureDevopsClient) GetFileContent ¶ added in v0.22.0
func (g *AzureDevopsClient) GetFileContent(_ logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
func (*AzureDevopsClient) GetModifiedFiles ¶ added in v0.10.0
func (g *AzureDevopsClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
GetModifiedFiles returns the names of files that were modified in the merge request relative to the repo root, e.g. parent/child/file.txt.
func (*AzureDevopsClient) GetPullLabels ¶ added in v0.26.0
func (g *AzureDevopsClient) GetPullLabels(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest) ([]string, error)
func (*AzureDevopsClient) GetPullRequest ¶ added in v0.10.0
func (g *AzureDevopsClient) GetPullRequest(logger logging.SimpleLogging, repo models.Repo, num int) (*azuredevops.GitPullRequest, error)
GetPullRequest returns the pull request.
func (*AzureDevopsClient) GetTeamNamesForUser ¶ added in v0.18.0
func (g *AzureDevopsClient) GetTeamNamesForUser(repo models.Repo, user models.User) ([]string, error)
GetTeamNamesForUser returns the names of the teams or groups that the user belongs to (in the organization the repository belongs to).
func (*AzureDevopsClient) HidePrevCommandComments ¶ added in v0.17.1
func (g *AzureDevopsClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, dir string) error
func (*AzureDevopsClient) MarkdownPullLink ¶ added in v0.13.0
func (g *AzureDevopsClient) MarkdownPullLink(pull models.PullRequest) (string, error)
MarkdownPullLink specifies the string used in a pull request comment to reference another pull request.
func (*AzureDevopsClient) MergePull ¶ added in v0.10.0
func (g *AzureDevopsClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, pullOptions models.PullRequestOptions) error
MergePull merges the merge request using the default no fast-forward strategy If the user has set a branch policy that disallows no fast-forward, the merge will fail until we handle branch policies https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops
func (*AzureDevopsClient) PullIsApproved ¶ added in v0.10.0
func (g *AzureDevopsClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (approvalStatus models.ApprovalStatus, err error)
PullIsApproved returns true if the merge request was approved by another reviewer. https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops#require-a-minimum-number-of-reviewers
func (*AzureDevopsClient) PullIsMergeable ¶ added in v0.10.0
func (g *AzureDevopsClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, vcsstatusname string) (bool, error)
PullIsMergeable returns true if the merge request can be merged.
func (*AzureDevopsClient) ReactToComment ¶ added in v0.24.0
func (g *AzureDevopsClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, reaction string) error
func (*AzureDevopsClient) SupportsSingleFileDownload ¶ added in v0.15.0
func (g *AzureDevopsClient) SupportsSingleFileDownload(repo models.Repo) bool
func (*AzureDevopsClient) UpdateStatus ¶ added in v0.10.0
func (g *AzureDevopsClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error
UpdateStatus updates the build status of a commit.
type Client ¶
type Client interface { // GetModifiedFiles returns the names of files that were modified in the merge request // relative to the repo root, e.g. parent/child/file.txt. GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, command string) error ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, reaction string) error HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, dir string) error PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, vcsstatusname string) (bool, error) // UpdateStatus updates the commit status to state for pull. src is the // source of this status. This should be relatively static across runs, // ex. atlantis/plan or atlantis/apply. // description is a description of this particular status update and can // change across runs. // url is an optional link that users should click on for more information // about this status. UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error DiscardReviews(repo models.Repo, pull models.PullRequest) error MergePull(logger logging.SimpleLogging, pull models.PullRequest, pullOptions models.PullRequestOptions) error MarkdownPullLink(pull models.PullRequest) (string, error) GetTeamNamesForUser(repo models.Repo, user models.User) ([]string, error) // GetFileContent a repository file content from VCS (which support fetch a single file from repository) // The first return value indicates whether the repo contains a file or not // if BaseRepo had a file, its content will placed on the second return value GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error) SupportsSingleFileDownload(repo models.Repo) bool GetCloneURL(logger logging.SimpleLogging, VCSHostType models.VCSHostType, repo string) (string, error) // GetPullLabels returns the labels of a pull request GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error) }
Client is used to make API calls to a VCS host like GitHub or GitLab.
type ClientProxy ¶
type ClientProxy struct {
// contains filtered or unexported fields
}
ClientProxy proxies calls to the correct VCS client depending on which VCS host is required.
func NewClientProxy ¶ added in v0.5.0
func (*ClientProxy) CreateComment ¶
func (d *ClientProxy) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, command string) error
func (*ClientProxy) DiscardReviews ¶ added in v0.22.0
func (d *ClientProxy) DiscardReviews(repo models.Repo, pull models.PullRequest) error
func (*ClientProxy) GetCloneURL ¶ added in v0.19.8
func (d *ClientProxy) GetCloneURL(logger logging.SimpleLogging, VCSHostType models.VCSHostType, repo string) (string, error)
func (*ClientProxy) GetFileContent ¶ added in v0.22.0
func (d *ClientProxy) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
func (*ClientProxy) GetModifiedFiles ¶
func (d *ClientProxy) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
func (*ClientProxy) GetPullLabels ¶ added in v0.26.0
func (d *ClientProxy) GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
func (*ClientProxy) GetTeamNamesForUser ¶ added in v0.18.0
func (*ClientProxy) HidePrevCommandComments ¶ added in v0.17.1
func (d *ClientProxy) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, dir string) error
func (*ClientProxy) MarkdownPullLink ¶ added in v0.13.0
func (d *ClientProxy) MarkdownPullLink(pull models.PullRequest) (string, error)
func (*ClientProxy) MergePull ¶ added in v0.4.14
func (d *ClientProxy) MergePull(logger logging.SimpleLogging, pull models.PullRequest, pullOptions models.PullRequestOptions) error
func (*ClientProxy) PullIsApproved ¶
func (d *ClientProxy) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)
func (*ClientProxy) PullIsMergeable ¶ added in v0.4.13
func (d *ClientProxy) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, vcsstatusname string) (bool, error)
func (*ClientProxy) ReactToComment ¶ added in v0.24.0
func (d *ClientProxy) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, reaction string) error
func (*ClientProxy) SupportsSingleFileDownload ¶ added in v0.15.0
func (d *ClientProxy) SupportsSingleFileDownload(repo models.Repo) bool
func (*ClientProxy) UpdateStatus ¶
func (d *ClientProxy) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error
type GitCredsTokenRotator ¶ added in v0.23.4
type GitCredsTokenRotator interface { Run() GenerateJob() (scheduled.JobDefinition, error) }
GitCredsTokenRotator continuously tries to rotate the github app access token every 30 seconds and writes the ~/.git-credentials file
func NewGithubAppTokenRotator ¶ added in v0.23.4
func NewGithubAppTokenRotator( log logging.SimpleLogging, githubCredentials GithubCredentials, githubHostname string, homeDirPath string) GitCredsTokenRotator
type GithubAnonymousCredentials ¶ added in v0.14.0
type GithubAnonymousCredentials struct{}
GithubAnonymousCredentials expose no credentials.
func (*GithubAnonymousCredentials) Client ¶ added in v0.14.0
func (c *GithubAnonymousCredentials) Client() (*http.Client, error)
Client returns a client with no credentials.
func (*GithubAnonymousCredentials) GetToken ¶ added in v0.14.0
func (c *GithubAnonymousCredentials) GetToken() (string, error)
GetToken returns an empty token.
func (*GithubAnonymousCredentials) GetUser ¶ added in v0.14.0
func (c *GithubAnonymousCredentials) GetUser() (string, error)
GetUser returns the username for these credentials.
type GithubAppCredentials ¶ added in v0.14.0
type GithubAppCredentials struct { AppID int64 Key []byte Hostname string InstallationID int64 AppSlug string // contains filtered or unexported fields }
GithubAppCredentials implements GithubCredentials for github app installation token flow.
func (*GithubAppCredentials) Client ¶ added in v0.14.0
func (c *GithubAppCredentials) Client() (*http.Client, error)
Client returns a github app installation client.
func (*GithubAppCredentials) GetToken ¶ added in v0.14.0
func (c *GithubAppCredentials) GetToken() (string, error)
GetToken returns a fresh installation token.
func (*GithubAppCredentials) GetUser ¶ added in v0.14.0
func (c *GithubAppCredentials) GetUser() (string, error)
GetUser returns the username for these credentials.
type GithubAppTemporarySecrets ¶ added in v0.14.0
type GithubAppTemporarySecrets struct { // ID is the app id. ID int64 // Key is the app's PEM-encoded key. Key string // Name is the app name. Name string // WebhookSecret is the generated webhook secret for this app. WebhookSecret string // URL is a link to the app, like https://github.com/apps/octoapp. URL string }
GithubAppTemporarySecrets holds app credentials obtained from github after creation.
type GithubClient ¶
type GithubClient struct {
// contains filtered or unexported fields
}
GithubClient is used to perform GitHub actions.
func NewGithubClient ¶
func NewGithubClient(hostname string, credentials GithubCredentials, config GithubConfig, logger logging.SimpleLogging) (*GithubClient, error)
NewGithubClient returns a valid GitHub client.
func (*GithubClient) CreateComment ¶
func (g *GithubClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, command string) error
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) DiscardReviews ¶ added in v0.22.0
func (g *GithubClient) DiscardReviews(repo models.Repo, pull models.PullRequest) error
DiscardReviews dismisses all reviews on a pull request
func (*GithubClient) ExchangeCode ¶ added in v0.14.0
func (g *GithubClient) ExchangeCode(logger logging.SimpleLogging, code string) (*GithubAppTemporarySecrets, error)
ExchangeCode returns a newly created app's info
func (*GithubClient) GetCloneURL ¶ added in v0.19.8
func (g *GithubClient) GetCloneURL(logger logging.SimpleLogging, _ models.VCSHostType, repo string) (string, error)
func (*GithubClient) GetCombinedStatusMinusApply ¶ added in v0.19.9
func (g *GithubClient) GetCombinedStatusMinusApply(logger logging.SimpleLogging, repo models.Repo, pull *github.PullRequest, vcstatusname string) (bool, error)
GetCombinedStatusMinusApply checks Statuses for PR, excluding atlantis apply. Returns true if all other statuses are not in failure.
func (*GithubClient) GetFileContent ¶ added in v0.22.0
func (g *GithubClient) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
GetFileContent a repository file content from VCS (which support fetch a single file from repository) The first return value indicates whether the repo contains a file or not if BaseRepo had a file, its content will placed on the second return value
func (*GithubClient) GetModifiedFiles ¶
func (g *GithubClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
GetModifiedFiles returns the names of files that were modified in the pull request relative to the repo root, e.g. parent/child/file.txt.
func (*GithubClient) GetPullLabels ¶ added in v0.26.0
func (g *GithubClient) GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
func (*GithubClient) GetPullRequest ¶
func (g *GithubClient) GetPullRequest(logger logging.SimpleLogging, repo models.Repo, num int) (*github.PullRequest, error)
GetPullRequest returns the pull request.
func (*GithubClient) GetPullReviewDecision ¶ added in v0.19.9
func (g *GithubClient) GetPullReviewDecision(repo models.Repo, pull models.PullRequest) (approvalStatus bool, err error)
GetPullReviewDecision gets the pull review decision, which takes into account CODEOWNERS
func (*GithubClient) GetTeamNamesForUser ¶ added in v0.18.0
GetTeamNamesForUser returns the names of the teams or groups that the user belongs to (in the organization the repository belongs to). https://docs.github.com/en/graphql/reference/objects#organization
func (*GithubClient) HidePrevCommandComments ¶ added in v0.17.1
func (g *GithubClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, dir string) error
func (*GithubClient) MarkdownPullLink ¶ added in v0.13.0
func (g *GithubClient) MarkdownPullLink(pull models.PullRequest) (string, error)
MarkdownPullLink specifies the string used in a pull request comment to reference another pull request.
func (*GithubClient) MergePull ¶ added in v0.4.14
func (g *GithubClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, _ models.PullRequestOptions) error
MergePull merges the pull request.
func (*GithubClient) PullIsApproved ¶
func (g *GithubClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (approvalStatus models.ApprovalStatus, err error)
PullIsApproved returns true if the pull request was approved.
func (*GithubClient) PullIsMergeable ¶ added in v0.4.13
func (g *GithubClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, vcsstatusname string) (bool, error)
PullIsMergeable returns true if the pull request is mergeable.
func (*GithubClient) ReactToComment ¶ added in v0.24.0
func (g *GithubClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, _ int, commentID int64, reaction string) error
ReactToComment adds a reaction to a comment.
func (*GithubClient) SupportsSingleFileDownload ¶ added in v0.15.0
func (g *GithubClient) SupportsSingleFileDownload(_ models.Repo) bool
func (*GithubClient) UpdateStatus ¶
func (g *GithubClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error
UpdateStatus updates the status badge on the pull request. See https://github.com/blog/1227-commit-status-api.
type GithubConfig ¶ added in v0.19.9
type GithubConfig struct {
AllowMergeableBypassApply bool
}
GithubConfig allows for custom github-specific functionality and behavior
type GithubCredentials ¶ added in v0.14.0
type GithubCredentials interface { Client() (*http.Client, error) GetToken() (string, error) GetUser() (string, error) }
GithubCredentials handles creating http.Clients that authenticate.
type GithubPRReviewSummary ¶ added in v0.22.0
type GithubPRReviewSummary struct { ReviewDecision githubv4.String Reviews []GithubReview }
type GithubPullRequestGetter ¶ added in v0.19.3
type GithubPullRequestGetter interface {
GetPullRequest(logger logging.SimpleLogging, repo models.Repo, pullNum int) (*github.PullRequest, error)
}
type GithubReview ¶ added in v0.22.0
type GithubUserCredentials ¶ added in v0.14.0
GithubUserCredentials implements GithubCredentials for the personal auth token flow.
func (*GithubUserCredentials) Client ¶ added in v0.14.0
func (c *GithubUserCredentials) Client() (*http.Client, error)
Client returns a client for basic auth user credentials.
func (*GithubUserCredentials) GetToken ¶ added in v0.14.0
func (c *GithubUserCredentials) GetToken() (string, error)
GetToken returns the user token.
func (*GithubUserCredentials) GetUser ¶ added in v0.14.0
func (c *GithubUserCredentials) GetUser() (string, error)
GetUser returns the username for these credentials.
type GitlabClient ¶
type GitlabClient struct { Client *gitlab.Client // Version is set to the server version. Version *version.Version // PollingInterval is the time between successive polls, where applicable. PollingInterval time.Duration // PollingInterval is the total duration for which to poll, where applicable. PollingTimeout time.Duration }
func NewGitlabClient ¶ added in v0.4.12
func NewGitlabClient(hostname string, token string, logger logging.SimpleLogging) (*GitlabClient, error)
NewGitlabClient returns a valid GitLab client.
func (*GitlabClient) CreateComment ¶
func (g *GitlabClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, _ string) error
CreateComment creates a comment on the merge request.
func (*GitlabClient) DiscardReviews ¶ added in v0.22.0
func (g *GitlabClient) DiscardReviews(_ models.Repo, _ models.PullRequest) error
func (*GitlabClient) GetCloneURL ¶ added in v0.19.8
func (g *GitlabClient) GetCloneURL(logger logging.SimpleLogging, _ models.VCSHostType, repo string) (string, error)
func (*GitlabClient) GetFileContent ¶ added in v0.22.0
func (g *GitlabClient) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
GetFileContent a repository file content from VCS (which support fetch a single file from repository) The first return value indicates whether the repo contains a file or not if BaseRepo had a file, its content will placed on the second return value
func (*GitlabClient) GetMergeRequest ¶
func (g *GitlabClient) GetMergeRequest(logger logging.SimpleLogging, repoFullName string, pullNum int) (*gitlab.MergeRequest, error)
func (*GitlabClient) GetModifiedFiles ¶
func (g *GitlabClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
GetModifiedFiles returns the names of files that were modified in the merge request relative to the repo root, e.g. parent/child/file.txt.
func (*GitlabClient) GetPullLabels ¶ added in v0.26.0
func (g *GitlabClient) GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
func (*GitlabClient) GetTeamNamesForUser ¶ added in v0.18.0
GetTeamNamesForUser returns the names of the teams or groups that the user belongs to (in the organization the repository belongs to).
func (*GitlabClient) GetVersion ¶ added in v0.4.12
func (g *GitlabClient) GetVersion(logger logging.SimpleLogging) (*version.Version, error)
GetVersion returns the version of the Gitlab server this client is using.
func (*GitlabClient) HidePrevCommandComments ¶ added in v0.17.1
func (g *GitlabClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, dir string) error
func (*GitlabClient) MarkdownPullLink ¶ added in v0.13.0
func (g *GitlabClient) MarkdownPullLink(pull models.PullRequest) (string, error)
MarkdownPullLink specifies the string used in a pull request comment to reference another pull request.
func (*GitlabClient) MergePull ¶ added in v0.4.14
func (g *GitlabClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, pullOptions models.PullRequestOptions) error
MergePull merges the merge request.
func (*GitlabClient) PullIsApproved ¶
func (g *GitlabClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (approvalStatus models.ApprovalStatus, err error)
PullIsApproved returns true if the merge request was approved.
func (*GitlabClient) PullIsMergeable ¶ added in v0.4.13
func (g *GitlabClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, vcsstatusname string) (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. In order to check if the repo required these, we'd need to make another API call to get the repo settings. 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) ReactToComment ¶ added in v0.24.0
func (g *GitlabClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, reaction string) error
ReactToComment adds a reaction to a comment.
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) SupportsDetailedMergeStatus ¶ added in v0.23.4
func (g *GitlabClient) SupportsDetailedMergeStatus(logger logging.SimpleLogging) (bool, error)
func (*GitlabClient) SupportsSingleFileDownload ¶ added in v0.15.0
func (g *GitlabClient) SupportsSingleFileDownload(_ models.Repo) bool
func (*GitlabClient) UpdateStatus ¶
func (g *GitlabClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error
UpdateStatus updates the build status of a commit.
func (*GitlabClient) WaitForSuccessPipeline ¶ added in v0.17.3
func (g *GitlabClient) WaitForSuccessPipeline(logger logging.SimpleLogging, ctx context.Context, pull models.PullRequest)
type IGithubClient ¶ added in v0.19.3
type IGithubClient interface { Client GithubPullRequestGetter }
IGithubClient exists to bridge the gap between GithubPullRequestGetter and Client interface to allow for a single instrumented client
func NewInstrumentedGithubClient ¶ added in v0.19.3
func NewInstrumentedGithubClient(client *GithubClient, statsScope tally.Scope, logger logging.SimpleLogging) IGithubClient
NewInstrumentedGithubClient creates a client proxy responsible for gathering stats and logging
type InstrumentedClient ¶ added in v0.19.3
type InstrumentedClient struct { Client StatsScope tally.Scope Logger logging.SimpleLogging }
func (*InstrumentedClient) CreateComment ¶ added in v0.19.3
func (c *InstrumentedClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, command string) error
func (*InstrumentedClient) GetModifiedFiles ¶ added in v0.19.3
func (c *InstrumentedClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
func (*InstrumentedClient) HidePrevCommandComments ¶ added in v0.19.3
func (c *InstrumentedClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, dir string) error
func (*InstrumentedClient) MergePull ¶ added in v0.19.3
func (c *InstrumentedClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, pullOptions models.PullRequestOptions) error
func (*InstrumentedClient) PullIsApproved ¶ added in v0.19.3
func (c *InstrumentedClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)
func (*InstrumentedClient) PullIsMergeable ¶ added in v0.19.3
func (c *InstrumentedClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, vcsstatusname string) (bool, error)
func (*InstrumentedClient) ReactToComment ¶ added in v0.24.0
func (c *InstrumentedClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, reaction string) error
func (*InstrumentedClient) UpdateStatus ¶ added in v0.19.3
func (c *InstrumentedClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error
type InstrumentedGithubClient ¶ added in v0.19.3
type InstrumentedGithubClient struct { *InstrumentedClient PullRequestGetter GithubPullRequestGetter StatsScope tally.Scope Logger logging.SimpleLogging }
InstrumentedGithubClient should delegate to the underlying InstrumentedClient for vcs provider-agnostic methods and implement solely any github specific interfaces.
func (*InstrumentedGithubClient) GetPullRequest ¶ added in v0.19.3
func (c *InstrumentedGithubClient) GetPullRequest(logger logging.SimpleLogging, repo models.Repo, pullNum int) (*github.PullRequest, error)
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 (a *NotConfiguredVCSClient) CreateComment(_ logging.SimpleLogging, _ models.Repo, _ int, _ string, _ string) error
func (*NotConfiguredVCSClient) DiscardReviews ¶ added in v0.22.0
func (a *NotConfiguredVCSClient) DiscardReviews(_ models.Repo, _ models.PullRequest) error
func (*NotConfiguredVCSClient) GetCloneURL ¶ added in v0.19.8
func (a *NotConfiguredVCSClient) GetCloneURL(_ logging.SimpleLogging, _ models.VCSHostType, _ string) (string, error)
func (*NotConfiguredVCSClient) GetFileContent ¶ added in v0.22.0
func (a *NotConfiguredVCSClient) GetFileContent(_ logging.SimpleLogging, _ models.PullRequest, _ string) (bool, []byte, error)
func (*NotConfiguredVCSClient) GetModifiedFiles ¶
func (a *NotConfiguredVCSClient) GetModifiedFiles(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest) ([]string, error)
func (*NotConfiguredVCSClient) GetPullLabels ¶ added in v0.26.0
func (a *NotConfiguredVCSClient) GetPullLabels(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest) ([]string, error)
func (*NotConfiguredVCSClient) GetTeamNamesForUser ¶ added in v0.18.0
func (*NotConfiguredVCSClient) HidePrevCommandComments ¶ added in v0.17.1
func (a *NotConfiguredVCSClient) HidePrevCommandComments(_ logging.SimpleLogging, _ models.Repo, _ int, _ string, _ string) error
func (*NotConfiguredVCSClient) MarkdownPullLink ¶ added in v0.13.0
func (a *NotConfiguredVCSClient) MarkdownPullLink(_ models.PullRequest) (string, error)
func (*NotConfiguredVCSClient) MergePull ¶ added in v0.4.14
func (a *NotConfiguredVCSClient) MergePull(_ logging.SimpleLogging, _ models.PullRequest, _ models.PullRequestOptions) error
func (*NotConfiguredVCSClient) PullIsApproved ¶
func (a *NotConfiguredVCSClient) PullIsApproved(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest) (models.ApprovalStatus, error)
func (*NotConfiguredVCSClient) PullIsMergeable ¶ added in v0.4.13
func (a *NotConfiguredVCSClient) PullIsMergeable(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest, _ string) (bool, error)
func (*NotConfiguredVCSClient) ReactToComment ¶ added in v0.24.0
func (a *NotConfiguredVCSClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, reaction string) error
func (*NotConfiguredVCSClient) SupportsSingleFileDownload ¶ added in v0.15.0
func (a *NotConfiguredVCSClient) SupportsSingleFileDownload(_ models.Repo) bool
func (*NotConfiguredVCSClient) UpdateStatus ¶
func (a *NotConfiguredVCSClient) UpdateStatus(_ logging.SimpleLogging, _ models.Repo, _ models.PullRequest, _ models.CommitStatus, _ string, _ string, _ string) error
type PullReqStatusFetcher ¶ added in v0.17.6
type PullReqStatusFetcher interface {
FetchPullStatus(logger logging.SimpleLogging, pull models.PullRequest) (models.PullReqStatus, error)
}
func NewPullReqStatusFetcher ¶ added in v0.17.6
func NewPullReqStatusFetcher(client Client, vcsStatusName string) PullReqStatusFetcher
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bitbucketcloud holds code for Bitbucket Cloud aka (bitbucket.org).
|
Package bitbucketcloud holds code for Bitbucket Cloud aka (bitbucket.org). |
Package common is used to share common code between all VCS clients without running into circular dependency issues.
|
Package common is used to share common code between all VCS clients without running into circular dependency issues. |