utils

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayCommands

func DisplayCommands()

func GetCommands

func GetCommands() string

display commands as string

func GetVersion

func GetVersion() string

GetVersion returns the current version of the package

func ParseProjectName

func ParseProjectName(comment string) string

TODO move func to lib-orchestrator library after gitlab and azure moves there

func ParseWorkspace

func ParseWorkspace(comment string) (string, error)

TODO move func to lib-orchestrator library after gitlab and azure moves there

Types

type Command

type Command struct {
	Name        string
	Description string
}

type MockBackendApi

type MockBackendApi struct {
}

func (MockBackendApi) ReportProject

func (t MockBackendApi) ReportProject(namespace string, projectName string, configuration string) error

func (MockBackendApi) ReportProjectJobStatus

func (t MockBackendApi) ReportProjectJobStatus(namespace string, projectName string, jobId string, status string, timestamp time.Time) error

func (MockBackendApi) ReportProjectRun

func (t MockBackendApi) ReportProjectRun(namespace string, projectName string, startedAt time.Time, endedAt time.Time, status string, command string, output string) error

type MockGithubPullrequestManager

type MockGithubPullrequestManager struct {
	// contains filtered or unexported fields
}

func (*MockGithubPullrequestManager) DownloadLatestPlans

func (mockGithubPullrequestManager *MockGithubPullrequestManager) DownloadLatestPlans(prNumber int) (string, error)

func (*MockGithubPullrequestManager) EditComment

func (mockGithubPullrequestManager *MockGithubPullrequestManager) EditComment(prNumber int, commentId interface{}, comment string) error

func (*MockGithubPullrequestManager) GetApprovals added in v0.2.5

func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetApprovals(prNumber int) ([]string, error)

func (*MockGithubPullrequestManager) GetBranchName

func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetBranchName(prNumber int) (string, error)

func (*MockGithubPullrequestManager) GetChangedFiles

func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetChangedFiles(prNumber int) ([]string, error)

func (*MockGithubPullrequestManager) GetCombinedPullRequestStatus

func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetCombinedPullRequestStatus(prNumber int) (string, error)

func (*MockGithubPullrequestManager) GetComments

func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetComments(prNumber int) ([]orchestrator.Comment, error)

func (*MockGithubPullrequestManager) GetUserTeams

func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetUserTeams(organisation string, user string) ([]string, error)

func (*MockGithubPullrequestManager) IsClosed

func (mockGithubPullrequestManager *MockGithubPullrequestManager) IsClosed(prNumber int) (bool, error)

func (*MockGithubPullrequestManager) IsMergeable

func (mockGithubPullrequestManager *MockGithubPullrequestManager) IsMergeable(prNumber int) (bool, error)

func (*MockGithubPullrequestManager) IsMerged

func (mockGithubPullrequestManager *MockGithubPullrequestManager) IsMerged(prNumber int) (bool, error)

func (*MockGithubPullrequestManager) MergePullRequest

func (mockGithubPullrequestManager *MockGithubPullrequestManager) MergePullRequest(prNumber int) error

func (*MockGithubPullrequestManager) PublishComment

func (mockGithubPullrequestManager *MockGithubPullrequestManager) PublishComment(prNumber int, comment string) error

func (*MockGithubPullrequestManager) SetStatus

func (mockGithubPullrequestManager *MockGithubPullrequestManager) SetStatus(prNumber int, status string, statusContext string) error

type MockLock

type MockLock struct {
	MapLock map[string]int
}

func (*MockLock) GetLock

func (lock *MockLock) GetLock(resource string) (*int, error)

func (*MockLock) Lock

func (lock *MockLock) Lock(transactionId int, resource string) (bool, error)

func (*MockLock) Unlock

func (lock *MockLock) Unlock(resource string) (bool, error)

type MockPlanStorage

type MockPlanStorage struct {
}

func (MockPlanStorage) DeleteStoredPlan

func (t MockPlanStorage) DeleteStoredPlan(storedPlanFilePath string) error

func (MockPlanStorage) PlanExists

func (t MockPlanStorage) PlanExists(storedPlanFilePath string) (bool, error)

