workflowv3

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Parameters   map[string]ActionParameter `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Requirements []Requirement              `json:"requirements,omitempty" yaml:"requirements,omitempty"`
	Steps        []Step                     `json:"steps,omitempty" yaml:"steps,omitempty"`
}

func (Action) GetLocalDependencies

func (a Action) GetLocalDependencies() []string

func (Action) Validate

func (a Action) Validate(w Workflow) (ExternalDependencies, error)

type ActionParameter

type ActionParameter struct {
	Type        string `json:"type,omitempty" yaml:"type,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

type Actions

type Actions map[string]Action

func (Actions) ExistAction

func (a Actions) ExistAction(actionName string) bool

func (Actions) ToGraph

func (a Actions) ToGraph() Graph

type ArtifactManager

type ArtifactManager string

func (ArtifactManager) Validate

func (a ArtifactManager) Validate() (ExternalDependencies, error)

type Check

type Check struct {
	Variable string `json:"variable,omitempty" yaml:"variable,omitempty"`
	Operator string `json:"operator,omitempty" yaml:"operator,omitempty"`
	Value    string `json:"value,omitempty" yaml:"value,omitempty"`
}

type Condition

type Condition struct {
	Checks []Check `json:"checks,omitempty" yaml:"checks,omitempty"`
	Script string  `json:"script,omitempty" yaml:"script,omitempty"`
}

func (*Condition) Merge

func (c *Condition) Merge(o Condition)

type ContextRaw

type ContextRaw string

func (ContextRaw) Parse

func (c ContextRaw) Parse() (bool, ContextType, string, error)

type ContextType

type ContextType string
const (
	ContextTypeRepository ContextType = "repository"
	ContextTypeVar        ContextType = "var"
	ContextTypeSecret     ContextType = "secret"
)

func (ContextType) Validate

func (c ContextType) Validate() error

type Deployment

type Deployment struct {
	Integration string           `json:"integration,omitempty" yaml:"integration,omitempty"` // should be @
	Config      DeploymentConfig `json:"config,omitempty" yaml:"config,omitempty"`
}

func (Deployment) Validate

func (d Deployment) Validate() (ExternalDependencies, error)

type DeploymentConfig

type DeploymentConfig map[string]DeploymentConfigValue

type DeploymentConfigValue

type DeploymentConfigValue struct {
	Type  string `json:"type,omitempty" yaml:"type,omitempty"`
	Value string `json:"value,omitempty" yaml:"value,omitempty"`
}

type Deployments

type Deployments map[string]Deployment

func (Deployments) ExistDeployment

func (d Deployments) ExistDeployment(deploymentName string) bool

type ExternalDependencies

type ExternalDependencies struct {
	Repositories []string `json:"repositories,omitempty"`
	Variables    []string `json:"variables,omitempty"`
	Secrets      []string `json:"secrets,omitempty"`
	VCSServers   []string `json:"vcs_servers,omitempty"`
	Actions      []string `json:"actions,omitempty"`
	Integrations []string `json:"integrations,omitempty"`
	Deployments  []string `json:"deployments,omitempty"`
	SSHKeys      []string `json:"ssh_keys,omitempty"`
	PGPKeys      []string `json:"pgp_keys,omitempty"`
}

func (*ExternalDependencies) Add

type Graph

type Graph []Node

func (Graph) DetectLoops

func (g Graph) DetectLoops() error

func (Graph) RemoveRootNodes

func (g Graph) RemoveRootNodes() (int, Graph)

type Hook

type Hook struct {
	Type   string            `json:"type,omitempty" yaml:"type,omitempty"`
	On     string            `json:"on,omitempty" yaml:"on,omitempty"` // can be @
	Config map[string]string `json:"config,omitempty" yaml:"config,omitempty"`
}

func (Hook) Validate

func (h Hook) Validate(w Workflow) (ExternalDependencies, error)

type Job

type Job struct {
	ID           string                       `json:"-" yaml:"-"`
	Enabled      *bool                        `json:"enabled,omitempty" yaml:"enabled,omitempty"`
	Description  string                       `json:"description,omitempty" yaml:"description,omitempty"`
	Conditions   *Condition                   `json:"conditions,omitempty" yaml:"conditions,omitempty"`
	Context      []ContextRaw                 `json:"context,omitempty" yaml:"context,omitempty"` // can be @
	Stage        string                       `json:"stage,omitempty" yaml:"stage,omitempty"`
	Steps        []Step                       `json:"steps,omitempty" yaml:"steps,omitempty"`
	Requirements []exportentities.Requirement `json:"requirements,omitempty" yaml:"requirements,omitempty"`
	DependsOn    []string                     `json:"depends_on,omitempty" yaml:"depends_on,omitempty"`
}

func ConvertJob

func ConvertJob(j sdk.Job, isFullExport bool) Job

func (Job) Validate

func (j Job) Validate(w Workflow) (ExternalDependencies, error)

type JobRun

