utils

package
v0.0.0-...-77ee0b1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneGitRepoAndDoAction

func CloneGitRepoAndDoAction(repoUrl string, branch string, token string, action action) error

func CollapsedGraph

func CollapsedGraph(impactedParent *string, currentNode string, adjMap map[string]map[string]graph.Edge[string], g graph.Graph[string, configuration.Project], impactedProjects map[string]configuration.Project) error

func ConvertJobsToDiggerJobs

func ConvertJobsToDiggerJobs(jobType orchestrator.DiggerCommand, organisationId uint, jobsMap map[string]orchestrator.Job, projectMap map[string]configuration.Project, projectsGraph graph.Graph[string, configuration.Project], githubInstallationId int64, branch string, prNumber int, repoOwner string, repoName string, repoFullName string, commitSha string, commentId int64, diggerConfigStr string) (*uuid.UUID, map[string]*models.DiggerJob, error)

ConvertJobsToDiggerJobs jobs is map with project name as a key and a Job as a value

func GetGithubClient

func GetGithubClient(gh GithubClientProvider, installationId int64, repoFullName string) (*github.Client, *string, error)

func GetGithubService

func GetGithubService(gh GithubClientProvider, installationId int64, repoFullName string, repoOwner string, repoName string) (*github2.GithubService, *string, error)

func GetWorkflowIdAndUrlFromDiggerJobId

func GetWorkflowIdAndUrlFromDiggerJobId(client *github.Client, repoOwner string, repoName string, diggerJobID string) (int64, string, error)

func ImpactedProjectsOnlyGraph

func ImpactedProjectsOnlyGraph(projectsGraph graph.Graph[string, configuration.Project], impactedProjectMap map[string]configuration.Project) (graph.Graph[string, configuration.Project], error)

func ReportInitialJobsStatus

func ReportInitialJobsStatus(cr *CommentReporter, jobs []orchestrator.Job) error

func ReportNoProjectsImpacted

func ReportNoProjectsImpacted(cr *CommentReporter, jobs []orchestrator.Job) error

func SetPRStatusForJobs

func SetPRStatusForJobs(prService *github2.GithubService, prNumber int, jobs []orchestrator.Job) error

func TraverseGraphVisitAllParentsFirst

func TraverseGraphVisitAllParentsFirst(g graph.Graph[string, configuration.Project], visit func(value string) bool) error

Types

type CommentReporter

type CommentReporter struct {
	PrNumber  int
	PrService *github2.GithubService
	CommentId int64
}

func InitCommentReporter

func InitCommentReporter(prService *github2.GithubService, prNumber int, commentMessage string) (*CommentReporter, error)

type DiggerGithubClientMockProvider

type DiggerGithubClientMockProvider struct {
	MockedHTTPClient *net.Client
}

func (*DiggerGithubClientMockProvider) Get

func (gh *DiggerGithubClientMockProvider) Get(githubAppId int64, installationId int64) (*github.Client, *string, error)

func (DiggerGithubClientMockProvider) NewClient

func (gh DiggerGithubClientMockProvider) NewClient(netClient *net.Client) (*github.Client, error)

type DiggerGithubRealClientProvider

type DiggerGithubRealClientProvider struct {
}

just a wrapper around github client to be able to use mocks

func (DiggerGithubRealClientProvider) Get

func (gh DiggerGithubRealClientProvider) Get(githubAppId int64, installationId int64) (*github.Client, *string, error)

func (DiggerGithubRealClientProvider) NewClient

func (gh DiggerGithubRealClientProvider) NewClient(netClient *net.Client) (*github.Client, error)

type GithubClientProvider

type GithubClientProvider interface {
	NewClient(netClient *net.Client) (*github.Client, error)
	Get(githubAppId int64, installationId int64) (*github.Client, *string, error)
}

Jump to

Keyboard shortcuts

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