vcs

package
v0.39.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 3 Imported by: 51

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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, ignoreVCSStatusNames []string) (models.MergeableStatus, 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(logger logging.SimpleLogging, 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(logger logging.SimpleLogging, 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, repo models.Repo, branch string, 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 NewClientProxy(githubClient Client, gitlabClient Client, bitbucketCloudClient Client, bitbucketServerClient Client, azuredevopsClient Client, giteaClient Client) *ClientProxy

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(logger logging.SimpleLogging, 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, repo models.Repo, branch string, 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 (d *ClientProxy) GetTeamNamesForUser(logger logging.SimpleLogging, repo models.Repo, user models.User) ([]string, error)

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 (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, ignoreVCSStatusNames []string) (models.MergeableStatus, 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 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 (*NotConfiguredVCSClient) GetCloneURL added in v0.19.8

func (*NotConfiguredVCSClient) GetFileContent added in v0.22.0

func (a *NotConfiguredVCSClient) GetFileContent(_ logging.SimpleLogging, _ models.Repo, _ string, _ string) (bool, []byte, error)

func (*NotConfiguredVCSClient) GetModifiedFiles

func (*NotConfiguredVCSClient) GetPullLabels added in v0.26.0

func (*NotConfiguredVCSClient) GetTeamNamesForUser added in v0.18.0

func (a *NotConfiguredVCSClient) GetTeamNamesForUser(_ logging.SimpleLogging, _ models.Repo, _ models.User) ([]string, error)

func (*NotConfiguredVCSClient) HidePrevCommandComments added in v0.17.1

func (a *NotConfiguredVCSClient) HidePrevCommandComments(_ logging.SimpleLogging, _ models.Repo, _ int, _ string, _ string) error
func (a *NotConfiguredVCSClient) MarkdownPullLink(_ models.PullRequest) (string, error)

func (*NotConfiguredVCSClient) MergePull added in v0.4.14

func (*NotConfiguredVCSClient) PullIsApproved

func (*NotConfiguredVCSClient) PullIsMergeable added in v0.4.13

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

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, ignoreVCSStatusNames []string) PullReqStatusFetcher

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL