devops

package
v0.0.0-...-1fa52ee Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0, BSD-2-Clause, ISC, + 1 more Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RESULT_SUCCESS = "SUCCESS"
	RESULT_FAILURE = "FAILURE"
	RESULT_DEFAULT = ""
)

this is for the field `result` in table.cicd_pipelines and table.cicd_tasks

View Source
const (
	STATUS_IN_PROGRESS = "IN_PROGRESS"
	STATUS_DONE        = "DONE"
	STATUS_OTHER       = "OTHER"
)

this is for the field `status` in table.cicd_pipelines and table.cicd_tasks

View Source
const (
	TEST       = "TEST"
	LINT       = "LINT"
	BUILD      = "BUILD"
	DEPLOYMENT = "DEPLOYMENT"
)
View Source
const (
	PRODUCTION = "PRODUCTION"
	STAGING    = "STAGING"
	TESTING    = "TESTING"
)
View Source
const ENV_NAME_PATTERN = "ENV_NAME_PATTERN"

Variables

This section is empty.

Functions

func GetResult

func GetResult(rule *ResultRule, input interface{}) string

GetResult compare the input with rule for return the enum value of result case-insensitively.

func GetStatus

func GetStatus(rule *StatusRule, input interface{}) string

GetStatus compare the input with rule for return the enum value of status

func GetStatusCommon

func GetStatusCommon[T comparable](rule *StatusRuleCommon[T], input T) string

GetStatusCommon compare the input with rule for return the enum value of status. If T is string, it is case-sensitivity.

Types

type CICDDeployment

type CICDDeployment struct {
	domainlayer.DomainEntity
	CicdScopeId         string `gorm:"index;type:varchar(255)"`
	Name                string `gorm:"type:varchar(255)"`
	Result              string `gorm:"type:varchar(100)"`
	Status              string `gorm:"type:varchar(100)"`
	OriginalStatus      string `gorm:"type:varchar(100)"`
	OriginalResult      string `gorm:"type:varchar(100)"`
	Environment         string `gorm:"type:varchar(255)"`
	OriginalEnvironment string `gorm:"type:varchar(255)"`
	TaskDatesInfo
	DurationSec       *float64
	QueuedDurationSec *float64
	SubtaskName       string `gorm:"type:varchar(255)"`
}

func (CICDDeployment) TableName

func (CICDDeployment) TableName() string

type CICDPipeline

type CICDPipeline struct {
	domainlayer.DomainEntity
	Name              string `gorm:"type:varchar(255)"`
	Result            string `gorm:"type:varchar(100)"`
	Status            string `gorm:"type:varchar(100)"`
	OriginalStatus    string `gorm:"type:varchar(100)"`
	OriginalResult    string `gorm:"type:varchar(100)"`
	Type              string `gorm:"type:varchar(100);comment: to indicate this is CI or CD"`
	DurationSec       float64
	QueuedDurationSec *float64
	Environment       string `gorm:"type:varchar(255)"`
	TaskDatesInfo
	CicdScopeId string `gorm:"index;type:varchar(255)"`
}

func (CICDPipeline) TableName

func (CICDPipeline) TableName() string

type CICDTask

type CICDTask struct {
	domainlayer.DomainEntity
	Name              string `gorm:"type:varchar(255)"`
	PipelineId        string `gorm:"index;type:varchar(255)"`
	Result            string `gorm:"type:varchar(100)"`
	Status            string `gorm:"type:varchar(100)"`
	OriginalStatus    string `gorm:"type:varchar(100)"`
	OriginalResult    string `gorm:"type:varchar(100)"`
	Type              string `gorm:"type:varchar(100);comment: to indicate this is CI or CD"`
	Environment       string `gorm:"type:varchar(255)"`
	DurationSec       float64
	QueuedDurationSec *float64
	TaskDatesInfo
	//StartedDate  time.Time  // notice here
	CicdScopeId string `gorm:"index;type:varchar(255)"`
}

func (CICDTask) TableName

func (CICDTask) TableName() string

type CiCDPipelineCommit

type CiCDPipelineCommit struct {
	common.NoPKModel
	PipelineId string `gorm:"primaryKey;type:varchar(255)"`
	CommitSha  string `gorm:"primaryKey;type:varchar(255)"`
	CommitMsg  string
	Branch     string `gorm:"type:varchar(255)"`
	RepoId     string `gorm:"index;type:varchar(255)"`
	RepoUrl    string
}

func (CiCDPipelineCommit) TableName

func (CiCDPipelineCommit) TableName() string

type CicdDeploymentCommit

type CicdDeploymentCommit struct {
	domainlayer.DomainEntity
	CicdScopeId         string `gorm:"index;type:varchar(255)"`
	CicdDeploymentId    string `gorm:"type:varchar(255)"` // if it is converted from a cicd_pipeline_commit
	Name                string `gorm:"type:varchar(255)"`
	Result              string `gorm:"type:varchar(100)"`
	Status              string `gorm:"type:varchar(100)"`
	OriginalStatus      string `gorm:"type:varchar(100)"`
	OriginalResult      string `gorm:"type:varchar(100)"`
	Environment         string `gorm:"type:varchar(255)"`
	OriginalEnvironment string `gorm:"type:varchar(255)"`
	TaskDatesInfo
	DurationSec                   *float64
	QueuedDurationSec             *float64
	CommitSha                     string `gorm:"primaryKey;type:varchar(255)"`
	CommitMsg                     string
	RefName                       string `gorm:"type:varchar(255)"` // to delete?
	RepoId                        string `gorm:"type:varchar(255)"`
	RepoUrl                       string `gorm:"index;not null"`
	PrevSuccessDeploymentCommitId string `gorm:"type:varchar(255)"`
	SubtaskName                   string `gorm:"type:varchar(255)"`
}

func (CicdDeploymentCommit) TableName

func (cicdDeploymentCommit CicdDeploymentCommit) TableName() string

func (CicdDeploymentCommit) ToDeployment

func (cicdDeploymentCommit CicdDeploymentCommit) ToDeployment() *CICDDeployment

type CicdScope

type CicdScope struct {
	domainlayer.DomainEntity
	Name        string `gorm:"type:varchar(255)"`
	Description string
	Url         string `gorm:"type:varchar(255)"`
	CreatedDate *time.Time
	UpdatedDate *time.Time
}

func NewCicdScope

func NewCicdScope(id string, name string) *CicdScope

func (*CicdScope) ScopeId

func (r *CicdScope) ScopeId() string

func (*CicdScope) ScopeName

func (r *CicdScope) ScopeName() string

func (CicdScope) TableName

func (CicdScope) TableName() string

type ResultRule

type ResultRule struct {
	Success []string
	Failure []string
	Default string
}

type StatusRule

type StatusRule struct {
	InProgress []string
	Done       []string
	Default    string
}

type StatusRuleCommon

type StatusRuleCommon[T comparable] struct {
	InProgress []T
	Done       []T
	Default    string
}

type TaskDatesInfo

type TaskDatesInfo struct {
	CreatedDate  time.Time
	QueuedDate   *time.Time
	StartedDate  *time.Time
	FinishedDate *time.Time
}

func (TaskDatesInfo) CalculateQueueDuration

func (date TaskDatesInfo) CalculateQueueDuration() *float64

Jump to

Keyboard shortcuts

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