orchestrator

package
v1.310.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Index

Constants

View Source
const (
	BuildStatusSuccess    = "SUCCESS"
	BuildStatusAborted    = "ABORTED"
	BuildStatusFailure    = "FAILURE"
	BuildStatusInProgress = "IN_PROGRESS"

	BuildReasonManual          = "Manual"
	BuildReasonSchedule        = "Schedule"
	BuildReasonPullRequest     = "PullRequest"
	BuildReasonResourceTrigger = "ResourceTrigger"
	BuildReasonIndividualCI    = "IndividualCI"
	BuildReasonUnknown         = "Unknown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureDevOpsConfigProvider

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

func (*AzureDevOpsConfigProvider) GetBranch added in v1.149.0

func (a *AzureDevOpsConfigProvider) GetBranch() string

GetBranch returns the source branch name, e.g. main

func (*AzureDevOpsConfigProvider) GetBuildID added in v1.207.0

func (a *AzureDevOpsConfigProvider) GetBuildID() string

GetBuildID returns the BuildNumber displayed in the ADO UI

func (*AzureDevOpsConfigProvider) GetBuildReason added in v1.207.0

func (a *AzureDevOpsConfigProvider) GetBuildReason() string

GetBuildReason returns the build reason

func (*AzureDevOpsConfigProvider) GetBuildStatus added in v1.180.0

func (a *AzureDevOpsConfigProvider) GetBuildStatus() string

GetBuildStatus returns status of the build. Return variables are aligned with Jenkins build statuses.

func (*AzureDevOpsConfigProvider) GetBuildURL added in v1.207.0

func (a *AzureDevOpsConfigProvider) GetBuildURL() string

GetBuildURL returns the builds URL e.g. https://dev.azure.com/fabrikamfiber/your-repo-name/_build/results?buildId=1234

func (*AzureDevOpsConfigProvider) GetChangeSet added in v1.230.0

func (a *AzureDevOpsConfigProvider) GetChangeSet() []ChangeSet

func (*AzureDevOpsConfigProvider) GetCommit added in v1.149.0

func (a *AzureDevOpsConfigProvider) GetCommit() string

GetCommit returns commit SHA of current build

func (*AzureDevOpsConfigProvider) GetJobName added in v1.180.0

func (a *AzureDevOpsConfigProvider) GetJobName() string

GetJobName returns the pipeline job name, currently org/repo

func (*AzureDevOpsConfigProvider) GetJobURL added in v1.207.0

func (a *AzureDevOpsConfigProvider) GetJobURL() string

GetJobURL returns tje current job url e.g. https://dev.azure.com/fabrikamfiber/your-repo-name/_build?definitionId=1234

func (*AzureDevOpsConfigProvider) GetLog added in v1.180.0

func (a *AzureDevOpsConfigProvider) GetLog() ([]byte, error)

GetLog returns the whole logfile for the current pipeline run

func (*AzureDevOpsConfigProvider) GetPipelineStartTime added in v1.180.0

func (a *AzureDevOpsConfigProvider) GetPipelineStartTime() time.Time

GetPipelineStartTime returns the pipeline start time in UTC

func (*AzureDevOpsConfigProvider) GetPullRequestConfig

func (a *AzureDevOpsConfigProvider) GetPullRequestConfig() PullRequestConfig

GetPullRequestConfig returns pull request configuration

func (*AzureDevOpsConfigProvider) GetReference added in v1.228.0

func (a *AzureDevOpsConfigProvider) GetReference() string

GetReference return the git reference

func (*AzureDevOpsConfigProvider) GetRepoURL added in v1.207.0

func (a *AzureDevOpsConfigProvider) GetRepoURL() string

GetRepoURL returns current repo URL e.g. https://github.com/SAP/jenkins-library

func (*AzureDevOpsConfigProvider) GetStageName added in v1.169.0

func (a *AzureDevOpsConfigProvider) GetStageName() string

GetStageName returns the human-readable name given to a stage. e.g. "Promote" or "Init"

func (*AzureDevOpsConfigProvider) InitOrchestratorProvider added in v1.180.0

func (a *AzureDevOpsConfigProvider) InitOrchestratorProvider(settings *OrchestratorSettings)

InitOrchestratorProvider initializes http client for AzureDevopsConfigProvider

func (*AzureDevOpsConfigProvider) IsPullRequest

func (a *AzureDevOpsConfigProvider) IsPullRequest() bool

IsPullRequest indicates whether the current build is a PR

func (*AzureDevOpsConfigProvider) OrchestratorType added in v1.180.0

func (a *AzureDevOpsConfigProvider) OrchestratorType() string

OrchestratorType returns the orchestrator name e.g. Azure/GitHubActions/Jenkins

func (*AzureDevOpsConfigProvider) OrchestratorVersion added in v1.180.0

func (a *AzureDevOpsConfigProvider) OrchestratorVersion() string

OrchestratorVersion returns the agent version on ADO

type ChangeSet added in v1.230.0

type ChangeSet struct {
	CommitId  string
	Timestamp string
	PrNumber  int
}

type GitHubActionsConfigProvider

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

func (*GitHubActionsConfigProvider) GetBranch added in v1.149.0

func (g *GitHubActionsConfigProvider) GetBranch() string

GetBranch returns the source branch name, e.g. main

func (*GitHubActionsConfigProvider) GetBuildID added in v1.207.0

func (g *GitHubActionsConfigProvider) GetBuildID() string

GetBuildID returns current run ID

func (*GitHubActionsConfigProvider) GetBuildReason added in v1.207.0

func (g *GitHubActionsConfigProvider) GetBuildReason() string

GetBuildReason returns the reason of workflow trigger. BuildReasons are unified with AzureDevOps build reasons, see https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services

func (*GitHubActionsConfigProvider) GetBuildStatus added in v1.180.0

func (g *GitHubActionsConfigProvider) GetBuildStatus() string

GetBuildStatus returns current run status

func (*GitHubActionsConfigProvider) GetBuildURL added in v1.207.0

func (g *GitHubActionsConfigProvider) GetBuildURL() string

GetBuildURL returns the builds URL. For example, https://github.com/SAP/jenkins-library/actions/runs/5815297487

func (*GitHubActionsConfigProvider) GetChangeSet added in v1.230.0

func (g *GitHubActionsConfigProvider) GetChangeSet() []ChangeSet

func (*GitHubActionsConfigProvider) GetCommit added in v1.149.0

func (g *GitHubActionsConfigProvider) GetCommit() string

GetCommit returns the commit SHA that triggered the workflow. For example, ffac537e6cbbf934b08745a378932722df287a53

func (*GitHubActionsConfigProvider) GetJobName added in v1.180.0

func (g *GitHubActionsConfigProvider) GetJobName() string

GetJobName returns the current workflow name. For example, "Piper workflow"

func (*GitHubActionsConfigProvider) GetJobURL added in v1.207.0

func (g *GitHubActionsConfigProvider) GetJobURL() string

GetJobURL returns the current job HTML URL (not API URL). For example, https://github.com/SAP/jenkins-library/actions/runs/123456/jobs/7654321

func (*GitHubActionsConfigProvider) GetLog added in v1.180.0

func (g *GitHubActionsConfigProvider) GetLog() ([]byte, error)

GetLog returns the whole logfile for the current pipeline run

func (*GitHubActionsConfigProvider) GetPipelineStartTime added in v1.180.0

func (g *GitHubActionsConfigProvider) GetPipelineStartTime() time.Time

GetPipelineStartTime returns the pipeline start time in UTC

func (*GitHubActionsConfigProvider) GetPullRequestConfig

func (g *GitHubActionsConfigProvider) GetPullRequestConfig() PullRequestConfig

GetPullRequestConfig returns pull request configuration

func (*GitHubActionsConfigProvider) GetReference added in v1.228.0

func (g *GitHubActionsConfigProvider) GetReference() string

GetReference return the git reference. For example, refs/heads/your_branch_name

func (*GitHubActionsConfigProvider) GetRepoURL added in v1.207.0

func (g *GitHubActionsConfigProvider) GetRepoURL() string

GetRepoURL returns full url to repository. For example, https://github.com/SAP/jenkins-library

func (*GitHubActionsConfigProvider) GetStageName added in v1.169.0

func (g *GitHubActionsConfigProvider) GetStageName() string

GetStageName returns the human-readable name given to a stage.

func (*GitHubActionsConfigProvider) InitOrchestratorProvider added in v1.180.0

func (g *GitHubActionsConfigProvider) InitOrchestratorProvider(settings *OrchestratorSettings)

InitOrchestratorProvider initializes http client for GitHubActionsDevopsConfigProvider

func (*GitHubActionsConfigProvider) IsPullRequest

func (g *GitHubActionsConfigProvider) IsPullRequest() bool

IsPullRequest indicates whether the current build is triggered by a PR

func (*GitHubActionsConfigProvider) OrchestratorType added in v1.180.0

func (g *GitHubActionsConfigProvider) OrchestratorType() string

func (*GitHubActionsConfigProvider) OrchestratorVersion added in v1.180.0

func (g *GitHubActionsConfigProvider) OrchestratorVersion() string

type JenkinsConfigProvider

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

func (*JenkinsConfigProvider) GetBranch added in v1.149.0

func (j *JenkinsConfigProvider) GetBranch() string

GetBranch returns the branch name, only works with the git plugin enabled

func (*JenkinsConfigProvider) GetBuildID added in v1.207.0

func (j *JenkinsConfigProvider) GetBuildID() string

GetBuildID returns the build ID of the current job, e.g. 1234

func (*JenkinsConfigProvider) GetBuildReason added in v1.207.0

func (j *JenkinsConfigProvider) GetBuildReason() string

GetBuildReason returns the build reason of the current build

func (*JenkinsConfigProvider) GetBuildStatus added in v1.180.0

func (j *JenkinsConfigProvider) GetBuildStatus() string

GetBuildStatus returns build status of the current job

func (*JenkinsConfigProvider) GetBuildURL added in v1.207.0

func (j *JenkinsConfigProvider) GetBuildURL() string

GetBuildURL returns the build url, e.g. https://jaas.url/job/foo/job/bar/job/main/1234/

func (*JenkinsConfigProvider) GetChangeSet added in v1.230.0

func (j *JenkinsConfigProvider) GetChangeSet() []ChangeSet

GetChangeSet returns the commitIds and timestamp of the changeSet of the current run

func (*JenkinsConfigProvider) GetCommit added in v1.149.0

func (j *JenkinsConfigProvider) GetCommit() string

GetCommit returns the commit SHA from the current build, only works with the git plugin enabled

func (*JenkinsConfigProvider) GetJobName added in v1.180.0

func (j *JenkinsConfigProvider) GetJobName() string

GetJobName returns the job name of the current job e.g. foo/bar/BRANCH

func (*JenkinsConfigProvider) GetJobURL added in v1.207.0

func (j *JenkinsConfigProvider) GetJobURL() string

GetJobURL returns the current job URL e.g. https://jaas.url/job/foo/job/bar/job/main

func (*JenkinsConfigProvider) GetLog added in v1.180.0

func (j *JenkinsConfigProvider) GetLog() ([]byte, error)

GetLog returns the logfile from the current job as byte object

func (*JenkinsConfigProvider) GetPipelineStartTime added in v1.180.0

func (j *JenkinsConfigProvider) GetPipelineStartTime() time.Time

GetPipelineStartTime returns the pipeline start time in UTC

func (*JenkinsConfigProvider) GetPullRequestConfig

func (j *JenkinsConfigProvider) GetPullRequestConfig() PullRequestConfig

GetPullRequestConfig returns the pull request config

func (*JenkinsConfigProvider) GetReference added in v1.228.0

func (j *JenkinsConfigProvider) GetReference() string

GetReference returns the git reference, only works with the git plugin enabled

func (*JenkinsConfigProvider) GetRepoURL added in v1.207.0

func (j *JenkinsConfigProvider) GetRepoURL() string

GetRepoURL returns the repo URL of the current build, only works with the git plugin enabled

func (*JenkinsConfigProvider) GetStageName added in v1.169.0

func (j *JenkinsConfigProvider) GetStageName() string

GetStageName returns the stage name the job is currently in, e.g. Promote

func (*JenkinsConfigProvider) InitOrchestratorProvider added in v1.180.0

func (j *JenkinsConfigProvider) InitOrchestratorProvider(settings *OrchestratorSettings)

InitOrchestratorProvider initializes the Jenkins orchestrator with credentials

func (*JenkinsConfigProvider) IsPullRequest

func (j *JenkinsConfigProvider) IsPullRequest() bool

IsPullRequest returns boolean indicating if current job is a PR

func (*JenkinsConfigProvider) OrchestratorType added in v1.180.0

func (j *JenkinsConfigProvider) OrchestratorType() string

OrchestratorType returns the orchestrator type Jenkins

func (*JenkinsConfigProvider) OrchestratorVersion added in v1.180.0

func (j *JenkinsConfigProvider) OrchestratorVersion() string

OrchestratorVersion returns the orchestrator version currently running on

type Orchestrator

type Orchestrator int
const (
	Unknown Orchestrator = iota
	AzureDevOps
	GitHubActions
	Jenkins
)

func DetectOrchestrator

func DetectOrchestrator() Orchestrator

DetectOrchestrator returns the name of the current orchestrator e.g. Jenkins, Azure, Unknown

func (Orchestrator) String

func (o Orchestrator) String() string

type OrchestratorSettings added in v1.180.0

type OrchestratorSettings struct {
	JenkinsUser  string
	JenkinsToken string
	AzureToken   string
	GitHubToken  string
}

OrchestratorSettings struct to set orchestrator specific settings e.g. Jenkins credentials

type OrchestratorSpecificConfigProviding

type OrchestratorSpecificConfigProviding interface {
	InitOrchestratorProvider(settings *OrchestratorSettings)
	OrchestratorType() string
	OrchestratorVersion() string
	GetStageName() string
	GetBranch() string
	GetReference() string
	GetBuildURL() string
	GetBuildID() string
	GetJobURL() string
	GetJobName() string
	GetCommit() string
	GetPullRequestConfig() PullRequestConfig
	GetRepoURL() string
	IsPullRequest() bool
	GetLog() ([]byte, error)
	GetPipelineStartTime() time.Time
	GetBuildStatus() string
	GetBuildReason() string
	GetChangeSet() []ChangeSet
}

func NewOrchestratorSpecificConfigProvider

func NewOrchestratorSpecificConfigProvider() (OrchestratorSpecificConfigProviding, error)

type PullRequestConfig

type PullRequestConfig struct {
	Branch string
	Base   string
	Key    string
}

type UnknownOrchestratorConfigProvider added in v1.180.0

type UnknownOrchestratorConfigProvider struct{}

func (*UnknownOrchestratorConfigProvider) GetBranch added in v1.180.0

GetBranch returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetBuildID added in v1.207.0

func (u *UnknownOrchestratorConfigProvider) GetBuildID() string

GetBuildID returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetBuildReason added in v1.207.0

func (u *UnknownOrchestratorConfigProvider) GetBuildReason() string

GetBuildReason returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetBuildStatus added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) GetBuildStatus() string

