pipelinemgr

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWorkFlowProvide

func NewWorkFlowProvide(driver, addr, user, token, jobName string, flowProcessor jenkins.FlowProcessor) (workflow.WorkFlow, error)

NewWorkFlowProvide new workflow provide

func StepStruct

func StepStruct(sc string) ([]subTask, error)

StepStruct ..

func TestGetStatus added in v1.5.1

func TestGetStatus(t *testing.T)

Types

type AppMergeInfo

type AppMergeInfo struct {
	Name         string `json:"name"`
	SourceBranch string `json:"source_branch"`
	TargetBranch string `json:"target_branch"`
	Result       string `json:"result"`
	IsSuccess    bool   `json:"isSuccess"`
	Error        string `json:"error"`
}

AppMergeInfo ..

type AppParamsForCreatePublishJob

type AppParamsForCreatePublishJob struct {
	ProjectAppID int64  `json:"project_app_id"`
	Branch       string `json:"branch"`
	Path         string `json:"path"`
	ImageVersion string `json:"image_version"`
	Gray         bool   `json:"gray"`
	ImageAddr    string `json:"image_addr"`
}

AppParamsForCreatePublishJob ..

type AppParamsForHealthCheck

type AppParamsForHealthCheck struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	FullName string `json:"full_name"`
}

AppParamsForHealthCheck ..

type AutoTestReportRsp

type AutoTestReportRsp struct {
	SonarReportURL  string `json:"sonar_report_url"`
	AppName         string `json:"app_name"`
	CurrentRevision string `json:"current_revision"`
	BranchName      string `json:"branch_name"`
	JacocoReportURL string `json:"jacoco_report_url"`
}

AutoTestReportRsp ..

type BuildStepCallbackReq

type BuildStepCallbackReq struct {
	PublishJobID int64 `json:"publish_job_id"`
}

BuildStepCallbackReq ..

type BuildStepReq

type BuildStepReq struct {
	ActionName string            `json:"action_name,omitempty"`
	Apps       []*RunBuildAppReq `json:"apps,omitempty"`
	EnvVars    []EnvItem         `json:"env_vars,omitempty"`
}

BuildStepReq ..

type BuildStepResp

type BuildStepResp struct {
	Apps        []*PublishStepResp `json:"apps"`
	VersionNo   string             `json:"versionNo"`
	VersionName string             `json:"versionName"`
}

BuildStepResp ..

type ClusterListRsp

type ClusterListRsp struct {
	Jenkins []*clusterItem `json:"jenkins"`
	K8s     []*clusterItem `json:"k8s"`
}

ClusterListRsp ..

type DenyEnvItem

type DenyEnvItem struct {
	Name   string `json:"name"`
	Env    string `json:"env"`
	Enable bool   `json:"deny"`
}

DenyEnvItem ..

type DenyEnvList

type DenyEnvList []*DenyEnvItem

DenyEnvList ..

func (*DenyEnvList) String

func (p *DenyEnvList) String() (string, error)

String ...

func (DenyEnvList) Struct

func (p DenyEnvList) Struct(sc string) (DenyEnvList, error)

Struct ...

type DeployStepAppRsp

type DeployStepAppRsp struct {
	Type         string `json:"type"`
	Name         string `json:"name"`
	ProjectAppID int64  `json:"project_app_id"`
}

DeployStepAppRsp ..

type DeployStepReq

type DeployStepReq struct {
	ActionName string             `json:"action_name"`
	Apps       []*RunDeployAppReq `json:"apps"`
}

DeployStepReq ..

type EnvItem

type EnvItem struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

EnvItem env variable

type FakePublishJobRsp

type FakePublishJobRsp struct {
	Progress int    `json:"progress"`
	Status   string `json:"status"`
}

FakePublishJobRsp ..

type FlowStageReq