func (MockPlanStorage) RetrievePlan

func (t MockPlanStorage) RetrievePlan(localPlanFilePath string, storedPlanFilePath string) (*string, error)

func (MockPlanStorage) StorePlan

func (t MockPlanStorage) StorePlan(localPlanFilePath string, storedPlanFilePath string) error

type MockPolicyChecker

type MockPolicyChecker struct {
}

func (MockPolicyChecker) CheckAccessPolicy

func (t MockPolicyChecker) CheckAccessPolicy(ciService orchestrator.OrgService, prService *orchestrator.PullRequestService, SCMOrganisation string, SCMrepository string, projectName string, command string, ptr *int, requestedBy string, planPolicyViolations []string) (bool, error)

func (MockPolicyChecker) CheckDriftPolicy

func (t MockPolicyChecker) CheckDriftPolicy(SCMOrganisation string, SCMrepository string, projectname string) (bool, error)

func (MockPolicyChecker) CheckPlanPolicy

func (t MockPolicyChecker) CheckPlanPolicy(projectName string, SCMOrganisation string, command string, requestedBy string) (bool, []string, error)

type MockPullRequestManager

type MockPullRequestManager struct {
	ChangedFiles []string
	Teams        []string
	Approvals    []string
}

func (MockPullRequestManager) DownloadLatestPlans

func (t MockPullRequestManager) DownloadLatestPlans(prNumber int) (string, error)

func (MockPullRequestManager) EditComment

func (t MockPullRequestManager) EditComment(prNumber int, commentId interface{}, comment string) error

func (MockPullRequestManager) GetApprovals added in v0.2.5

func (t MockPullRequestManager) GetApprovals(prNumber int) ([]string, error)

func (MockPullRequestManager) GetBranchName

func (t MockPullRequestManager) GetBranchName(prNumber int) (string, error)

func (MockPullRequestManager) GetChangedFiles

func (t MockPullRequestManager) GetChangedFiles(prNumber int) ([]string, error)

func (MockPullRequestManager) GetCombinedPullRequestStatus

func (t MockPullRequestManager) GetCombinedPullRequestStatus(prNumber int) (string, error)

func (MockPullRequestManager) GetComments

func (t MockPullRequestManager) GetComments(prNumber int) ([]orchestrator.Comment, error)

func (MockPullRequestManager) GetUserTeams

func (t MockPullRequestManager) GetUserTeams(organisation string, user string) ([]string, error)

func (MockPullRequestManager) IsClosed

func (t MockPullRequestManager) IsClosed(prNumber int) (bool, error)

func (MockPullRequestManager) IsMergeable

func (t MockPullRequestManager) IsMergeable(prNumber int) (bool, error)

func (MockPullRequestManager) IsMerged

func (t MockPullRequestManager) IsMerged(prNumber int) (bool, error)

func (MockPullRequestManager) MergePullRequest

func (t MockPullRequestManager) MergePullRequest(prNumber int) error

func (MockPullRequestManager) PublishComment

func (t MockPullRequestManager) PublishComment(prNumber int, comment string) error

func (MockPullRequestManager) SetStatus

func (t MockPullRequestManager) SetStatus(prNumber int, status string, statusContext string) error

type MockReporter

type MockReporter struct {
	// contains filtered or unexported fields
}

func (*MockReporter) Report

func (mockReporter *MockReporter) Report(report string, formatter func(string) string) error

func (*MockReporter) SupportsMarkdown

func (mockReporter *MockReporter) SupportsMarkdown() bool

type MockTerraform

type MockTerraform struct {
	// contains filtered or unexported fields
}

func (*MockTerraform) Apply

func (tf *MockTerraform) Apply() (string, string, error)

func (*MockTerraform) Plan

func (tf *MockTerraform) Plan() (bool, string, string, error)

type Zip

type Zip interface {
	GetFileFromZip(zipFile string, filename string) (string, error)
}

type Zipper

type Zipper struct {
}

func (*Zipper) GetFileFromZip

func (z *Zipper) GetFileFromZip(zipFile string, filename string) (string, error)

Jump to

Keyboard shortcuts

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