pipelineConfig

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const WORKFLOW_EXECUTOR_TYPE_AWF = "AWF"
View Source
const WORKFLOW_EXECUTOR_TYPE_SYSTEM = "SYSTEM"

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Id       int    `sql:"id,pk"`
	AppName  string `sql:"app_name,notnull"` //same as app name
	Active   bool   `sql:"active, notnull"`
	TeamId   int    `sql:"team_id"`
	AppStore bool   `sql:"app_store, notnull"`
	Team     team.Team
	models.AuditLog
	// contains filtered or unexported fields
}

type AppRepository

type AppRepository interface {
	Save(pipelineGroup *App) error
	SaveWithTxn(pipelineGroup *App, tx *pg.Tx) error
	Update(app *App) error
	FindActiveByName(appName string) (pipelineGroup *App, err error)
	FindById(id int) (pipelineGroup *App, err error)
	AppExists(appName string) (bool, error)
	FindAppsByTeamId(teamId int) ([]App, error)
	FindAppsByTeamIds(teamId []int) ([]App, error)
	FindAppsByTeamName(teamName string) ([]App, error)
	FindAll() ([]App, error)
	FindAppsByEnvironmentId(environmentId int) ([]App, error)
	FindAllActiveAppsWithTeam() ([]*App, error)
	CheckAppExists(appNames []string) ([]*App, error)

	FindByIds(ids []*int) ([]*App, error)
	FetchAppsByFilter(appNameIncludes string, appNameExcludes string) ([]*App, error)
	FetchAppsByFilterV2(appNameIncludes string, appNameExcludes string, environmentId int) ([]*App, error)
}

type AppRepositoryImpl

type AppRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewAppRepositoryImpl

func NewAppRepositoryImpl(dbConnection *pg.DB) *AppRepositoryImpl

func (AppRepositoryImpl) AppExists

func (repo AppRepositoryImpl) AppExists(appName string) (bool, error)

func (AppRepositoryImpl) CheckAppExists

func (repo AppRepositoryImpl) CheckAppExists(appNames []string) ([]*App, error)

func (AppRepositoryImpl) FetchAppsByFilter

func (repo AppRepositoryImpl) FetchAppsByFilter(appNameIncludes string, appNameExcludes string) ([]*App, error)

func (AppRepositoryImpl) FetchAppsByFilterV2

func (repo AppRepositoryImpl) FetchAppsByFilterV2(appNameIncludes string, appNameExcludes string, environmentId int) ([]*App, error)

func (AppRepositoryImpl) FindActiveByName

func (repo AppRepositoryImpl) FindActiveByName(appName string) (*App, error)

func (AppRepositoryImpl) FindAll

func (repo AppRepositoryImpl) FindAll() ([]App, error)

func (AppRepositoryImpl) FindAllActiveAppsWithTeam

func (repo AppRepositoryImpl) FindAllActiveAppsWithTeam() ([]*App, error)

func (AppRepositoryImpl) FindAppsByEnvironmentId

func (repo AppRepositoryImpl) FindAppsByEnvironmentId(environmentId int) ([]App, error)

func (AppRepositoryImpl) FindAppsByTeamId

func (repo AppRepositoryImpl) FindAppsByTeamId(teamId int) ([]App, error)

func (AppRepositoryImpl) FindAppsByTeamIds

func (repo AppRepositoryImpl) FindAppsByTeamIds(teamId []int) ([]App, error)

func (AppRepositoryImpl) FindAppsByTeamName

func (repo AppRepositoryImpl) FindAppsByTeamName(teamName string) ([]App, error)

func (AppRepositoryImpl) FindById

func (repo AppRepositoryImpl) FindById(id int) (*App, error)

func (AppRepositoryImpl) FindByIds

func (repo AppRepositoryImpl) FindByIds(ids []*int) ([]*App, error)

func (AppRepositoryImpl) Save

func (repo AppRepositoryImpl) Save(pipelineGroup *App) error

func (AppRepositoryImpl) SaveWithTxn

func (repo AppRepositoryImpl) SaveWithTxn(pipelineGroup *App, tx *pg.Tx) error

func (AppRepositoryImpl) Update

func (repo AppRepositoryImpl) Update(app *App) error

type CdWorkflow

type CdWorkflow struct {
	Id               int            `sql:"id,pk"`
	CiArtifactId     int            `sql:"ci_artifact_id"`
	PipelineId       int            `sql:"pipeline_id"`
	WorkflowStatus   WorkflowStatus `sql:"workflow_status,notnull"`
	Pipeline         *Pipeline
	CiArtifact       *repository.CiArtifact
	CdWorkflowRunner []CdWorkflowRunner
	models.AuditLog
	// contains filtered or unexported fields
}

type CdWorkflowConfig

type CdWorkflowConfig struct {
	Id                       int    `sql:"id,pk"`
	CdTimeout                int64  `sql:"cd_timeout"`
	MinCpu                   string `sql:"min_cpu"`
	MaxCpu                   string `sql:"max_cpu"`
	MinMem                   string `sql:"min_mem"`
	MaxMem                   string `sql:"max_mem"`
	MinStorage               string `sql:"min_storage"`
	MaxStorage               string `sql:"max_storage"`
	MinEphStorage            string `sql:"min_eph_storage"`
	MaxEphStorage            string `sql:"max_eph_storage"`
	CdCacheBucket            string `sql:"cd_cache_bucket"`
	CdCacheRegion            string `sql:"cd_cache_region"`
	CdImage                  string `sql:"cd_image"`
	Namespace                string `sql:"wf_namespace"`
	CdPipelineId             int    `sql:"cd_pipeline_id"`
	LogsBucket               string `sql:"logs_bucket"`
	CdArtifactLocationFormat string `sql:"cd_artifact_location_format"`
	// contains filtered or unexported fields
}

type CdWorkflowRepository

