models

package
v0.0.0-...-20fc352 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 13 Imported by: 37

Documentation

Index

Constants

View Source
const (
	FormatVersion       = "14"
	StepListItemWithKey = "with"
)

Variables

This section is empty.

Functions

func MergeStepWith

func MergeStepWith(step, otherStep stepmanModels.StepModel) (stepmanModels.StepModel, error)

Types

type AppModel

type AppModel struct {
	Title        string                              `json:"title,omitempty" yaml:"title,omitempty"`
	Summary      string                              `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description  string                              `json:"description,omitempty" yaml:"description,omitempty"`
	Environments []envmanModels.EnvironmentItemModel `json:"envs,omitempty" yaml:"envs,omitempty"`
}

func (*AppModel) FillMissingDefaults

func (app *AppModel) FillMissingDefaults() error

func (*AppModel) Normalize

func (app *AppModel) Normalize() error

func (*AppModel) Validate

func (app *AppModel) Validate() error

type BitriseDataModel

type BitriseDataModel struct {
	FormatVersion        string `json:"format_version" yaml:"format_version"`
	DefaultStepLibSource string `json:"default_step_lib_source,omitempty" yaml:"default_step_lib_source,omitempty"`
	ProjectType          string `json:"project_type" yaml:"project_type"`
	//
	Title       string `json:"title,omitempty" yaml:"title,omitempty"`
	Summary     string `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	//
	Services   map[string]Container     `json:"services" yaml:"services"`
	Containers map[string]Container     `json:"containers" yaml:"containers"`
	App        AppModel                 `json:"app,omitempty" yaml:"app,omitempty"`
	Meta       map[string]interface{}   `json:"meta,omitempty" yaml:"meta,omitempty"`
	TriggerMap TriggerMapModel          `json:"trigger_map,omitempty" yaml:"trigger_map,omitempty"`
	Pipelines  map[string]PipelineModel `json:"pipelines,omitempty" yaml:"pipelines,omitempty"`
	Stages     map[string]StageModel    `json:"stages,omitempty" yaml:"stages,omitempty"`
	Workflows  map[string]WorkflowModel `json:"workflows,omitempty" yaml:"workflows,omitempty"`
}

func (*BitriseDataModel) FillMissingDefaults

func (config *BitriseDataModel) FillMissingDefaults() error

func (*BitriseDataModel) Normalize

func (config *BitriseDataModel) Normalize() error

func (*BitriseDataModel) RemoveRedundantFields

func (config *BitriseDataModel) RemoveRedundantFields() error

func (*BitriseDataModel) Validate

func (config *BitriseDataModel) Validate() ([]string, error)

type BuildRunResultsModel

type BuildRunResultsModel struct {
	WorkflowID           string                `json:"workflow_id" yaml:"workflow_id"`
	EventName            string                `json:"event_name" yaml:"event_name"`
	ProjectType          string                `json:"project_type" yaml:"project_type"`
	StartTime            time.Time             `json:"start_time" yaml:"start_time"`
	StepmanUpdates       map[string]int        `json:"stepman_updates" yaml:"stepman_updates"`
	SuccessSteps         []StepRunResultsModel `json:"success_steps" yaml:"success_steps"`
	FailedSteps          []StepRunResultsModel `json:"failed_steps" yaml:"failed_steps"`
	FailedSkippableSteps []StepRunResultsModel `json:"failed_skippable_steps" yaml:"failed_skippable_steps"`
	SkippedSteps         []StepRunResultsModel `json:"skipped_steps" yaml:"skipped_steps"`
}

func (BuildRunResultsModel) ExitCode

func (buildRes BuildRunResultsModel) ExitCode() int

func (BuildRunResultsModel) HasFailedSkippableSteps

func (buildRes BuildRunResultsModel) HasFailedSkippableSteps() bool

func (BuildRunResultsModel) IsBuildFailed

func (buildRes BuildRunResultsModel) IsBuildFailed() bool

func (BuildRunResultsModel) IsStepLibUpdated

func (buildRes BuildRunResultsModel) IsStepLibUpdated(stepLib string) bool

func (BuildRunResultsModel) OrderedResults

func (buildRes BuildRunResultsModel) OrderedResults() []StepRunResultsModel

func (BuildRunResultsModel) ResultsCount

func (buildRes BuildRunResultsModel) ResultsCount() int

type BuildRunStartModel