type JobRun struct {
	Status     string       `json:"status,omitempty" yaml:"status,omitempty"`
	SubNumber  int64        `json:"sub_number,omitempty" yaml:"sub_number,omitempty"`
	StepStatus []StepStatus `json:"step_status,omitempty" yaml:"step_status,omitempty"`
	// Info from workflow v2 model
	WorkflowNodeRunID    int64 `json:"workflow_node_run_id,omitempty" yaml:"workflow_node_run_id,omitempty"`
	WorkflowNodeJobRunID int64 `json:"workflow_node_job_run_id,omitempty" yaml:"workflow_node_job_run_id,omitempty"`
}

type Jobs

type Jobs map[string]Job

func (Jobs) ExistJob

func (j Jobs) ExistJob(jobName string) bool

func (Jobs) FilterByStage

func (j Jobs) FilterByStage(stageName string) Jobs

func (Jobs) ToGraphs

func (j Jobs) ToGraphs() []Graph

type Key

type Key struct {
	Type KeyType `json:"type,omitempty" yaml:"type,omitempty"`
}

func (Key) Validate

func (k Key) Validate(w Workflow) error

type KeyType

type KeyType string
const (
	SSHKeyType KeyType = "ssh"
	PGPKeyType KeyType = "pgp"
)

func (KeyType) Validate

func (k KeyType) Validate() error

type Keys

type Keys map[string]Key

func (Keys) ExistKey

func (d Keys) ExistKey(keyName string, t KeyType) bool

type Node

type Node struct {
	Name      string
	DependsOn []string
}

type Notification

type Notification struct {
	Type NotificationType `json:"type,omitempty" yaml:"type,omitempty"`
	Jobs []string         `json:"jobs,omitempty" yaml:"jobs,omitempty"`
}

func (Notification) Validate

func (n Notification) Validate(w Workflow) error

type NotificationType

type NotificationType string
const (
	NotificationTypeEmails NotificationType = "emails"
)

func (NotificationType) Validate

func (n NotificationType) Validate() error

type Repositories

type Repositories map[string]Repository

func (Repositories) ExistRepo

func (r Repositories) ExistRepo(repoName string) bool

type Repository

type Repository struct {
	Slug       string `json:"slug,omitempty" yaml:"slug,omitempty"`
	Server     string `json:"server,omitempty" yaml:"server,omitempty"` // should be @
	Connection string `json:"connection,omitempty" yaml:"connection,omitempty"`
	SSHKey     string `json:"ssh_key,omitempty" yaml:"ssh_key,omitempty"` // can be @
	PGPKey     string `json:"pgp_key,omitempty" yaml:"pgp_key,omitempty"` // can be @
}

func (Repository) Validate

func (r Repository) Validate(w Workflow) (ExternalDependencies, error)

type Requirement

type Requirement struct {
	Binary            string             `json:"binary,omitempty" yaml:"binary,omitempty"`
	Model             string             `json:"model,omitempty" yaml:"model,omitempty"`
	Hostname          string             `json:"hostname,omitempty" yaml:"hostname,omitempty"`
	Plugin            string             `json:"plugin,omitempty" yaml:"plugin,omitempty"`
	Service           ServiceRequirement `json:"service,omitempty" yaml:"service,omitempty"`
	Memory            string             `json:"memory,omitempty" yaml:"memory,omitempty"`
	OSArchRequirement string             `json:"os-architecture,omitempty" yaml:"os-architecture,omitempty"`
	RegionRequirement string             `json:"region,omitempty" yaml:"region,omitempty"`
}

type Secret

type Secret string

type Secrets

type Secrets map[string]Secret

func (Secrets) ExistSecret

func (s Secrets) ExistSecret(secretName string) bool

type ServiceRequirement

type ServiceRequirement struct {
	Name  string `json:"name,omitempty" yaml:"name,omitempty"`
	Value string `json:"value,omitempty" yaml:"value,omitempty"`
}

type Stage

type Stage struct {
	DependsOn  []string   `json:"depends_on,omitempty" yaml:"depends_on,omitempty"`
	Conditions *Condition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
}

func (Stage) Validate

func (s Stage) Validate(name string, w Workflow) error

type Stages

type Stages map[string]Stage

func (Stages) ExistStage

func (s Stages) ExistStage(stageName string) bool

func (Stages) ToGraph

func (s Stages) ToGraph() Graph

type Step

