v2

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntegrationArtifactManager = "artifact_manager"
)

Variables

View Source
var (
	True  = true
	False = false
)

Booleans

Functions

func CheckWorkflowNotificationsValidity

func CheckWorkflowNotificationsValidity(w Workflow) error

func ProcessNotificationValues

func ProcessNotificationValues(notif NotificationEntry) (sdk.WorkflowNotification, error)

func WorkflowSkipIfOnlyOneRepoWebhook

func WorkflowSkipIfOnlyOneRepoWebhook(w sdk.Workflow, exportedWorkflow *Workflow) error

WorkflowSkipIfOnlyOneRepoWebhook skips the repo webhook if it's the only one It also won't export the default payload

func WorkflowWithPermissions

func WorkflowWithPermissions(w sdk.Workflow, exportedWorkflow *Workflow) error

WorkflowWithPermissions export workflow with permissions

Types

type ConditionEntry

type ConditionEntry struct {
	PlainConditions []PlainConditionEntry `json:"check,omitempty" yaml:"check,omitempty"`
	LuaScript       string                `json:"script,omitempty" yaml:"script,omitempty"`
}

type ExportOptions

type ExportOptions func(w sdk.Workflow, exportedWorkflow *Workflow) error

type HookEntry

type HookEntry struct {
	Model      string                      `` /* 143-byte string literal not displayed */
	Config     map[string]string           `json:"config,omitempty" yaml:"config,omitempty"`
	Conditions *sdk.WorkflowNodeConditions `` /* 175-byte string literal not displayed */
}

HookEntry represents a hook as code

func (HookEntry) IsDefault

func (h HookEntry) IsDefault(model sdk.WorkflowHookModel) bool

type NodeEntry

type NodeEntry struct {
	ID                     int64                  `json:"-" yaml:"-"`
	DependsOn              []string               ``                                                                                                                      /* 141-byte string literal not displayed */
	Conditions             *ConditionEntry        ``                                                                                                                      /* 175-byte string literal not displayed */
	When                   []string               `json:"when,omitempty" yaml:"when,omitempty" jsonschema_description:"Set manual and status condition (ex: 'success')."` //This is used only for manual and success condition
	PipelineName           string                 `json:"pipeline,omitempty" yaml:"pipeline,omitempty" jsonschema_description:"The name of a pipeline used for pipeline node."`
	ApplicationName        string                 `` /* 200-byte string literal not displayed */
	EnvironmentName        string                 `` /* 200-byte string literal not displayed */
	ProjectIntegrationName string                 `` /* 200-byte string literal not displayed */
	OneAtATime             *bool                  `` /* 164-byte string literal not displayed */
	Payload                map[string]interface{} `json:"payload,omitempty" yaml:"payload,omitempty"`
	Parameters             map[string]string      `json:"parameters,omitempty" yaml:"parameters,omitempty" jsonschema_description:"List of parameters for the workflow."`
	OutgoingHookModelName  string                 `json:"trigger,omitempty" yaml:"trigger,omitempty"`
	OutgoingHookConfig     map[string]string      `json:"config,omitempty" yaml:"config,omitempty"`
	Permissions            map[string]int         `` /* 182-byte string literal not displayed */
}

NodeEntry represents a node as code

type NotificationEntry

type NotificationEntry struct {
	Type        string                        `json:"type" yaml:"type"`
	Pipelines   []string                      `json:"pipelines" yaml:"pipelines,omitempty"`
	Settings    *sdk.UserNotificationSettings `json:"settings,omitempty" yaml:"settings,omitempty"`
	Integration string                        `json:"integration,omitempty" yaml:"integration,omitempty"`
}

NotificationEntry represents a notification set on a nodeEntry

type PlainConditionEntry

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

WorkflowNodeCondition represents a condition to trigger ot not a pipeline in a workflow. Operator can be =, !=, regex

type VariableValue

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

VariableValue is a struct to export a value of Variable

type Workflow

type Workflow struct {
	Name        string `json:"name" yaml:"name" jsonschema_description:"The name of the workflow."`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Version     string `json:"version,omitempty" yaml:"version,omitempty" jsonschema_description:"Version for the yaml syntax, latest is v2.0."`

	Workflow map[string]NodeEntry   `json:"workflow,omitempty" yaml:"workflow,omitempty" jsonschema_description:"Workflow nodes list."`
	Hooks    map[string][]HookEntry `json:"hooks,omitempty" yaml:"hooks,omitempty" jsonschema_description:"Workflow hooks list."`

	// extra workflow data
	Permissions                map[string]int                             `` /* 186-byte string literal not displayed */
	Metadata                   map[string]string                          `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	PurgeTags                  []string                                   `json:"purge_tags,omitempty" yaml:"purge_tags,omitempty"`
	RetentionPolicy            *string                                    `json:"retention_policy,omitempty" yaml:"retention_policy,omitempty"`
	Notifications              []NotificationEntry                        `json:"notifications,omitempty" yaml:"notifications,omitempty"` // This is used when the workflow have only one pipeline
	HistoryLength              *int64                                     `json:"history_length,omitempty" yaml:"history_length,omitempty"`
	WorkflowProjectIntegration map[string]WorkflowProjectIntegrationEntry `json:"integrations,omitempty" yaml:"integrations,omitempty"`
}

Workflow is the "as code" representation of a sdk.Workflow

func NewWorkflow

func NewWorkflow(ctx context.Context, w sdk.Workflow, version string, opts ...ExportOptions) (Workflow, error)

NewWorkflow creates a new exportable workflow

func (Workflow) CheckDependencies

func (w Workflow) CheckDependencies() error

func (Workflow) CheckValidity

func (w Workflow) CheckValidity() error

func (Workflow) GetName

func (w Workflow) GetName() string

func (Workflow) GetVersion

func (w Workflow) GetVersion() string

func (Workflow) GetWorkflow

func (w Workflow) GetWorkflow(ctx context.Context) (*sdk.Workflow, error)

GetWorkflow returns a fresh sdk.Workflow

type WorkflowProjectIntegrationEntry

type WorkflowProjectIntegrationEntry struct {
	IntegrationType string                   `json:"type,omitempty" yaml:"type,omitempty" jsonschema_description:"Type of integration"`
	Config          map[string]VariableValue `json:"config,omitempty" yaml:"config,omitempty" jsonschema_description:"Configuration of the linked integration"`
}

WorkflowProjectIntegrationEntry represents a integration linked to the workflow

Jump to

Keyboard shortcuts

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