GetBuildStatus returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetBuildURL added in v1.207.0

func (u *UnknownOrchestratorConfigProvider) GetBuildURL() string

GetBuildURL returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetChangeSet added in v1.230.0

func (u *UnknownOrchestratorConfigProvider) GetChangeSet() []ChangeSet

func (*UnknownOrchestratorConfigProvider) GetCommit added in v1.180.0

GetCommit returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetJobName added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) GetJobName() string

GetJobName returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetJobURL added in v1.207.0

GetJobURL returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetLog added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) GetLog() ([]byte, error)

GetLog returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetPipelineStartTime added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) GetPipelineStartTime() time.Time

GetPipelineStartTime returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetPullRequestConfig added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) GetPullRequestConfig() PullRequestConfig

GetPullRequestConfig returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetReference added in v1.228.0

func (u *UnknownOrchestratorConfigProvider) GetReference() string

GetReference returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetRepoURL added in v1.207.0

func (u *UnknownOrchestratorConfigProvider) GetRepoURL() string

GetRepoURL returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) GetStageName added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) GetStageName() string

GetStageName returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) InitOrchestratorProvider added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) InitOrchestratorProvider(settings *OrchestratorSettings)

InitOrchestratorProvider returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) IsPullRequest added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) IsPullRequest() bool

IsPullRequest returns false for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) OrchestratorType added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) OrchestratorType() string

OrchestratorType returns n/a for the unknownOrchestrator

func (*UnknownOrchestratorConfigProvider) OrchestratorVersion added in v1.180.0

func (u *UnknownOrchestratorConfigProvider) OrchestratorVersion() string

OrchestratorVersion returns n/a for the unknownOrchestrator

Jump to

Keyboard shortcuts

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