type CdWorkflowRepository interface {
	SaveWorkFlow(wf *CdWorkflow) error
	UpdateWorkFlow(wf *CdWorkflow) error
	FindById(wfId int) (*CdWorkflow, error)
	FindCdWorkflowMetaByEnvironmentId(appId int, environmentId int, offset int, size int) ([]CdWorkflowRunner, error)
	FindCdWorkflowMetaByPipelineId(pipelineId int, offset int, size int) ([]CdWorkflowRunner, error)
	FindArtifactByPipelineIdAndRunnerType(pipelineId int, runnerType bean.CdWorkflowType, limit int) ([]CdWorkflowRunner, error)

	SaveWorkFlowRunner(wfr *CdWorkflowRunner) error
	UpdateWorkFlowRunner(wfr *CdWorkflowRunner) error
	UpdateWorkFlowRunners(wfr []*CdWorkflowRunner) error
	FindWorkflowRunnerByCdWorkflowId(wfIds []int) ([]*CdWorkflowRunner, error)
	FindPreviousCdWfRunnerByStatus(pipelineId int, currentWFRunnerId int, status []string) ([]*CdWorkflowRunner, error)
	FindConfigByPipelineId(pipelineId int) (*CdWorkflowConfig, error)
	FindWorkflowRunnerById(wfrId int) (*CdWorkflowRunner, error)

	FindLastPreOrPostTriggeredByPipelineId(pipelineId int) (CdWorkflowRunner, error)
	FindLastPreOrPostTriggeredByEnvironmentId(appId int, environmentId int) (CdWorkflowRunner, error)

	FindByWorkflowIdAndRunnerType(wfId int, runnerType bean.CdWorkflowType) (CdWorkflowRunner, error)
	FindLastStatusByPipelineIdAndRunnerType(pipelineId int, runnerType bean.CdWorkflowType) (CdWorkflowRunner, error)
	SaveWorkFlows(wfs ...*CdWorkflow) error
	IsLatestWf(pipelineId int, wfId int) (bool, error)
	FindLatestCdWorkflowByPipelineId(pipelineIds []int) (*CdWorkflow, error)
	FindLatestCdWorkflowByPipelineIdV2(pipelineIds []int) ([]*CdWorkflow, error)
	FetchAllCdStagesLatestEntity(pipelineIds []int) ([]*CdWorkflowStatus, error)
	FetchAllCdStagesLatestEntityStatus(wfrIds []int) ([]*CdWorkflowRunner, error)
}

type CdWorkflowRepositoryImpl

type CdWorkflowRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewCdWorkflowRepositoryImpl

func NewCdWorkflowRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *CdWorkflowRepositoryImpl

func (*CdWorkflowRepositoryImpl) FetchAllCdStagesLatestEntity

func (impl *CdWorkflowRepositoryImpl) FetchAllCdStagesLatestEntity(pipelineIds []int) ([]*CdWorkflowStatus, error)

func (*CdWorkflowRepositoryImpl) FetchAllCdStagesLatestEntityStatus