type BuildRunStartModel struct {
	EventName   string    `json:"event_name" yaml:"event_name"`
	ProjectType string    `json:"project_type" yaml:"project_type"`
	StartTime   time.Time `json:"start_time" yaml:"start_time"`
}

type Container

type Container struct {
	Image       string                              `json:"image,omitempty" yaml:"image,omitempty"`
	Credentials DockerCredentials                   `json:"credentials,omitempty" yaml:"credentials,omitempty"`
	Ports       []string                            `json:"ports,omitempty" yaml:"ports,omitempty"`
	Envs        []envmanModels.EnvironmentItemModel `json:"envs,omitempty" yaml:"envs,omitempty"`
	Options     string                              `json:"options,omitempty" yaml:"options,omitempty"`
}

type DockerCredentials

type DockerCredentials struct {
	Username string `json:"username,omitempty" yaml:"username,omitempty"`
	Password string `json:"password,omitempty" yaml:"password,omitempty"`
	Server   string `json:"server,omitempty" yaml:"server,omitempty"`
}

type PipelineModel

type PipelineModel struct {
	Title       string               `json:"title,omitempty" yaml:"title,omitempty"`
	Summary     string               `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description string               `json:"description,omitempty" yaml:"description,omitempty"`
	Stages      []StageListItemModel `json:"stages,omitempty" yaml:"stages,omitempty"`
}

type PullRequestReadyState

type PullRequestReadyState string
const (
	PullRequestReadyStateDraft                     PullRequestReadyState = "draft"
	PullRequestReadyStateReadyForReview            PullRequestReadyState = "ready_for_review"
	PullRequestReadyStateConvertedToReadyForReview PullRequestReadyState = "converted_to_ready_for_review"
)

type StageListItemModel

type StageListItemModel map[string]StageModel

type StageModel

type StageModel struct {
	Title           string                       `json:"title,omitempty" yaml:"title,omitempty"`
	Summary         string                       `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description     string                       `json:"description,omitempty" yaml:"description,omitempty"`
	ShouldAlwaysRun bool                         `json:"should_always_run,omitempty" yaml:"should_always_run,omitempty"`
	AbortOnFail     bool                         `json:"abort_on_fail,omitempty" yaml:"abort_on_fail,omitempty"`
	RunIf           string                       `json:"run_if,omitempty" yaml:"run_if,omitempty"`
	Workflows       []StageWorkflowListItemModel `json:"workflows,omitempty" yaml:"workflows,omitempty"`
}

type StageWorkflowListItemModel

type StageWorkflowListItemModel map[string]StageWorkflowModel

type StageWorkflowModel

type StageWorkflowModel struct {
	RunIf string `json:"run_if,omitempty" yaml:"run_if,omitempty"`
}

type StepError

type StepError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type StepExecutionPlan

type StepExecutionPlan struct {
	UUID   string `json:"uuid"`
	StepID string `json:"step_id"`

	Step        stepmanModels.StepModel `json:"-"`
	GroupID     string                  `json:"-"`
	ContainerID string                  `json:"-"`
	ServiceIDs  []string                `json:"-"`
}

TODO: dispatch Plans from JSON event logging and actual workflow execution

type StepListItemModel

type StepListItemModel map[string]interface{}

func (*StepListItemModel) GetStepListItemKeyAndValue

func (stepListItem *StepListItemModel) GetStepListItemKeyAndValue() (string, stepmanModels.StepModel, WithModel, error)

GetStepListItemKeyAndValue returns the Step List Item key and value. The key is either a Step ID or 'with'. If the key is 'with' the returned WithModel is relevant otherwise the StepModel.

func (*StepListItemModel) UnmarshalYAML

func (stepListItem *StepListItemModel) UnmarshalYAML(unmarshal func(interface{}) error) error

type StepListStepItemModel

type StepListStepItemModel map[string]stepmanModels.StepModel

func (*StepListStepItemModel) GetStepIDAndStep

func (stepListStepItem *StepListStepItemModel) GetStepIDAndStep() (string, stepmanModels.StepModel, error)

type StepListWithItemModel

type StepListWithItemModel map[string]WithModel

type StepRunResultsModel