type FlowStageReq struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Cluster     string `json:"cluster"`
	CIServer    string `json:"ci_server"`
	ArrangeEnv  string `json:"arrange_env"`
}

FlowStageReq create stage

type JenkinsConfigRsp

type JenkinsConfigRsp struct {
	Jenkins string `json:"jenkins"`
}

JenkinsConfigRsp ..

type ManualStepReq

type ManualStepReq struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

ManualStepReq ..

type ManualStepResp

type ManualStepResp struct {
	PreviousStep *StepRsp `json:"previous_step"`
	CurrenStep   *StepRsp `json:"current_step"`
}

ManualStepResp ..

type MergeBranchStepApp

type MergeBranchStepApp struct {
	*models.PublishApp
	TargetBranch []string `json:"target_branch"`
	AppName      string   `json:"app_name"`
}

MergeBranchStepApp ..

type MergeBranchStepResp

type MergeBranchStepResp struct {
	*models.Publish
	Apps []*MergeBranchStepApp `json:"apps"`
}

MergeBranchStepResp ..

type PipelineBaseReq

type PipelineBaseReq struct {
	Description string `json:"description"`
	Name        string `json:"name"`
	ID          int64  `json:"id"`
	Enabled     bool   `json:"enabled"`
	IsDefault   bool   `json:"is_default"`
}

PipelineBaseReq ..

type PipelineConfig

type PipelineConfig []*PipelineStageStruct

PipelineConfig ..

func (PipelineConfig) Struct

func (config PipelineConfig) Struct(sc string) (PipelineConfig, error)

Struct ..

type PipelineManager

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

PipelineManager ...

func NewPipelineManager

func NewPipelineManager() *PipelineManager

NewPipelineManager ...

func (*PipelineManager) AutoTriggerNextStep

func (pm *PipelineManager) AutoTriggerNextStep(publish *models.Publish, nextStepType string) (int64, int64, string, error)

AutoTriggerNextStep ..

func (*PipelineManager) CheckCurrentStepWhertherLastStageLastStep

func (pm *PipelineManager) CheckCurrentStepWhertherLastStageLastStep(publishID, stageID int64) (bool, bool, error)

CheckCurrentStepWhertherLastStageLastStep ..

func (*PipelineManager) CreateBuildJob

func (pm *PipelineManager) CreateBuildJob(creator string, projectID, publishID int64, envStageJSON *PipelineStageStruct, apps []*RunBuildAppReq, customeEnvVars []EnvItem) (int64, string, error)

CreateBuildJob return publishjob run id, error

func (*PipelineManager) CreateDeployJob

func (pm *PipelineManager) CreateDeployJob(creator string, projectID, publishID int64, stageJSON *PipelineStageStruct, apps []*RunDeployAppReq) (int64, string, error)

CreateDeployJob return publishjob run id, error

func (*PipelineManager) CreatePublishJob

func (pm *PipelineManager) CreatePublishJob(projectID, publishID, stageID int64,
	operator string, jobType string,
	allAppsParms []*AppParamsForCreatePublishJob) (int64, error)

CreatePublishJob ..

func (*PipelineManager) CreateTaskTmpl

func (pm *PipelineManager) CreateTaskTmpl(request *TaskTmplReq, creator string) error

CreateTaskTmpl ..

func (*PipelineManager) DeleteTaskTmpl

func (pm *PipelineManager) DeleteTaskTmpl(stepID int64) error

DeleteTaskTmpl ..

func (*PipelineManager) GetAppCodeCommitByBranch added in v1.5.1

func (pm *PipelineManager) GetAppCodeCommitByBranch(appID int64, branchName string) (string, error)

func (*PipelineManager) GetCIConfig

func (pm *PipelineManager) GetCIConfig(stageID int64) ([]string, error)

GetCIConfig ..

func (*PipelineManager) GetFirstStepByPipelineInstanceIDAndStageID

func (pm *PipelineManager) GetFirstStepByPipelineInstanceIDAndStageID(instanceID, stageID int64) (string, string, error)

