models

package
v0.0.0-...-8de0204 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 12 Imported by: 28

Documentation

Index

Constants

View Source
const (
	// FormatVersion ...
	FormatVersion = "14"
)

Variables

This section is empty.

Functions

func GetStepIDStepDataPair

func GetStepIDStepDataPair(stepListItem StepListItemModel) (string, stepmanModels.StepModel, error)

GetStepIDStepDataPair ...

func MergeEnvironmentWith

func MergeEnvironmentWith(env *envmanModels.EnvironmentItemModel, otherEnv envmanModels.EnvironmentItemModel) error

MergeEnvironmentWith ...

func MergeStepWith

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

MergeStepWith ...

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"`
}

AppModel ...

func (*AppModel) FillMissingDefaults

func (app *AppModel) FillMissingDefaults() error

FillMissingDefaults ...

func (*AppModel) Normalize

func (app *AppModel) Normalize() error

Normalize ...

func (*AppModel) Validate

func (app *AppModel) Validate() error

Validate ...

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"`
	//
	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"`
}

BitriseDataModel ...

func (*BitriseDataModel) FillMissingDefaults

func (config *BitriseDataModel) FillMissingDefaults() error

FillMissingDefaults ...

func (*BitriseDataModel) Normalize

func (config *BitriseDataModel) Normalize() error

Normalize ...

func (*BitriseDataModel) RemoveRedundantFields

func (config *BitriseDataModel) RemoveRedundantFields() error

RemoveRedundantFields ...

func (*BitriseDataModel) Validate

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

Validate ...

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"`
}

BuildRunResultsModel ...

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"`
}

BuildRunStartModel ...

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"`
}

PipelineModel ...

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

StageListItemModel ...

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"`
}

StageModel ...

type StageWorkflowListItemModel

type StageWorkflowListItemModel map[string]StageWorkflowModel

StageWorkflowListItemModel ...

type StageWorkflowModel

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

StageWorkflowModel ...

type StepError

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

StepError ...

type StepExecutionPlan

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

type StepIDData

type StepIDData struct {
	// SteplibSource : steplib source uri, or in case of local path just "path", and in case of direct git url just "git"
	SteplibSource string
	// IDOrURI : ID if steplib is provided, URI if local step or in case a direct git url provided
	IDorURI string
	// Version : version in the steplib, or in case of a direct git step the tag-or-branch to use
	Version string
}

StepIDData ... structured representation of a composite-step-id

a composite step id is: step-lib-source::step-id@1.0.0

func CreateStepIDDataFromString

func CreateStepIDDataFromString(compositeVersionStr, defaultStepLibSource string) (StepIDData, error)

CreateStepIDDataFromString ... compositeVersionStr examples:

func (StepIDData) IsUniqueResourceID

func (sIDData StepIDData) IsUniqueResourceID() bool

IsUniqueResourceID : true if this ID is a unique resource ID, which is true if the ID refers to the exact same step code/data every time. Practically, this is only true for steps from StepLibrary collections, a local path or direct git step ID is never guaranteed to identify the same resource every time, the step's behaviour can change at every execution!

__If the ID is a Unique Resource ID then the step can be cached (locally)__, as it won't change between subsequent step execution.

type StepListItemModel

type StepListItemModel map[string]stepmanModels.StepModel

StepListItemModel ...

func (StepListItemModel) GetStepIDAndStep

func (stepListItem StepListItemModel) GetStepIDAndStep() (string, stepmanModels.StepModel)

GetStepIDAndStep returns the Step ID and Step model described by the stepListItem. Use this on validated BitriseDataModels.

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:"-"`
}

StepRunResultsModel ...

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"`
}

TestResultStepInfo ...

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 WorkflowExecutionPlan

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

type WorkflowListItemModel

type WorkflowListItemModel map[string]WorkflowModel

WorkflowListItemModel ...

type WorkflowModel

type WorkflowModel struct {
	Container    Container                           `json:"container,omitempty" yaml:"container,omitempty"`
	Services     map[string]Container                `json:"services,omitempty" yaml:"services,omitempty"`
	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"`
}

WorkflowModel ...

func (*WorkflowModel) FillMissingDefaults

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

FillMissingDefaults ...

func (*WorkflowModel) Normalize

func (workflow *WorkflowModel) Normalize() error

Normalize ...

func (*WorkflowModel) Validate

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

Validate ...

type WorkflowRunModes

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

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"`
	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