type Step struct {
	exportentities.StepCustom `json:"-" yaml:",inline"`
	Script                    *StepScript                          `json:"script,omitempty" yaml:"script,omitempty"`
	PushBuildInfo             *exportentities.StepPushBuildInfo    `json:"pushBuildInfo,omitempty" yaml:"pushBuildInfo,omitempty"`
	Coverage                  *exportentities.StepCoverage         `json:"coverage,omitempty" yaml:"coverage,omitempty"`
	ArtifactDownload          *exportentities.StepArtifactDownload `json:"artifactDownload,omitempty" yaml:"artifactDownload,omitempty"`
	ArtifactUpload            *exportentities.StepArtifactUpload   `json:"artifactUpload,omitempty" yaml:"artifactUpload,omitempty"`
	GitClone                  *exportentities.StepGitClone         `json:"gitClone,omitempty" yaml:"gitClone,omitempty"`
	GitTag                    *exportentities.StepGitTag           `json:"gitTag,omitempty" yaml:"gitTag,omitempty"`
	ReleaseVCS                *exportentities.StepReleaseVCS       `json:"releaseVCS,omitempty" yaml:"releaseVCS,omitempty"`
	Release                   *exportentities.StepRelease          `json:"release,omitempty" yaml:"release,omitempty"`
	JUnitReport               *exportentities.StepJUnitReport      `json:"jUnitReport,omitempty" yaml:"jUnitReport,omitempty"`
	Checkout                  *exportentities.StepCheckout         `json:"checkout,omitempty" yaml:"checkout,omitempty"`
	InstallKey                *exportentities.StepInstallKey       `json:"installKey,omitempty" yaml:"installKey,omitempty"`
	Deploy                    *exportentities.StepDeploy           `json:"deploy,omitempty" yaml:"deploy,omitempty"`
	Promote                   *exportentities.StepPromote          `json:"promote,omitempty" yaml:"promote,omitempty"`
	AsCodeAction              *exportentities.StepAscodeAction     `json:"asCodeAction,omitempty" yaml:"asCodeAction,omitempty"`
}

func (Step) MarshalJSON

func (s Step) MarshalJSON() ([]byte, error)

func (*Step) UnmarshalJSON

func (s *Step) UnmarshalJSON(data []byte) error

func (Step) Validate

func (s Step) Validate(w Workflow) (ExternalDependencies, error)

type StepScript

type StepScript interface{}

type StepStatus

type StepStatus struct {
	StepOrder int64     `json:"step_order" yaml:"step_order"`
	Status    string    `json:"status,omitempty" yaml:"status,omitempty"`
	Start     time.Time `json:"start,omitempty" yaml:"start,omitempty"`
	Done      time.Time `json:"done,omitempty" yaml:"done,omitempty"`
}

type ValidationResponse

type ValidationResponse struct {
	Valid                bool                 `json:"valid,omitempty"`
	Error                string               `json:"error,omitempty"`
	Workflow             Workflow             `json:"workflow,omitempty"`
	ExternalDependencies ExternalDependencies `json:"external_dependencies,omitempty"`
}

type Variable

type Variable interface{}

type Variables

type Variables map[string]Variable

func (Variables) ExistVariable

func (v Variables) ExistVariable(variableName string) bool

func (*Variables) UnmarshalYAML

func (v *Variables) UnmarshalYAML(unmarshal func(interface{}) error) error

type Workflow

type Workflow struct {
	Name            string                  `json:"name,omitempty" yaml:"name,omitempty"`
	Repositories    Repositories            `json:"repositories,omitempty" yaml:"repositories,omitempty"`
	Hooks           map[string]Hook         `json:"hooks,omitempty" yaml:"hooks,omitempty"`
	Deployments     Deployments             `json:"deployments,omitempty" yaml:"deployments,omitempty"`
	ArtifactManager ArtifactManager         `json:"artifact_manager,omitempty" yaml:"artifact_manager,omitempty"`
	Notifications   map[string]Notification `json:"notifications,omitempty" yaml:"notifications,omitempty"`
	Stages          Stages                  `json:"stages,omitempty" yaml:"stages,omitempty"`
	Jobs            Jobs                    `json:"jobs,omitempty" yaml:"jobs,omitempty"`
	Variables       Variables               `json:"variables,omitempty" yaml:"variables,omitempty"`
	Secrets         Secrets                 `json:"secrets,omitempty" yaml:"secrets,omitempty"`
	Actions         Actions                 `json:"actions,omitempty" yaml:"actions,omitempty"`
	Keys            Keys                    `json:"keys,omitempty" yaml:"keys,omitempty"`
}

func Convert

func Convert(w sdk.Workflow, isFullExport bool) Workflow

func NewWorkflow

func NewWorkflow() Workflow

func (*Workflow) Add

func (w *Workflow) Add(wf Workflow) error

func (Workflow) Validate

func (w Workflow) Validate() (ExternalDependencies, error)

type WorkflowRun

type WorkflowRun struct {
	Number    int64                `json:"number,omitempty" yaml:"number,omitempty"`
	Infos     sdk.WorkflowRunInfos `json:"infos,omitempty" yaml:"infos,omitempty"`
	Status    string               `json:"status,omitempty" yaml:"status,omitempty"`
	JobRuns   map[string][]JobRun  `json:"job_runs,omitempty" yaml:"job_runs,omitempty"`
	Resources WorkflowRunResources `json:"resources,omitempty" yaml:"resources,omitempty"`
}

func ConvertRun

func ConvertRun(wr *sdk.WorkflowRun, isFullExport bool) WorkflowRun

func NewWorkflowRun

func NewWorkflowRun() WorkflowRun

type WorkflowRunResources

type WorkflowRunResources struct {
	Workflow     Workflow                 `json:"workflow,omitempty" yaml:"workflow,omitempty"`
	Integrations []sdk.ProjectIntegration `json:"integrations,omitempty" yaml:"integrations,omitempty"`
}

Jump to

Keyboard shortcuts

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