GetFirstStepByPipelineInstanceIDAndStageID ..

func (*PipelineManager) GetFlowComponents

func (pm *PipelineManager) GetFlowComponents() ([]*models.FlowComponent, error)

GetFlowComponents ..

func (*PipelineManager) GetJenkinsConfig

func (pm *PipelineManager) GetJenkinsConfig(stageID int64) (*JenkinsConfigRsp, error)

GetJenkinsConfig ..

func (*PipelineManager) GetNextStepType

func (pm *PipelineManager) GetNextStepType(publishID int64, stepIndex int) (string, string, error)

GetNextStepType ..

func (*PipelineManager) GetNextStepTypeByStageID

func (pm *PipelineManager) GetNextStepTypeByStageID(instanceID, stageID int64, stepIndex int) (string, error)

GetNextStepTypeByStageID ..

func (*PipelineManager) GetPipelineInstanceEnvStageByID

func (pm *PipelineManager) GetPipelineInstanceEnvStageByID(pipelineInstanceID, stageID int64) (*PipelineStageStruct, error)

GetPipelineInstanceEnvStageByID ..

func (*PipelineManager) GetPipelineInstanceJSONByID

func (pm *PipelineManager) GetPipelineInstanceJSONByID(pipelineInstanceID int64) (PipelineConfig, error)

GetPipelineInstanceJSONByID ..

func (*PipelineManager) GetPublishStats

func (pm *PipelineManager) GetPublishStats(projectID int64, request *PublishStatsReq) ([]*PublishStatsRsp, error)

GetPublishStats ..

func (*PipelineManager) GetStepInfo

func (pm *PipelineManager) GetStepInfo(projectID int64, publishID int64, stageID int64, stepName string) (interface{}, error)

GetStepInfo ...

func (*PipelineManager) GetTaskTmplByName

func (pm *PipelineManager) GetTaskTmplByName(name string) (*models.TaskTmpl, error)

GetTaskTmpls ..

func (*PipelineManager) GetTaskTmpls

func (pm *PipelineManager) GetTaskTmpls() ([]TaskTmplResp, error)

GetTaskTmpls ..

func (*PipelineManager) GetTaskTmplsByPagination

func (pm *PipelineManager) GetTaskTmplsByPagination(filter *query.FilterQuery) (*query.QueryResult, error)

GetTaskTmplsByPagination ..

func (*PipelineManager) RunBuildDeployCallBackStep

func (pm *PipelineManager) RunBuildDeployCallBackStep(request *BuildStepCallbackReq) (int64, error)

RunBuildDeployCallBackStep publish-order build callback operation

func (*PipelineManager) RunBuildStep

func (pm *PipelineManager) RunBuildStep(projectID, publishID, stageID int64, creator, stepName string, params *BuildStepReq) (int64, int64, string, error)

RunBuildStep publish-order build operation

func (*PipelineManager) RunDeployStep

func (pm *PipelineManager) RunDeployStep(projectID, publishID, stageID int64, creator, stepName string, params *DeployStepReq) (int64, int64, string, error)

RunDeployStep publish-order deploy operation

func (*PipelineManager) RunManualStep

func (pm *PipelineManager) RunManualStep(publishID, stageID int64, request *ManualStepReq) (int64, error)

RunManualStep .. return publish status, error

func (*PipelineManager) UpdatePublishJob

func (pm *PipelineManager) UpdatePublishJob(publishJobID, runID int64) error

UpdatePublishJob update job runID into publishjob item

func (*PipelineManager) UpdatePublishJobStatus

func (pm *PipelineManager) UpdatePublishJobStatus(publishJobID int64, status string) error

UpdatePublishJobStatus ..

func (*PipelineManager) UpdateTaskTmpl

func (pm *PipelineManager) UpdateTaskTmpl(request *TaskTmplReq, stepID int64) error

