vcs

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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)
	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)
	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 (d *DefaultClientProxy) CreateComment(repo models.Repo, pullNum int, comment string) error

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) 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

func (g *GithubClient) CreateComment(repo models.Repo, pullNum int, comment 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) 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) 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
}

func (*GitlabClient) CreateComment

func (g *GitlabClient) CreateComment(repo models.Repo, pullNum int, comment string) error

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) PullIsApproved

func (g *GitlabClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)

PullIsApproved returns true if the merge request was approved.

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 (a *NotConfiguredVCSClient) CreateComment(repo models.Repo, pullNum int, comment string) error

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) UpdateStatus

func (a *NotConfiguredVCSClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, description string) error

Directories

Path Synopsis
Package bitbucketcloud holds code for Bitbucket Cloud aka (bitbucket.org).
Package bitbucketcloud holds code for Bitbucket Cloud aka (bitbucket.org).

Jump to

Keyboard shortcuts

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