type StepRunResultsModel struct {
	StepInfo   stepmanModels.StepInfoModel `json:"step_info" yaml:"step_info"`
	StepInputs map[string]string           `json:"step_inputs" yaml:"step_inputs"`
	Status     StepRunStatus               `json:"status" yaml:"status"`
	Idx        int                         `json:"idx" yaml:"idx"`
	RunTime    time.Duration               `json:"run_time" yaml:"run_time"`
	StartTime  time.Time                   `json:"start_time" yaml:"start_time"`
	ErrorStr   string                      `json:"error_str" yaml:"error_str"`
	ExitCode   int                         `json:"exit_code" yaml:"exit_code"`

	Timeout         time.Duration `json:"-"`
	NoOutputTimeout time.Duration `json:"-"`
}

func (StepRunResultsModel) StatusReasonAndErrors

func (s StepRunResultsModel) StatusReasonAndErrors() (string, []StepError)

type StepRunStatus

type StepRunStatus int

StepRunStatus ...

const (
	StepRunStatusCodeSuccess                StepRunStatus = 0
	StepRunStatusCodeFailed                 StepRunStatus = 1
	StepRunStatusCodeFailedSkippable        StepRunStatus = 2
	StepRunStatusCodeSkipped                StepRunStatus = 3
	StepRunStatusCodeSkippedWithRunIf       StepRunStatus = 4
	StepRunStatusCodePreparationFailed      StepRunStatus = 5
	StepRunStatusAbortedWithCustomTimeout   StepRunStatus = 7 // step times out due to a custom timeout
	StepRunStatusAbortedWithNoOutputTimeout StepRunStatus = 8 // step times out due to no output received (hang)
)

func NewStepRunStatus

func NewStepRunStatus(status string) StepRunStatus

func (StepRunStatus) Name

func (s StepRunStatus) Name() string

func (StepRunStatus) String

func (s StepRunStatus) String() string

type TestResultStepInfo

type TestResultStepInfo struct {
	ID      string `json:"id" yaml:"id"`
	Version string `json:"version" yaml:"version"`
	Title   string `json:"title" yaml:"title"`
	Number  int    `json:"number" yaml:"number"`
}

type TriggerEventType

type TriggerEventType string
const (
	TriggerEventTypeCodePush    TriggerEventType = "code-push"
	TriggerEventTypePullRequest TriggerEventType = "pull-request"
	TriggerEventTypeTag         TriggerEventType = "tag"
	TriggerEventTypeUnknown     TriggerEventType = "unknown"
)

type TriggerItemType

type TriggerItemType string
const (
	CodePushType    TriggerItemType = "push"
	PullRequestType TriggerItemType = "pull_request"
	TagPushType     TriggerItemType = "tag"
)

type TriggerMapItemModel