UpdateTaskTmpl ..

type PipelineSetupReq

type PipelineSetupReq struct {
	PipelineBaseReq
	Configs []*PipelineStageStruct `json:"configs"`
}

PipelineSetupReq ..

type PipelineStageStruct

type PipelineStageStruct struct {
	StageID    int64         `json:"stage_id"`
	PipelineID int64         `json:"pipeline_id"`
	Index      int64         `json:"index"`
	ID         int64         `json:"id"`
	Steps      PipelineSteps `json:"steps"`
	Name       string        `json:"name,omitempty"`
	// instance part
	PipelineInstanceID int64 `json:"pipeline_instance_id,omitempty"`
}

PipelineStageStruct ..

func (*PipelineStageStruct) String

func (p *PipelineStageStruct) String() (string, error)

String ...

type PipelineSteps

type PipelineSteps []*struct {
	Name        string     `json:"name"`
	Type        string     `json:"type"`
	TypeDisplay string     `json:"type_display,omitempty"`
	StepID      int64      `json:"step_id"`
	Index       int        `json:"index"`
	Driver      string     `json:"driver"`
	SubTask     []*subTask `json:"sub_task"`
}

PipelineSteps ..

func (PipelineSteps) Struct

func (p PipelineSteps) Struct(sc string) (PipelineSteps, error)

Struct ...

type ProjectWhiteIDs

type ProjectWhiteIDs []int64

ProjectWhiteIDs ..

func (*ProjectWhiteIDs) String

func (p *ProjectWhiteIDs) String() (string, error)

String ...

func (ProjectWhiteIDs) Struct

func (p ProjectWhiteIDs) Struct(ws string) (ProjectWhiteIDs, error)

Struct ...

type PublishJobAppRsp

type PublishJobAppRsp struct {
	*models.PublishJobApp
	AppName string `json:"app_name"`
}

PublishJobAppRsp ..

type PublishJobBuildResult

type PublishJobBuildResult struct {
	AppID           string `json:"app_id"`
	ImageVersion    string `json:"image_version"`
	OriginRevision  string `json:"origin_revision"`
	CurrentRevision string `json:"current_revision"`
	Release         string `json:"release"`
}

PublishJobBuildResult ..

type PublishJobRsp

type PublishJobRsp struct {
	*models.PublishJob
	Apps []*PublishJobAppRsp `json:"apps"`
}

PublishJobRsp ..

type PublishSetupReq

type PublishSetupReq struct {
	Announcement    string          `json:"announcement"`
	DateEnabled     bool            `json:"date_enable"`
	DenyEndTime     string          `json:"deny_end_time"`
	DenyStartTime   string          `json:"deny_start_time"`
	DenyEnvList     DenyEnvList     `json:"deny_env_list"`
	WeeklyDenyList  WeeklyDenyList  `json:"pre_week_deny_list"`
	ProjectWhiteIDs ProjectWhiteIDs `json:"project_white_ids"`
}

PublishSetupReq ..

type PublishStatsReq

type PublishStatsReq struct {
	AppIDs    []int64 `json:"app_ids"`
	StartTime string  `json:"start_time"`
	EndTime   string  `json:"end_time"`
	EnvIDs    []int64 `json:"env_ids"`
}

PublishStatsReq ..

type PublishStatsRsp

type PublishStatsRsp struct {
	Time          string `json:"time"`
	BuildSuccess  int64  `json:"build_success"`
	BuildFailed   int64  `json:"build_failed"`
	DeploySuccess int64  `json:"deploy_success"`
	DeployFailed  int64  `json:"deploy_failed"`
	TotalSuccess  int64  `json:"total_success"`
	TotalFailed   int64  `json:"total_failed"`
}

PublishStatsRsp ..

type PublishStepResp

