utils

package
v0.0.0-...-78824f5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubOwner = "infra-manager-bootstrap-module"
	GitHubAppID = "68754904" // Found in the URL of your Cloud Build GitHub app configuration settings
)
View Source
const (
	GitlabGroup = "terraform-google-bootstrap"
)

Variables

This section is empty.

Functions

func GetDeleteProjectOptions

func GetDeleteProjectOptions() *gitlab.DeleteProjectOptions

GetDeleteProjectOptions returns default DeleteProjectOptions

func GetFileContents

func GetFileContents(t *testing.T, path string) []byte

GetFileContents returns the contents of a given file.

func GetRandomStringFromSetup

func GetRandomStringFromSetup(t *testing.T) string

GetRandomStringFromSetup gets a random string output variable setup.

func LastElement

func LastElement(str, sep string) string

LastElement gets the last element in a string separated by sep. Typically used to grab a resource ID from a full resource name.

Types

type GitHubClient

type GitHubClient struct {
	Repository *github.Repository
	// contains filtered or unexported fields
}

func NewGitHubClient

func NewGitHubClient(t *testing.T, token, repo string) *GitHubClient

func (*GitHubClient) ClosePullRequest

func (gh *GitHubClient) ClosePullRequest(ctx context.Context, pr *github.PullRequest)

func (*GitHubClient) CreatePullRequest

func (gh *GitHubClient) CreatePullRequest(ctx context.Context, title, branch, base string) *github.PullRequest

func (*GitHubClient) GetOpenPullRequest

func (gh *GitHubClient) GetOpenPullRequest(ctx context.Context, branch string) *github.PullRequest

GetOpenPullRequest gets an open pull request for a given branch if it exists.

func (*GitHubClient) GetRepository

func (gh *GitHubClient) GetRepository(ctx context.Context) *github.Repository

func (*GitHubClient) MergePullRequest

func (gh *GitHubClient) MergePullRequest(ctx context.Context, pr *github.PullRequest, commitTitle, commitMessage string) *github.PullRequestMergeResult

type GitLabClient

type GitLabClient struct {
	Project *gitlab.Project
	// contains filtered or unexported fields
}

func NewGitLabClient

func NewGitLabClient(t *testing.T, token, projectName string) *GitLabClient

func (*GitLabClient) AcceptMergeRequest

func (gl *GitLabClient) AcceptMergeRequest(mr *gitlab.MergeRequest, commitMessage string) *gitlab.MergeRequest

func (*GitLabClient) CloseMergeRequest

func (gl *GitLabClient) CloseMergeRequest(mr *gitlab.MergeRequest)

func (*GitLabClient) CreateMergeRequest

func (gl *GitLabClient) CreateMergeRequest(title, branch, base string) *gitlab.MergeRequest

func (*GitLabClient) DeleteWebhookByKey

func (gl *GitLabClient) DeleteWebhookByKey(webhookKey string)

DeleteWebhookByKey deletes webhooks for the project that contain the given key in their URL.

func (*GitLabClient) GetOpenMergeRequest

func (gl *GitLabClient) GetOpenMergeRequest(branch string) *gitlab.MergeRequest

GetOpenMergeRequest gets the last opened merge request for a given branch if it exists.

func (*GitLabClient) GetProject

func (gl *GitLabClient) GetProject() *gitlab.Project

func (*GitLabClient) ProjectName

func (gl *GitLabClient) ProjectName() string

Jump to

Keyboard shortcuts

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