vcs

package
v0.0.0-...-d123b64 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGitHub

func NewGitHub(config Config) interfaces.VCS

NewGitHub creates a new instance of the GitHub struct.

func NewIsolatedVCS

func NewIsolatedVCS(times uint) interfaces.VCS

NewIsolatedVCS returns a new instance of IsolatedVCS.

Types

type Config

type Config struct {
	// VCSPat is the personal access token for the customer's VCS account. It must have
	// the necessary permissions to open pull requests and push commits to the VCSRepo specified below.
	VCSPat string `required:"true"`

	// VCSRepo is the full path of the repo containing a customer's infrastructure specification.
	VCSRepo string `required:"true"`

	// PullReviewers is the name of the pull request reviewer who will be tagged on the opened pull request.
	PullReviewers []string `default:"NoReviewer"`
}

Config contains the values that allow for authentication and the specific repo traits needed.

type Factory

type Factory struct{}

Factory is a struct that generates implementations of interfaces.VCS

func (*Factory) Instantiate

func (f *Factory) Instantiate(_ context.Context, environment string, config Config, vcsSystem string) (interfaces.VCS, error)

Instantiate returns an implementation of interfaces.VCS depending on the passed environment specification.

type GitHub

type GitHub struct {

	// ID is a string which is a random, 10 character unique identifier
	// for a cloud-concierge built commit/pull request
	ID string
	// contains filtered or unexported fields
}

GitHub struct implements the VCS interface.

func (*GitHub) AddChanges

func (g *GitHub) AddChanges() error

AddChanges adds all code changes to be included in the next commit.

func (*GitHub) Checkout

func (g *GitHub) Checkout(jobName string) error

Checkout creates a new branch within the remote repository.

func (*GitHub) Clone

func (g *GitHub) Clone() error

Clone pulls a remote repository's contents into local memory.

func (*GitHub) Commit

func (g *GitHub) Commit() error

Commit commits code changes to the current branch of the remote repository.

func (*GitHub) GetDefaultBranch

func (g *GitHub) GetDefaultBranch() error

GetDefaultBranch returns the default branch of the repository.

func (*GitHub) GetID

func (g *GitHub) GetID() (string, error)

GetID returns a string which is a random, 10 character unique identifier for a cloud-concierge built commit/pull request

func (*GitHub) OpenPullRequest

func (g *GitHub) OpenPullRequest(jobName string) (string, error)

OpenPullRequest opens a new pull request of committed changes to the remote repository.

func (*GitHub) Push

func (g *GitHub) Push() error

Push pushes current branch to remote repository.

func (*GitHub) SetToken

func (g *GitHub) SetToken()

SetToken sets the GitHub token for the GitHub struct.

type IsolatedVCS

type IsolatedVCS struct {
	CloneTimes uint
}

IsolatedVCS is a struct that implements interfaces.VCS for the purpose of end-to-end testing.

func (*IsolatedVCS) AddChanges

func (v *IsolatedVCS) AddChanges() error

AddChanges adds all code changes to be included in the next commit.

func (*IsolatedVCS) Checkout

func (v *IsolatedVCS) Checkout(_ string) error

Checkout creates a new branch within the remote repository.

func (*IsolatedVCS) Clone

func (v *IsolatedVCS) Clone() error

Clone pulls a remote repository's contents into local memory.

func (*IsolatedVCS) Commit

func (v *IsolatedVCS) Commit() error

Commit commits code changes to the current branch of the remote repository.

func (*IsolatedVCS) GetID

func (v *IsolatedVCS) GetID() (string, error)

GetID returns a string which is a random, 10 character unique identifier for a dragondrop built commit/pull request

func (*IsolatedVCS) OpenPullRequest

func (v *IsolatedVCS) OpenPullRequest(_ string) (string, error)

OpenPullRequest opens a new pull request of committed changes to the remote repository, and returns the url of this pull request

func (*IsolatedVCS) Push

func (v *IsolatedVCS) Push() error

Push pushes current branch to remote repository.

func (*IsolatedVCS) SetToken

func (v *IsolatedVCS) SetToken()

SetToken sets the token for the VCS

Jump to

Keyboard shortcuts

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