func (impl *CdWorkflowRepositoryImpl) FetchAllCdStagesLatestEntityStatus(wfrIds []int) ([]*CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindArtifactByPipelineIdAndRunnerType

func (impl *CdWorkflowRepositoryImpl) FindArtifactByPipelineIdAndRunnerType(pipelineId int, runnerType bean.CdWorkflowType, limit int) ([]CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindById

func (impl *CdWorkflowRepositoryImpl) FindById(wfId int) (*CdWorkflow, error)

func (*CdWorkflowRepositoryImpl) FindByWorkflowIdAndRunnerType

func (impl *CdWorkflowRepositoryImpl) FindByWorkflowIdAndRunnerType(wfId int, runnerType bean.CdWorkflowType) (CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindCdWorkflowMetaByEnvironmentId

func (impl *CdWorkflowRepositoryImpl) FindCdWorkflowMetaByEnvironmentId(appId int, environmentId int, offset int, limit int) ([]CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindCdWorkflowMetaByPipelineId

func (impl *CdWorkflowRepositoryImpl) FindCdWorkflowMetaByPipelineId(pipelineId int, offset int, limit int) ([]CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindConfigByPipelineId

func (impl *CdWorkflowRepositoryImpl) FindConfigByPipelineId(pipelineId int) (*CdWorkflowConfig, error)

func (*CdWorkflowRepositoryImpl) FindLastPreOrPostTriggeredByEnvironmentId

func (impl *CdWorkflowRepositoryImpl) FindLastPreOrPostTriggeredByEnvironmentId(appId int, environmentId int) (CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindLastPreOrPostTriggeredByPipelineId

func (impl *CdWorkflowRepositoryImpl) FindLastPreOrPostTriggeredByPipelineId(pipelineId int) (CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindLastStatusByPipelineIdAndRunnerType

func (impl *CdWorkflowRepositoryImpl) FindLastStatusByPipelineIdAndRunnerType(pipelineId int, runnerType bean.CdWorkflowType) (CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindLatestCdWorkflowByPipelineId

func (impl *CdWorkflowRepositoryImpl) FindLatestCdWorkflowByPipelineId(pipelineIds []int) (*CdWorkflow, error)

func (*CdWorkflowRepositoryImpl) FindLatestCdWorkflowByPipelineIdV2

func (impl *CdWorkflowRepositoryImpl) FindLatestCdWorkflowByPipelineIdV2(pipelineIds []int) ([]*CdWorkflow, error)

func (*CdWorkflowRepositoryImpl) FindPreviousCdWfRunnerByStatus

func (impl *CdWorkflowRepositoryImpl) FindPreviousCdWfRunnerByStatus(pipelineId int, currentWFRunnerId int, status []string) ([]*CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindWorkflowRunnerByCdWorkflowId

func (impl *CdWorkflowRepositoryImpl) FindWorkflowRunnerByCdWorkflowId(wfIds []int) ([]*CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) FindWorkflowRunnerById

func (impl *CdWorkflowRepositoryImpl) FindWorkflowRunnerById(wfrId int) (*CdWorkflowRunner, error)

func (*CdWorkflowRepositoryImpl) IsLatestWf

func (impl *CdWorkflowRepositoryImpl) IsLatestWf(pipelineId int, wfId int) (bool, error)

func (*CdWorkflowRepositoryImpl) SaveWorkFlow

func (impl *CdWorkflowRepositoryImpl) SaveWorkFlow(wf *CdWorkflow) error

func (*CdWorkflowRepositoryImpl) SaveWorkFlowRunner

func (impl *CdWorkflowRepositoryImpl) SaveWorkFlowRunner(wfr *CdWorkflowRunner) error

func (*CdWorkflowRepositoryImpl) SaveWorkFlows

func (impl *CdWorkflowRepositoryImpl) SaveWorkFlows(wfs ...*CdWorkflow) error

func (*CdWorkflowRepositoryImpl) UpdateWorkFlow

func (impl *CdWorkflowRepositoryImpl) UpdateWorkFlow(wf *CdWorkflow) error

func (*CdWorkflowRepositoryImpl) UpdateWorkFlowRunner

func (impl *CdWorkflowRepositoryImpl) UpdateWorkFlowRunner(wfr *CdWorkflowRunner) error

func (*CdWorkflowRepositoryImpl) UpdateWorkFlowRunners

func (impl *CdWorkflowRepositoryImpl) UpdateWorkFlowRunners(wfr []*CdWorkflowRunner) error

type CdWorkflowRunner

type CdWorkflowRunner struct {
	Id           int                  `sql:"id,pk"`
	Name         string               `sql:"name"`
	WorkflowType bean.CdWorkflowType  `sql:"workflow_type"` //pre,post,deploy
	ExecutorType WorkflowExecutorType `sql:"executor_type"` //awf, system
	Status       string               `sql:"status"`
	PodStatus    string               `sql:"pod_status"`
	Message      string               `sql:"message"`
	StartedOn    time.Time            `sql:"started_on"`
	FinishedOn   time.Time            `sql:"finished_on"`
	Namespace    string               `sql:"namespace"`
	LogLocation  string               `sql:"log_file_path"`
	TriggeredBy  int32                `sql:"triggered_by"`
	CdWorkflowId int                  `sql:"cd_workflow_id"`
	CdWorkflow   *CdWorkflow
	// contains filtered or unexported fields
}

type CdWorkflowStatus

type CdWorkflowStatus struct {
	CiPipelineId int    `json:"ci_pipeline_id"`
	PipelineId   int    `json:"pipeline_id"`
	PipelineName string `json:"pipeline_name,omitempty"`
	DeployStatus string `json:"deploy_status"`
	PreStatus    string `json:"pre_status"`
	PostStatus   string `json:"post_status"`
	WorkflowType string `json:"workflow_type,omitempty"`
	WfrId        int    `json:"wfr_id,omitempty"`
}

type CdWorkflowWithArtifact

type CdWorkflowWithArtifact struct {
	Id           int       `json:"id"`
	CdWorkflowId int       `json:"cd_workflow_id"`
	Name         string    `json:"name"`
	Status       string    `json:"status"`
	PodStatus    string    `json:"pod_status"`
	Message      string    `json:"message"`
	StartedOn    time.Time `json:"started_on"`
	FinishedOn   time.Time `json:"finished_on"`
	PipelineId   int       `json:"pipeline_id"`
	Namespace    string    `json:"namespace"`
	LogFilePath  string    `json:"log_file_path"`
	TriggeredBy  int32     `json:"triggered_by"`
	EmailId      string    `json:"email_id"`
	Image        string    `json:"image"`
	MaterialInfo string    `json:"material_info,omitempty"`
	DataSource   string    `json:"data_source,omitempty"`
	CiArtifactId int       `json:"ci_artifact_id,omitempty"`
	WorkflowType string    `json:"workflow_type,omitempty"`
	ExecutorType string    `json:"executor_type,omitempty"`
}

type CiArtifactDTO

type CiArtifactDTO struct {
	Id           int    `json:"id"`
	PipelineId   int    `json:"pipelineId"` //id of the ci pipeline from which this webhook was triggered
	Image        string `json:"image"`
	ImageDigest  string `json:"imageDigest"`
	MaterialInfo string `json:"materialInfo"` //git material metadata json array string
	DataSource   string `json:"dataSource"`
	WorkflowId   *int   `json:"workflowId"`
}

type CiPipeline

type CiPipeline struct {
	Id               int `sql:"id,pk"`
	AppId            int `sql:"app_id"`
	App              *App
	CiTemplateId     int    `sql:"ci_template_id"`
	DockerArgs       string `sql:"docker_args"`
	Name             string `sql:"name"`
	Version          string `sql:"version"`
	Active           bool   `sql:"active,notnull"`
	Deleted          bool   `sql:"deleted,notnull"`
	IsManual         bool   `sql:"manual,notnull"`
	IsExternal       bool   `sql:"external,notnull"`
	ParentCiPipeline int    `sql:"parent_ci_pipeline"`
	ScanEnabled      bool   `sql:"scan_enabled,notnull"`
	models.AuditLog
	CiPipelineMaterials []*CiPipelineMaterial
	CiTemplate          *CiTemplate
	ExternalCiPipeline  *ExternalCiPipeline
	// contains filtered or unexported fields
}

type CiPipelineMaterial

type CiPipelineMaterial struct {
	Id            int    `sql:"id"`
	GitMaterialId int    `sql:"git_material_id"` //id stored in db GitMaterial( foreign key)
	CiPipelineId  int    `sql:"ci_pipeline_id"`
	Path          string `sql:"path"` // defaults to root of git repo
	//depricated was used in gocd remove this
	CheckoutPath string     `sql:"checkout_path"` //path where code will be checked out for single source `./` default for multiSource configured by user
	Type         SourceType `sql:"type"`
	Value        string     `sql:"value"`
	ScmId        string     `sql:"scm_id"`      //id of gocd object
	ScmName      string     `sql:"scm_name"`    //gocd scm name
	ScmVersion   string     `sql:"scm_version"` //gocd scm version
	Active       bool       `sql:"active,notnull"`
	GitTag       string     `sql:"-"`
	CiPipeline   *CiPipeline
	GitMaterial  *GitMaterial
	models.AuditLog
	// contains filtered or unexported fields
}

type CiPipelineMaterialRepository

type CiPipelineMaterialRepository interface {
	Save(tx *pg.Tx, pipeline ...*CiPipelineMaterial) error
	Update(tx *pg.Tx, material ...*CiPipelineMaterial) error
	FindByCiPipelineIdsIn(ids []int) ([]*CiPipelineMaterial, error)
	GetById(id int) (*CiPipelineMaterial, error)
	GetByPipelineId(id int) ([]*CiPipelineMaterial, error)
	GetByGitMaterialUrlAndType(url string, ciPipelineMaterialType string) ([]*CiPipelineMaterial, error)
}

type CiPipelineMaterialRepositoryImpl

type CiPipelineMaterialRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewCiPipelineMaterialRepositoryImpl

func NewCiPipelineMaterialRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *CiPipelineMaterialRepositoryImpl

func (CiPipelineMaterialRepositoryImpl) FindByCiPipelineIdsIn

func (impl CiPipelineMaterialRepositoryImpl) FindByCiPipelineIdsIn(ids []int) ([]*CiPipelineMaterial, error)

func (CiPipelineMaterialRepositoryImpl) GetByGitMaterialUrlAndType

func (impl CiPipelineMaterialRepositoryImpl) GetByGitMaterialUrlAndType(url string, ciPipelineMaterialType string) ([]*CiPipelineMaterial, error)

func (CiPipelineMaterialRepositoryImpl) GetById

func (CiPipelineMaterialRepositoryImpl) GetByPipelineId

func (impl CiPipelineMaterialRepositoryImpl) GetByPipelineId(id int) ([]*CiPipelineMaterial, error)

func (CiPipelineMaterialRepositoryImpl) Save

func (impl CiPipelineMaterialRepositoryImpl) Save(tx *pg.Tx, material ...*CiPipelineMaterial) error

func (CiPipelineMaterialRepositoryImpl) Update

func (impl CiPipelineMaterialRepositoryImpl) Update(tx *pg.Tx, materials ...*CiPipelineMaterial) error

type CiPipelineRepository

type CiPipelineRepository interface {
	Save(pipeline *CiPipeline, tx *pg.Tx) error
	SaveExternalCi(pipeline *ExternalCiPipeline, tx *pg.Tx) (*ExternalCiPipeline, error)
	UpdateExternalCi(pipeline *ExternalCiPipeline, tx *pg.Tx) (*ExternalCiPipeline, int, error)
	FindExternalCiByCiPipelineId(ciPipelineId int) (*ExternalCiPipeline, error)
	FindCiScriptsByCiPipelineId(ciPipelineId int) ([]*CiPipelineScript, error)
	SaveCiPipelineScript(ciPipelineScript *CiPipelineScript, tx *pg.Tx) error
	UpdateCiPipelineScript(script *CiPipelineScript, tx *pg.Tx) error
	FindByAppId(appId int) (pipelines []*CiPipeline, err error)
	//find non deleted pipeline
	FindById(id int) (pipeline *CiPipeline, err error)
	FindByCiAndAppDetailsById(pipelineId int) (pipeline *CiPipeline, err error)
	FindByIdsIn(ids []int) ([]*CiPipeline, error)
	Update(pipeline *CiPipeline, tx *pg.Tx) error
	PipelineExistsByName(names []string) (found []string, err error)
	FindByName(pipelineName string) (pipeline *CiPipeline, err error)
	FindByParentCiPipelineId(parentCiPipelineId int) ([]*CiPipeline, error)

	FetchParentCiPipelinesForDG() ([]*CiPipelinesMap, error)
	FetchCiPipelinesForDG(parentId int, childCiPipelineIds []int) (*CiPipeline, int, error)
	FinDByParentCiPipelineAndAppId(parentCiPipeline int, appIds []int) ([]*CiPipeline, error)
}

type CiPipelineRepositoryImpl

type CiPipelineRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewCiPipelineRepositoryImpl

func NewCiPipelineRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *CiPipelineRepositoryImpl

func (CiPipelineRepositoryImpl) FetchCiPipelinesForDG

func (impl CiPipelineRepositoryImpl) FetchCiPipelinesForDG(parentId int, childCiPipelineIds []int) (*CiPipeline, int, error)

func (CiPipelineRepositoryImpl) FetchParentCiPipelinesForDG

func (impl CiPipelineRepositoryImpl) FetchParentCiPipelinesForDG() ([]*CiPipelinesMap, error)

func (*CiPipelineRepositoryImpl) FinDByParentCiPipelineAndAppId

func (impl *CiPipelineRepositoryImpl) FinDByParentCiPipelineAndAppId(parentCiPipeline int, appIds []int) ([]*CiPipeline, error)

func (CiPipelineRepositoryImpl) FindByAppId

func (impl CiPipelineRepositoryImpl) FindByAppId(appId int) (pipelines []*CiPipeline, err error)

func (CiPipelineRepositoryImpl) FindByCiAndAppDetailsById

func (impl CiPipelineRepositoryImpl) FindByCiAndAppDetailsById(pipelineId int) (pipeline *CiPipeline, err error)

func (CiPipelineRepositoryImpl) FindById

func (impl CiPipelineRepositoryImpl) FindById(id int) (pipeline *CiPipeline, err error)

func (CiPipelineRepositoryImpl) FindByIdsIn

func (impl CiPipelineRepositoryImpl) FindByIdsIn(ids []int) ([]*CiPipeline, error)

func (CiPipelineRepositoryImpl) FindByName

func (impl CiPipelineRepositoryImpl) FindByName(pipelineName string) (pipeline *CiPipeline, err error)

func (CiPipelineRepositoryImpl) FindByParentCiPipelineId

func (impl CiPipelineRepositoryImpl) FindByParentCiPipelineId(parentCiPipelineId int) ([]*CiPipeline, error)

func (CiPipelineRepositoryImpl) FindCiScriptsByCiPipelineId

func (impl CiPipelineRepositoryImpl) FindCiScriptsByCiPipelineId(ciPipelineId int) ([]*CiPipelineScript, error)

func (CiPipelineRepositoryImpl) FindExternalCiByCiPipelineId

func (impl CiPipelineRepositoryImpl) FindExternalCiByCiPipelineId(ciPipelineId int) (*ExternalCiPipeline, error)

func (CiPipelineRepositoryImpl) PipelineExistsByName

func (impl CiPipelineRepositoryImpl) PipelineExistsByName(names []string) (found []string, err error)

func (CiPipelineRepositoryImpl) Save

func (impl CiPipelineRepositoryImpl) Save(pipeline *CiPipeline, tx *pg.Tx) error

func (CiPipelineRepositoryImpl) SaveCiPipelineScript

func (impl CiPipelineRepositoryImpl) SaveCiPipelineScript(ciPipelineScript *CiPipelineScript, tx *pg.Tx) error

func (CiPipelineRepositoryImpl) SaveExternalCi

func (impl CiPipelineRepositoryImpl) SaveExternalCi(pipeline *ExternalCiPipeline, tx *pg.Tx) (*ExternalCiPipeline, error)

func (CiPipelineRepositoryImpl) Update

func (impl CiPipelineRepositoryImpl) Update(pipeline *CiPipeline, tx *pg.Tx) error

func (CiPipelineRepositoryImpl) UpdateCiPipelineScript

func (impl CiPipelineRepositoryImpl) UpdateCiPipelineScript(script *CiPipelineScript, tx *pg.Tx) error

func (CiPipelineRepositoryImpl) UpdateExternalCi

func (impl CiPipelineRepositoryImpl) UpdateExternalCi(pipeline *ExternalCiPipeline, tx *pg.Tx) (*ExternalCiPipeline, int, error)

type CiPipelineScript

type CiPipelineScript struct {
	Id             int    `sql:"id,pk"`
	Name           string `sql:"name"`
	Index          int    `sql:"index"`
	CiPipelineId   int    `sql:"ci_pipeline_id"`
	Script         string `sql:"script"`
	Stage          string `sql:"stage"`
	OutputLocation string `sql:"output_location"`
	Active         bool   `sql:"active,notnull"`
	models.AuditLog
	// contains filtered or unexported fields
}

type CiPipelinesMap

type CiPipelinesMap struct {
	Id               int `json:"id"`
	ParentCiPipeline int `json:"parentCiPipeline"`
}

type CiTemplate

type CiTemplate struct {
	Id                int    `sql:"id"`
	AppId             int    `sql:"app_id"`             //foreign key of app
	DockerRegistryId  string `sql:"docker_registry_id"` //foreign key of registry
	DockerRepository  string `sql:"docker_repository"`
	DockerfilePath    string `sql:"dockerfile_path"`
	Args              string `sql:"args"`                //json string format of map[string]string
	BeforeDockerBuild string `sql:"before_docker_build"` //json string  format of []*Task
	AfterDockerBuild  string `sql:"after_docker_build"`  //json string  format of []*Task
	TemplateName      string `sql:"template_name"`
	Version           string `sql:"version"` //gocd etage
	Active            bool   `sql:"active,notnull"`
	GitMaterialId     int    `sql:"git_material_id"`
	models.AuditLog
	App            *App
	DockerRegistry *repository.DockerArtifactStore
	GitMaterial    *GitMaterial
	// contains filtered or unexported fields
}

type CiTemplateRepository

type CiTemplateRepository interface {
	Save(material *CiTemplate) error
	FindByAppId(appId int) (ciTemplate *CiTemplate, err error)
	Update(material *CiTemplate) error
}

type CiTemplateRepositoryImpl

type CiTemplateRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewCiTemplateRepositoryImpl

func NewCiTemplateRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *CiTemplateRepositoryImpl

func (CiTemplateRepositoryImpl) FindByAppId

func (impl CiTemplateRepositoryImpl) FindByAppId(appId int) (ciTemplate *CiTemplate, err error)

func (CiTemplateRepositoryImpl) Save

func (impl CiTemplateRepositoryImpl) Save(material *CiTemplate) error

func (CiTemplateRepositoryImpl) Update

func (impl CiTemplateRepositoryImpl) Update(material *CiTemplate) error

type CiWorkflow

type CiWorkflow struct {
	Id                 int               `sql:"id,pk"`
	Name               string            `sql:"name"`
	Status             string            `sql:"status"`
	PodStatus          string            `sql:"pod_status"`
	Message            string            `sql:"message"`
	StartedOn          time.Time         `sql:"started_on"`
	FinishedOn         time.Time         `sql:"finished_on"`
	CiPipelineId       int               `sql:"ci_pipeline_id"`
	Namespace          string            `sql:"namespace"`
	LogLocation        string            `sql:"log_file_path"`
	GitTriggers        map[int]GitCommit `sql:"git_triggers"`
	TriggeredBy        int32             `sql:"triggered_by"`
	CiArtifactLocation string            `sql:"ci_artifact_location"`
	CiPipeline         *CiPipeline
	// contains filtered or unexported fields
}

type CiWorkflowConfig

type CiWorkflowConfig struct {
	Id                       int    `sql:"id,pk"`
	CiTimeout                int64  `sql:"ci_timeout"`
	MinCpu                   string `sql:"min_cpu"`
	MaxCpu                   string `sql:"max_cpu"`
	MinMem                   string `sql:"min_mem"`
	MaxMem                   string `sql:"max_mem"`
	MinStorage               string `sql:"min_storage"`
	MaxStorage               string `sql:"max_storage"`
	MinEphStorage            string `sql:"min_eph_storage"`
	MaxEphStorage            string `sql:"max_eph_storage"`
	CiCacheBucket            string `sql:"ci_cache_bucket"`
	CiCacheRegion            string `sql:"ci_cache_region"`
	CiImage                  string `sql:"ci_image"`
	Namespace                string `sql:"wf_namespace"`
	CiPipelineId             int    `sql:"ci_pipeline_id"`
	LogsBucket               string `sql:"logs_bucket"`
	CiArtifactLocationFormat string `sql:"ci_artifact_location_format"`
	// contains filtered or unexported fields
}

type CiWorkflowRepository

type CiWorkflowRepository interface {
	SaveWorkFlowConfig(config *CiWorkflowConfig) error
	FindConfigByPipelineId(pipelineId int) (*CiWorkflowConfig, error)

	SaveWorkFlow(wf *CiWorkflow) error
	FindLastTriggeredWorkflow(pipelineId int) (*CiWorkflow, error)
	UpdateWorkFlow(wf *CiWorkflow) error
	FindByStatusesIn(activeStatuses []string) ([]*CiWorkflow, error)
	FindByPipelineId(pipelineId int, offset int, size int) ([]WorkflowWithArtifact, error)
	FindById(id int) (*CiWorkflow, error)
	FindByName(name string) (*CiWorkflow, error)

	FindLastTriggeredWorkflowByCiIds(pipelineId []int) (ciWorkflow []*CiWorkflow, err error)
	FindLastTriggeredWorkflowByArtifactId(ciArtifactId int) (ciWorkflow *CiWorkflow, err error)
}

type CiWorkflowRepositoryImpl

type CiWorkflowRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewCiWorkflowRepositoryImpl

func NewCiWorkflowRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *CiWorkflowRepositoryImpl

func (*CiWorkflowRepositoryImpl) FindById

func (impl *CiWorkflowRepositoryImpl) FindById(id int) (*CiWorkflow, error)

func (*CiWorkflowRepositoryImpl) FindByName

func (impl *CiWorkflowRepositoryImpl) FindByName(name string) (*CiWorkflow, error)

func (*CiWorkflowRepositoryImpl) FindByPipelineId

func (impl *CiWorkflowRepositoryImpl) FindByPipelineId(pipelineId int, offset int, limit int) ([]WorkflowWithArtifact, error)

func (*CiWorkflowRepositoryImpl) FindByStatusesIn

func (impl *CiWorkflowRepositoryImpl) FindByStatusesIn(activeStatuses []string) ([]*CiWorkflow, error)

func (*CiWorkflowRepositoryImpl) FindConfigByPipelineId

func (impl *CiWorkflowRepositoryImpl) FindConfigByPipelineId(pipelineId int) (*CiWorkflowConfig, error)

func (*CiWorkflowRepositoryImpl) FindLastTriggeredWorkflow

func (impl *CiWorkflowRepositoryImpl) FindLastTriggeredWorkflow(pipelineId int) (ciWorkflow *CiWorkflow, err error)

func (*CiWorkflowRepositoryImpl) FindLastTriggeredWorkflowByArtifactId

func (impl *CiWorkflowRepositoryImpl) FindLastTriggeredWorkflowByArtifactId(ciArtifactId int) (ciWorkflow *CiWorkflow, err error)

func (*CiWorkflowRepositoryImpl) FindLastTriggeredWorkflowByCiIds

func (impl *CiWorkflowRepositoryImpl) FindLastTriggeredWorkflowByCiIds(pipelineId []int) (ciWorkflow []*CiWorkflow, err error)

func (*CiWorkflowRepositoryImpl) SaveWorkFlow

func (impl *CiWorkflowRepositoryImpl) SaveWorkFlow(wf *CiWorkflow) error

func (*CiWorkflowRepositoryImpl) SaveWorkFlowConfig

func (impl *CiWorkflowRepositoryImpl) SaveWorkFlowConfig(config *CiWorkflowConfig) error

func (*CiWorkflowRepositoryImpl) UpdateWorkFlow

func (impl *CiWorkflowRepositoryImpl) UpdateWorkFlow(wf *CiWorkflow) error

type CiWorkflowStatus

type CiWorkflowStatus struct {
	CiPipelineId   int    `json:"ciPipelineId"`
	CiPipelineName string `json:"ciPipelineName,omitempty"`
	CiStatus       string `json:"ciStatus"`
}

type ConnectedPipelinesMap

type ConnectedPipelinesMap struct {
	Id    int `json:"id"`
	Count int `json:"count"`
}

type DbMigrationConfig

type DbMigrationConfig struct {
	Id            int           `sql:"id"`
	DbConfigId    int           `sql:"db_config_id"`
	PipelineId    int           `sql:"pipeline_id"`
	GitMaterialId int           `sql:"git_material_id"`
	ScriptSource  string        `sql:"script_source"` //location of file in git. relative to git root
	MigrationTool MigrationTool `sql:"migration_tool"`
	Active        bool          `sql:"active"`
	models.AuditLog
	DbConfig    *repository.DbConfig
	GitMaterial *GitMaterial
	// contains filtered or unexported fields
}

type DbMigrationConfigRepository

type DbMigrationConfigRepository interface {
	Save(config *DbMigrationConfig) error
	FindByPipelineId(pipelineId int) (config *DbMigrationConfig, err error)
	Update(config *DbMigrationConfig) error
}

type DbMigrationConfigRepositoryImpl

type DbMigrationConfigRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewDbMigrationConfigRepositoryImpl

func NewDbMigrationConfigRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *DbMigrationConfigRepositoryImpl

func (DbMigrationConfigRepositoryImpl) FindByPipelineId

func (impl DbMigrationConfigRepositoryImpl) FindByPipelineId(pipelineId int) (config *DbMigrationConfig, err error)

func (DbMigrationConfigRepositoryImpl) Save

func (DbMigrationConfigRepositoryImpl) Update

type DeploymentTemplate

type DeploymentTemplate string
const DEPLOYMENT_TEMPLATE_BLUE_GREEN DeploymentTemplate = "BLUE-GREEN"
const DEPLOYMENT_TEMPLATE_CANARY DeploymentTemplate = "CANARY"
const DEPLOYMENT_TEMPLATE_RECREATE DeploymentTemplate = "RECREATE"
const DEPLOYMENT_TEMPLATE_ROLLING DeploymentTemplate = "ROLLING"

type ExternalCiPipeline

type ExternalCiPipeline struct {
	Id           int    `sql:"id,pk"`
	CiPipelineId int    `sql:"ci_pipeline_id"`
	Active       bool   `sql:"active,notnull"`
	AccessToken  string `sql:"access_token,notnull"`
	models.AuditLog
	CiPipeline *CiPipeline
	// contains filtered or unexported fields
}

type GitCommit

type GitCommit struct {
	Commit  string //git hash
	Author  string
	Date    time.Time
	Message string
	Changes []string
}

type GitMaterial

type GitMaterial struct {
	Id            int    `sql:"id,pk"`
	AppId         int    `sql:"app_id,notnull"`
	GitProviderId int    `sql:"git_provider_id,notnull"`
	Active        bool   `sql:"active,notnull"`
	Url           string `sql:"url,omitempty"`
	Name          string `sql:"name, omitempty"`
	CheckoutPath  string `sql:"checkout_path, omitempty"`
	models.AuditLog
	App         *App
	GitProvider *repository.GitProvider
	// contains filtered or unexported fields
}

TODO: add support for submodule

type MaterialRepository

type MaterialRepository interface {
	MaterialExists(url string) (bool, error)
	SaveMaterial(material *GitMaterial) error
	UpdateMaterial(material *GitMaterial) error
	Update(materials []*GitMaterial) error
	FindByAppId(appId int) ([]*GitMaterial, error)
	FindById(Id int) (*GitMaterial, error)
	UpdateMaterialScmId(material *GitMaterial) error
}

type MaterialRepositoryImpl

type MaterialRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewMaterialRepositoryImpl

func NewMaterialRepositoryImpl(dbConnection *pg.DB) *MaterialRepositoryImpl

func (MaterialRepositoryImpl) FindByAppId

func (repo MaterialRepositoryImpl) FindByAppId(appId int) ([]*GitMaterial, error)

func (MaterialRepositoryImpl) FindById

func (repo MaterialRepositoryImpl) FindById(Id int) (*GitMaterial, error)

func (MaterialRepositoryImpl) MaterialExists

func (repo MaterialRepositoryImpl) MaterialExists(url string) (bool, error)

func (MaterialRepositoryImpl) SaveMaterial

func (repo MaterialRepositoryImpl) SaveMaterial(material *GitMaterial) error

func (MaterialRepositoryImpl) Update

func (impl MaterialRepositoryImpl) Update(materials []*GitMaterial) error

func (MaterialRepositoryImpl) UpdateMaterial

func (repo MaterialRepositoryImpl) UpdateMaterial(material *GitMaterial) error

func (MaterialRepositoryImpl) UpdateMaterialScmId

func (repo MaterialRepositoryImpl) UpdateMaterialScmId(material *GitMaterial) error

type MigrationTool

type MigrationTool string
const MIGRATION_TOOL_MIGRATE MigrationTool = "migrate"

func (MigrationTool) IsValid

func (t MigrationTool) IsValid() bool

type Pipeline

type Pipeline struct {
	Id                            int `sql:"id,pk"`
	AppId                         int `sql:"app_id,notnull"`
	App                           App
	CiPipelineId                  int         `sql:"ci_pipeline_id"`
	TriggerType                   TriggerType `sql:"trigger_type,notnull"` // automatic, manual
	EnvironmentId                 int         `sql:"environment_id"`
	Name                          string      `sql:"pipeline_name,notnull"`
	Deleted                       bool        `sql:"deleted,notnull"`
	PreStageConfig                string      `sql:"pre_stage_config_yaml"`
	PostStageConfig               string      `sql:"post_stage_config_yaml"`
	PreTriggerType                TriggerType `sql:"pre_trigger_type"`                   // automatic, manual
	PostTriggerType               TriggerType `sql:"post_trigger_type"`                  // automatic, manual
	PreStageConfigMapSecretNames  string      `sql:"pre_stage_config_map_secret_names"`  // configmap names
	PostStageConfigMapSecretNames string      `sql:"post_stage_config_map_secret_names"` // secret names
	RunPreStageInEnv              bool        `sql:"run_pre_stage_in_env"`               // secret names
	RunPostStageInEnv             bool        `sql:"run_post_stage_in_env"`              // secret names
	Environment                   cluster.Environment
	models.AuditLog
	// contains filtered or unexported fields
}

type PipelineRepository

type PipelineRepository interface {
	Save(pipeline []*Pipeline, tx *pg.Tx) error
	Update(pipeline *Pipeline, tx *pg.Tx) error
	FindActiveByAppId(appId int) (pipelines []*Pipeline, err error)
	Delete(id int, tx *pg.Tx) error
	FindByName(pipelineName string) (pipeline *Pipeline, err error)
	PipelineExists(pipelineName string) (bool, error)
	FindById(id int) (pipeline *Pipeline, err error)
	FindByIdsIn(ids []int) ([]*Pipeline, error)
	FindByCiPipelineIdsIn(ciPipelineIds []int) ([]*Pipeline, error)
	FindAutomaticByCiPipelineId(ciPipelineId int) (pipelines []*Pipeline, err error)
	GetByEnvOverrideId(envOverrideId int) ([]Pipeline, error)
	FindActiveByAppIdAndEnvironmentId(appId int, environmentId int) (pipelines []*Pipeline, err error)
	UndoDelete(id int) error
	UniqueAppEnvironmentPipelines() ([]*Pipeline, error)
	FindByCiPipelineId(ciPipelineId int) (pipelines []*Pipeline, err error)
	FindByPipelineTriggerGitHash(gitHash string) (pipeline *Pipeline, err error)
	FindByIdsInAndEnvironment(ids []int, environmentId int) ([]*Pipeline, error)
	FindActiveByAppIdAndEnvironmentIdV2() (pipelines []*Pipeline, err error)
	GetConnection() *pg.DB
}

type PipelineRepositoryImpl

type PipelineRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewPipelineRepositoryImpl

func NewPipelineRepositoryImpl(dbConnection *pg.DB, logger *zap.SugaredLogger) *PipelineRepositoryImpl

func (PipelineRepositoryImpl) Delete

func (impl PipelineRepositoryImpl) Delete(id int, tx *pg.Tx) error

func (PipelineRepositoryImpl) FindActiveByAppId

func (impl PipelineRepositoryImpl) FindActiveByAppId(appId int) (pipelines []*Pipeline, err error)

func (PipelineRepositoryImpl) FindActiveByAppIdAndEnvironmentId

func (impl PipelineRepositoryImpl) FindActiveByAppIdAndEnvironmentId(appId int, environmentId int) (pipelines []*Pipeline, err error)

func (PipelineRepositoryImpl) FindActiveByAppIdAndEnvironmentIdV2

func (impl PipelineRepositoryImpl) FindActiveByAppIdAndEnvironmentIdV2() (pipelines []*Pipeline, err error)

func (PipelineRepositoryImpl) FindAutomaticByCiPipelineId

func (impl PipelineRepositoryImpl) FindAutomaticByCiPipelineId(ciPipelineId int) (pipelines []*Pipeline, err error)

func (PipelineRepositoryImpl) FindByCiPipelineId

func (impl PipelineRepositoryImpl) FindByCiPipelineId(ciPipelineId int) (pipelines []*Pipeline, err error)

func (PipelineRepositoryImpl) FindByCiPipelineIdsIn

func (impl PipelineRepositoryImpl) FindByCiPipelineIdsIn(ciPipelineIds []int) ([]*Pipeline, error)

func (PipelineRepositoryImpl) FindByEnvOverrideId deprecated

func (impl PipelineRepositoryImpl) FindByEnvOverrideId(envOverrideId int) (pipeline []Pipeline, err error)

Deprecated:

func (PipelineRepositoryImpl) FindById

func (impl PipelineRepositoryImpl) FindById(id int) (pipeline *Pipeline, err error)

func (PipelineRepositoryImpl) FindByIdsIn

func (impl PipelineRepositoryImpl) FindByIdsIn(ids []int) ([]*Pipeline, error)

func (PipelineRepositoryImpl) FindByIdsInAndEnvironment

func (impl PipelineRepositoryImpl) FindByIdsInAndEnvironment(ids []int, environmentId int) ([]*Pipeline, error)

func (PipelineRepositoryImpl) FindByName

func (impl PipelineRepositoryImpl) FindByName(pipelineName string) (pipeline *Pipeline, err error)

func (PipelineRepositoryImpl) FindByPipelineTriggerGitHash

func (impl PipelineRepositoryImpl) FindByPipelineTriggerGitHash(gitHash string) (pipeline *Pipeline, err error)

func (PipelineRepositoryImpl) GetByEnvOverrideId

func (impl PipelineRepositoryImpl) GetByEnvOverrideId(envOverrideId int) ([]Pipeline, error)

func (PipelineRepositoryImpl) GetConnection

func (impl PipelineRepositoryImpl) GetConnection() *pg.DB

func (PipelineRepositoryImpl) PipelineExists

func (impl PipelineRepositoryImpl) PipelineExists(pipelineName string) (bool, error)

func (PipelineRepositoryImpl) Save

func (impl PipelineRepositoryImpl) Save(pipeline []*Pipeline, tx *pg.Tx) error

func (PipelineRepositoryImpl) UndoDelete

func (impl PipelineRepositoryImpl) UndoDelete(id int) error

func (PipelineRepositoryImpl) UniqueAppEnvironmentPipelines

func (impl PipelineRepositoryImpl) UniqueAppEnvironmentPipelines() ([]*Pipeline, error)

func (PipelineRepositoryImpl) Update

func (impl PipelineRepositoryImpl) Update(pipeline *Pipeline, tx *pg.Tx) error

type PipelineType

type PipelineType string

type SourceType

type SourceType string
const (
	SOURCE_TYPE_BRANCH_FIXED SourceType = "SOURCE_TYPE_BRANCH_FIXED"
	SOURCE_TYPE_BRANCH_REGEX SourceType = "SOURCE_TYPE_BRANCH_REGEX"
	SOURCE_TYPE_TAG_ANY      SourceType = "SOURCE_TYPE_TAG_ANY"
	SOURCE_TYPE_TAG_REGEX    SourceType = "SOURCE_TYPE_TAG_REGEX"
)

type TriggerType

type TriggerType string //HOW pipeline should be triggered
const TRIGGER_TYPE_AUTOMATIC TriggerType = "AUTOMATIC"
const TRIGGER_TYPE_MANUAL TriggerType = "MANUAL"

type TriggerWorkflowStatus

type TriggerWorkflowStatus struct {
	CdWorkflowStatus []*CdWorkflowStatus `json:"cdWorkflowStatus"`
	CiWorkflowStatus []*CiWorkflowStatus `json:"ciWorkflowStatus"`
}

type WorkflowExecutorType

type WorkflowExecutorType string

type WorkflowStatus

type WorkflowStatus int
const (
	WF_UNKNOWN WorkflowStatus = iota
	REQUEST_ACCEPTED
	ENQUEUED
	QUE_ERROR
	WF_STARTED
	DROPPED_STALE
	DEQUE_ERROR
	TRIGGER_ERROR
)

func (WorkflowStatus) String

func (a WorkflowStatus) String() string

type WorkflowWithArtifact

type WorkflowWithArtifact struct {
	Id                 int               `json:"id"`
	Name               string            `json:"name"`
	Status             string            `json:"status"`
	PodStatus          string            `json:"pod_status"`
	Message            string            `json:"message"`
	StartedOn          time.Time         `json:"started_on"`
	FinishedOn         time.Time         `json:"finished_on"`
	CiPipelineId       int               `json:"ci_pipeline_id"`
	Namespace          string            `json:"namespace"`
	LogFilePath        string            `json:"log_file_path"`
	GitTriggers        map[int]GitCommit `json:"git_triggers"`
	TriggeredBy        int32             `json:"triggered_by"`
	EmailId            string            `json:"email_id"`
	Image              string            `json:"image"`
	CiArtifactLocation string            `json:"ci_artifact_location"`
	CiArtifactId       int               `json:"ci_artifact_d"`
}

Jump to

Keyboard shortcuts

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