type TriggerMapItemModel struct {
	// Trigger Item shared properties
	Type       TriggerItemType `json:"type,omitempty" yaml:"type,omitempty"`
	Enabled    *bool           `json:"enabled,omitempty" yaml:"enabled,omitempty"`
	PipelineID string          `json:"pipeline,omitempty" yaml:"pipeline,omitempty"`
	WorkflowID string          `json:"workflow,omitempty" yaml:"workflow,omitempty"`

	// Code Push Item conditions
	PushBranch interface{} `json:"push_branch,omitempty" yaml:"push_branch,omitempty"`

	// Code Push and Pull Request Item conditions
	CommitMessage interface{} `json:"commit_message,omitempty" yaml:"commit_message,omitempty"`
	ChangedFiles  interface{} `json:"changed_files,omitempty" yaml:"changed_files,omitempty"`

	// Tag Push Item conditions
	Tag interface{} `json:"tag,omitempty" yaml:"tag,omitempty"`

	// Pull Request Item conditions
	PullRequestSourceBranch interface{} `json:"pull_request_source_branch,omitempty" yaml:"pull_request_source_branch,omitempty"`
	PullRequestTargetBranch interface{} `json:"pull_request_target_branch,omitempty" yaml:"pull_request_target_branch,omitempty"`
	DraftPullRequestEnabled *bool       `json:"draft_pull_request_enabled,omitempty" yaml:"draft_pull_request_enabled,omitempty"`
	PullRequestLabel        interface{} `json:"pull_request_label,omitempty" yaml:"pull_request_label,omitempty"`
	PullRequestComment      interface{} `json:"pull_request_comment,omitempty" yaml:"pull_request_comment,omitempty"`

	// Deprecated properties
	Pattern              string `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	IsPullRequestAllowed bool   `json:"is_pull_request_allowed,omitempty" yaml:"is_pull_request_allowed,omitempty"`
}

func (TriggerMapItemModel) IsDraftPullRequestEnabled

func (item TriggerMapItemModel) IsDraftPullRequestEnabled() bool

func (TriggerMapItemModel) MatchWithParams

func (item TriggerMapItemModel) MatchWithParams(pushBranch, prSourceBranch, prTargetBranch string, prReadyState PullRequestReadyState, tag string) (bool, error)

func (TriggerMapItemModel) Normalized

func (item TriggerMapItemModel) Normalized(idx int) (TriggerMapItemModel, error)

Normalized casts trigger item values from map[interface{}]interface{} to map[string]interface{} to support JSON marshalling of the bitrise.yml.

func (TriggerMapItemModel) Validate

func (item TriggerMapItemModel) Validate(idx int, workflows, pipelines []string) ([]string, error)

type TriggerMapModel

type TriggerMapModel []TriggerMapItemModel

func (TriggerMapModel) FirstMatchingTarget

func (triggerMap TriggerMapModel) FirstMatchingTarget(pushBranch, prSourceBranch, prTargetBranch string, prReadyState PullRequestReadyState, tag string) (string, string, error)

func (TriggerMapModel) Normalized

func (triggerMap TriggerMapModel) Normalized() ([]TriggerMapItemModel, error)

func (TriggerMapModel) Validate

func (triggerMap TriggerMapModel) Validate(workflows, pipelines []string) ([]string, error)

type WithModel

type WithModel struct {
	ContainerID string                  `json:"container,omitempty" yaml:"container,omitempty"`
	ServiceIDs  []string                `json:"services,omitempty" yaml:"services,omitempty"`
	Steps       []StepListStepItemModel `json:"steps,omitempty" yaml:"steps,omitempty"`
}

func (WithModel) Validate

func (with WithModel) Validate(workflowID string, containers, services map[string]Container) ([]string, error)

type WorkflowExecutionPlan

type WorkflowExecutionPlan struct {
	UUID                 string              `json:"uuid"`
	WorkflowID           string              `json:"workflow_id"`
	Steps                []StepExecutionPlan `json:"steps"`
	WorkflowTitle        string              `json:"-"`
	IsSteplibOfflineMode bool                `json:"-"`
}

type WorkflowListItemModel

type WorkflowListItemModel map[string]WorkflowModel

type WorkflowModel

type WorkflowModel struct {
	Title        string                              `json:"title,omitempty" yaml:"title,omitempty"`
	Summary      string                              `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description  string                              `json:"description,omitempty" yaml:"description,omitempty"`
	BeforeRun    []string                            `json:"before_run,omitempty" yaml:"before_run,omitempty"`
	AfterRun     []string                            `json:"after_run,omitempty" yaml:"after_run,omitempty"`
	Environments []envmanModels.EnvironmentItemModel `json:"envs,omitempty" yaml:"envs,omitempty"`
	Steps        []StepListItemModel                 `json:"steps,omitempty" yaml:"steps,omitempty"`
	Meta         map[string]interface{}              `json:"meta,omitempty" yaml:"meta,omitempty"`
}

func (*WorkflowModel) FillMissingDefaults

func (workflow *WorkflowModel) FillMissingDefaults(title string) error

func (*WorkflowModel) Normalize

func (workflow *WorkflowModel) Normalize() error

func (*WorkflowModel) Validate

func (workflow *WorkflowModel) Validate() ([]string, error)

type WorkflowRunModes

type WorkflowRunModes struct {
	CIMode                  bool
	PRMode                  bool
	DebugMode               bool
	SecretFilteringMode     bool
	SecretEnvsFilteringMode bool
	NoOutputTimeout         time.Duration
	IsSteplibOfflineMode    bool
}

type WorkflowRunPlan

type WorkflowRunPlan struct {
	Version          string `json:"version"`
	LogFormatVersion string `json:"log_format_version"`

	CIMode                  bool `json:"ci_mode"`
	PRMode                  bool `json:"pr_mode"`
	DebugMode               bool `json:"debug_mode"`
	IsSteplibOfflineMode    bool `json:"-"`
	NoOutputTimeoutMode     bool `json:"no_output_timeout_mode"`
	SecretFilteringMode     bool `json:"secret_filtering_mode"`
	SecretEnvsFilteringMode bool `json:"secret_envs_filtering_mode"`

	ExecutionPlan []WorkflowExecutionPlan `json:"execution_plan"`
}

Jump to

Keyboard shortcuts

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