orchestrator

package
v0.0.0-...-76a1d4b Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetProviderFromRole

func GetProviderFromRole(role string) *stscreds.WebIdentityRoleProvider

func IsApplyJobSpecs

func IsApplyJobSpecs(jobs []JobJson) bool

func IsApplyJobs

func IsApplyJobs(jobs []JobJson) bool

func IsPlanJobSpecs

func IsPlanJobSpecs(jobs []JobJson) bool

func IsPlanJobs

func IsPlanJobs(jobs []Job) bool

func ParseProjectName

func ParseProjectName(comment string) string

Types

type Comment

type Comment struct {
	Id   interface{}
	Body *string
}

type GithubAwsTokenFetcher

type GithubAwsTokenFetcher struct{}

func (GithubAwsTokenFetcher) GetIdentityToken

func (fetcher GithubAwsTokenFetcher) GetIdentityToken() ([]byte, error)

type Issue

type Issue struct {
	ID    int64
	Title string
	Body  string
}

type Job

type Job struct {
	ProjectName        string
	ProjectDir         string
	ProjectWorkspace   string
	ProjectWorkflow    string
	Terragrunt         bool
	OpenTofu           bool
	Commands           []string
	ApplyStage         *Stage
	PlanStage          *Stage
	PullRequestNumber  *int
	EventName          string
	RequestedBy        string
	Namespace          string
	RunEnvVars         map[string]string
	StateEnvVars       map[string]string
	CommandEnvVars     map[string]string
	StateEnvProvider   *stscreds.WebIdentityRoleProvider
	CommandEnvProvider *stscreds.WebIdentityRoleProvider
}

func ConvertProjectsToJobs

func ConvertProjectsToJobs(actor string, repoNamespace string, command string, prNumber int, impactedProjects []digger_config.Project, requestedProject *digger_config.Project, workflows map[string]digger_config.Workflow) ([]Job, bool, error)

func JsonToJob

func JsonToJob(jobJson JobJson) Job

func (*Job) IsApply

func (j *Job) IsApply() bool

func (*Job) IsPlan

func (j *Job) IsPlan() bool

func (*Job) PopulateAwsCredentialsEnvVarsForJob

func (job *Job) PopulateAwsCredentialsEnvVarsForJob() error

type JobJson

type JobJson struct {
	ProjectName             string            `json:"projectName"`
	ProjectDir              string            `json:"projectDir"`
	ProjectWorkspace        string            `json:"projectWorkspace"`
	Terragrunt              bool              `json:"terragrunt"`
	Commands                []string          `json:"commands"`
	ApplyStage              StageJson         `json:"applyStage"`
	PlanStage               StageJson         `json:"planStage"`
	PullRequestNumber       *int              `json:"pullRequestNumber"`
	EventName               string            `json:"eventName"`
	RequestedBy             string            `json:"requestedBy"`
	Namespace               string            `json:"namespace"`
	RunEnvVars              map[string]string `json:"runEnvVars"`
	StateEnvVars            map[string]string `json:"stateEnvVars"`
	CommandEnvVars          map[string]string `json:"commandEnvVars"`
	StateRoleName           string            `json:"state_role_name"`
	CommandRoleName         string            `json:"command_role_name"`
	BackendHostname         string            `json:"backend_hostname"`
	BackendOrganisationName string            `json:"backend_organisation_hostname"`
	BackendJobToken         string            `json:"backend_job_token"`
}

func JobToJson

func JobToJson(job Job, organisationName string, jobToken string, backendHostname string, project digger_config.Project) JobJson

func (*JobJson) IsApply

func (j *JobJson) IsApply() bool

func (*JobJson) IsPlan

func (j *JobJson) IsPlan() bool

type OrgService

type OrgService interface {
	GetUserTeams(organisation string, user string) ([]string, error)
}

type PullRequestService

type PullRequestService interface {
	GetChangedFiles(prNumber int) ([]string, error)
	PublishComment(prNumber int, comment string) (int64, error)
	ListIssues() ([]*Issue, error)
	PublishIssue(title string, body string) (int64, error)
	EditComment(prNumber int, id interface{}, comment string) error
	GetComments(prNumber int) ([]Comment, error)
	GetApprovals(prNumber int) ([]string, error)
	// SetStatus set status of specified pull/merge request, status could be: "pending", "failure", "success"
	SetStatus(prNumber int, status string, statusContext string) error
	GetCombinedPullRequestStatus(prNumber int) (string, error)
	MergePullRequest(prNumber int) error
	// IsMergeable is still open and ready to be merged
	IsMergeable(prNumber int) (bool, error)
	// IsMerged merged and closed
	IsMerged(prNumber int) (bool, error)
	// IsClosed closed without merging
	IsClosed(prNumber int) (bool, error)
	GetBranchName(prNumber int) (string, error)
	SetOutput(prNumber int, key string, value string) error
}

type Stage

type Stage struct {
	Steps []Step
}

func ToConfigStage

func ToConfigStage(configStage *configuration.Stage) *Stage

type StageJson

type StageJson struct {
	Steps []StepJson `json:"steps"`
}

type Step

type Step struct {
	Action    string
	Value     string
	ExtraArgs []string
	Shell     string
}

func ToConfigStep

func ToConfigStep(configState configuration.Step) Step

type StepJson

type StepJson struct {
	Action    string   `json:"action"`
	Value     string   `json:"value"`
	ExtraArgs []string `json:"extraArgs"`
	Shell     string   `json:"shell"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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