type PublishStepResp struct {
	TargetBranch      []string `json:"target_branch,omitempty"`
	AppName           string   `json:"app_name,omitempty"`
	Type              string   `json:"type,omitempty"`
	ProjectAppID      int64    `json:"project_app_id,omitempty"`
	Language          string   `json:"language,omitempty"`
	BranchName        string   `json:"branch_name,omitempty"`
	BuildPath         string   `json:"build_path,omitempty"`
	CompileCommand    string   `json:"compile_command,omitempty"`
	BranchHistoryList []string `json:"branch_history_list,omitempty"`
}

PublishStepResp ...

type ResetPipelineReq

type ResetPipelineReq struct {
	CID int64 `json:"cID"`
}

ResetPipelineReq ..

type RunBuildAllParms

type RunBuildAllParms struct {
	*RunBuildAppReq
	*models.ScmApp
	Release     string `json:"release"`
	MergeBranch bool   `json:"merge-branch"`
	ProjectID   int64
}

RunBuildAllParms there are all apps parms for jenkins pipeline job

type RunBuildAppReq

type RunBuildAppReq struct {
	Branch         string `json:"branch_name"`
	CompileCommand string `json:"compile_command"`
	ProjectAppID   int64  `json:"project_app_id"`
}

RunBuildAppReq .

type RunDeployAllParms

type RunDeployAllParms struct {
	*models.ScmApp
	*RunDeployAppReq
	ImageAddr string `json:"image_addr"`
	ProjectID int64
}

RunDeployAllParms there are all apps parms for jenkins pipeline job

type RunDeployAppReq

type RunDeployAppReq struct {
	ProjectAppID int64 `json:"project_app_id"`
	Gray         bool  `json:"gray"`
}

RunDeployAppReq .

type StepRsp

type StepRsp struct {
	Name    string `json:"name,omitempty"`
	Creator string `json:"creator,omitempty"`
	Message string `json:"message,omitempty"`
}

StepRsp .. manual step defined

type StepTemplate

type StepTemplate []*struct {
	Index        int      `json:"index"`
	Enable       bool     `json:"enable"`
	Role         []string `json:"role"`
	Name         string   `json:"name"`
	SystemCode   string   `json:"system_code"`
	TargetBranch []string `json:"target_branch,omitempty"`
}

StepTemplate ...

func (StepTemplate) Struct

func (p StepTemplate) Struct(sc string) (StepTemplate, error)

Struct ...

type SubTask

type SubTask subTask

type TaskTmplReq

type TaskTmplReq struct {
	Name        string    `json:"name"`
	Type        string    `json:"type"`
	Description string    `json:"description"`
	SubTask     []SubTask `json:"sub_task"`
}

TaskTmplReq create step

func (*TaskTmplReq) String

func (f *TaskTmplReq) String() (string, error)

String ...

type TaskTmplResp

type TaskTmplResp struct {
	Name        string    `json:"name,omitempty"`
	Type        string    `json:"type,omitempty"`
	Description string    `json:"description,omitempty"`
	SubTask     []subTask `json:"sub_task,omitempty"`

	ID          int64     `json:"id,omitempty"`
	ComponentID int64     `json:"component_id,omitempty"`
	CreateAt    time.Time `json:"create_at,omitempty"`
	UpdateAt    time.Time `json:"update_at,omitempty"`
	Creator     string    `json:"creator,omitempty"`
	TypeDisplay string    `json:"type_display,omitempty"`
}

TaskTmplResp ..

type WeeklyDenyList

type WeeklyDenyList []*struct {
	StartTime string `json:"start_time"`
	Enable    bool   `json:"enable"`
	Name      string `json:"name"`
	EndTime   string `json:"end_time"`
}

WeeklyDenyList ..

func (*WeeklyDenyList) String

func (w *WeeklyDenyList) String() (string, error)

String ...

func (WeeklyDenyList) Struct

func (w WeeklyDenyList) Struct(ws string) (WeeklyDenyList, error)

Struct ...

Jump to

Keyboard shortcuts

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