types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	SystemPluginBuildCodeToImage = "build_code_to_image"
	SystemPluginExecuteShell     = "execute_shell"
	SystemPluginApprove          = "approve"
	SystemPluginUnitTesting      = "unit_testing"
	SystemPluginRelease          = "release"
	SystemPluginDeployKubernetes = "deploy_kubernetes"
	SystemPluginRollback         = "rollback"
	SystemPluginDeployHelm       = "deploy_helm"
	SystemPluginDeployServer     = "deploy_server"
	SystemPluginWebHook          = "webhook"
)
View Source
const (
	WorkspaceCodeTypeHttps  = "https"
	WorkspaceCodeTypeGit    = "git"
	WorkspaceCodeTypeGitHub = "github"
	WorkspaceCodeTypeGitLab = "gitlab"
	WorkspaceCodeTypeGitee  = "gitee"
)
View Source
const (
	PipelineStatusWait  = "wait"
	PipelineStatusDoing = "doing"
	PipelineStatusOK    = "ok"
	PipelineStatusError = "error"
	PipelineStatusPause = "pause"
	// PipelineStatusCancel 取消中,取消完成后状态为canceled
	PipelineStatusCancel = "cancel"
	// PipelineStatusCanceled 取消执行完成后状态
	PipelineStatusCanceled = "canceled"

	PipelineEnvWorkspaceId         = "PIPELINE_WORKSPACE_ID"
	PipelineEnvWorkspaceName       = "PIPELINE_WORKSPACE_NAME"
	PipelineEnvPipelineId          = "PIPELINE_PIPELINE_ID"
	PipelineEnvPipelineName        = "PIPELINE_PIPELINE_NAME"
	PipelineEnvPipelineBuildNumber = "PIPELINE_BUILD_NUMBER"
	PipelineEnvPipelineTriggerUser = "PIPELINE_TRIGGER_USER"
	PipelineEnvPipelineBuildId     = "PIPELINE_BUILD_ID"
)
View Source
const (
	// PipelineTriggerTypeCron 定时触发流水线构建
	PipelineTriggerTypeCron = "cron"
	// PipelineTriggerTypeCode 代码提交更新时触发流水线构建
	PipelineTriggerTypeCode = "code"
)
View Source
const (
	// PipelineTriggerEventStatusNew 新生成未消费的触发事件
	PipelineTriggerEventStatusNew = "new"
	// PipelineTriggerEventStatusConsumed 已消费的事件
	PipelineTriggerEventStatusConsumed = "consumed"

	// PipelineTriggerEventFromTrigger 事件触发来源流水线触发配置
	PipelineTriggerEventFromTrigger = "trigger"
)
View Source
const (
	// PluginParamsFromEnv 从当前执行的环境变量中获取参数
	PluginParamsFromEnv = "env"

	// PluginParamsFromJob 从当前任务中的运行时变量获取执行参数
	PluginParamsFromJob = "job"

	// PluginParamsFromCodeSecret 当前流水线空间的代码密钥
	PluginParamsFromCodeSecret = "code_secret"

	// PluginParamsFromImageRegistry 平台配置中的镜像仓库配置
	PluginParamsFromImageRegistry = "image_registry"

	// PluginParamsFromPipelineResource 流水线中的资源数据,如镜像以及主机
	PluginParamsFromPipelineResource = "pipeline_resource"

	// PluginParamsFromPipelineEnv 流水线执行到当前的所有参数
	PluginParamsFromPipelineEnv = "pipeline_env"
)
View Source
const (
	SettingsSecretTypePassword = "password"
	SettingsSecretTypeKey      = "key"
	SettingsSecretTypeToken    = "token"
)

Variables

View Source
var JobAlreadyRunningError = errors.New("jobs already running")

Functions

This section is empty.

Types

type CodeBranchCommitCache

type CodeBranchCommitCache struct {
	BranchLatestCommit map[string]*PipelineBuildCodeBranch `json:"branches"`
}

CodeBranchCommitCache 流水线代码源分支最新提交记录缓存

type ImageRegistry

type ImageRegistry struct {
	Registry string `json:"registry"`
	User     string `json:"user"`
	Password string `json:"password"`
}

type Map

type Map map[string]interface{}

type PipelineBuildCodeBranch

type PipelineBuildCodeBranch struct {
	Branch     string    `json:"branch"`
	CommitId   string    `json:"commit_id"`
	Author     string    `json:"author"`
	Message    string    `json:"message"`
	CommitTime time.Time `json:"commit_time"`
}

type PipelineBuildConfig

type PipelineBuildConfig struct {
	// 代码源触发时的提交
	CodeBranch *PipelineBuildCodeBranch `json:"codeBranch,omitempty"`
	// 自定义流水线触发时的流水线源
	CustomSources []*PipelineBuildCustomSource `json:"customSources,omitempty"`
}

PipelineBuildConfig 流水线触发事件的配置信息,

  1. 如果是代码源更新触发,则触发配置为分支以及commit_id
  2. 如果是定时触发,则该配置为空,根据流水线的类型生成流水线构建 a. 如果是代码源流水线,则根据监听的所有分支,找到最新构建的分支进行构建 b. 如果是自定义流水线,则查询监听的所有流水线,找到最新的构建成功的记录进行构建

type PipelineBuildCustomSource

type PipelineBuildCustomSource struct {
	WorkspaceId         uint   `json:"workspaceId"`
	WorkspaceName       string `json:"workspaceName"`
	PipelineId          uint   `json:"pipelineId"`
	PipelineName        string `json:"pipelineName"`
	BuildReleaseVersion string `json:"buildReleaseVersion"`
	BuildId             uint   `json:"buildId"`
	BuildNumber         uint   `json:"buildNumber"`
	BuildOperator       string `json:"buildOperator"`
	IsBuild             bool   `json:"isBuild" default:"true"`
}

type PipelineJob

type PipelineJob struct {
	Name                   string                     `json:"name"`
	PluginKey              string                     `json:"pluginKey"`
	Params                 map[string]interface{}     `json:"params"`
	PipeFlowSchedulePolicy *PipelineJobSchedulePolicy `json:"pipeFlowSchedulePolicy,omitempty"`
}

type PipelineJobSchedulePolicy

type PipelineJobSchedulePolicy struct {
	Hostname         string            `json:"hostname,omitempty"`
	PipeFlowSelector map[string]string `json:"pipeFlowSelector,omitempty"`
}

PipelineJobSchedulePolicy 任务调度策略 1. 指定主机 2. 指定标签

type PipelineJobs

type PipelineJobs []*PipelineJob

type PipelinePlugin

type PipelinePlugin struct {
	ID         uint                    `gorm:"primaryKey"`
	Name       string                  `gorm:"size:255;not null;uniqueIndex:idx_plugin_name"`
	Key        string                  `gorm:"size:50;not null;uniqueIndex:idx_plugin_key"`
	Url        string                  `gorm:"size:255;not null"`
	Params     PipelinePluginParams    `gorm:"type:json;not null"`
	Version    string                  `gorm:"version"`
	ResultEnv  PipelinePluginResultEnv `gorm:"type:json;"`
	CreateTime time.Time               `gorm:"not null;autoCreateTime"`
	UpdateTime time.Time               `gorm:"not null;autoUpdateTime"`
}

type PipelinePluginParams

type PipelinePluginParams struct {
	Params []*PipelinePluginParamsSpec `json:"params"`
}

type PipelinePluginParamsSpec

type PipelinePluginParamsSpec struct {
	ParamName string      `json:"paramName"`
	From      string      `json:"from"`
	FromName  string      `json:"fromName"`
	Default   interface{} `json:"default"`
}

type PipelinePluginResultEnv

type PipelinePluginResultEnv struct {
	EnvPath []*PipelinePluginResultEnvPath `json:"envPath"`
}

type PipelinePluginResultEnvPath

type PipelinePluginResultEnvPath struct {
	EnvName    string `json:"env_name"`
	ResultName string `json:"result_name"`
}

type PipelineResource

type PipelineResource struct {
	ID          uint            `gorm:"primaryKey" json:"id"`
	WorkspaceId uint            `gorm:"not null;uniqueIndex:idx_workspace_resource" json:"workspaceId"`
	Name        string          `gorm:"size:255;not null;uniqueIndex:idx_workspace_resource" json:"name"`
	Global      bool            `gorm:"default:false" json:"global"`
	Type        string          `gorm:"size:50;not null" json:"type"`
	Value       string          `gorm:"size:500; not null;" json:"value"`
	SecretId    uint            `gorm:"" json:"secretId"`
	Secret      *SettingsSecret `gorm:"-" json:"secret"`
	Description string          `gorm:"size:2000" json:"description"`
	CreateUser  string          `gorm:"size:50;not null" json:"createUser"`
	UpdateUser  string          `gorm:"size:50;not null" json:"updateUser"`
	CreateTime  time.Time       `gorm:"not null;autoCreateTime" json:"createTime"`
	UpdateTime  time.Time       `gorm:"not null;autoUpdateTime" json:"updateTime"`
}

type PipelineRun

type PipelineRun struct {
	ID          uint      `gorm:"primaryKey" json:"id"`
	PipelineId  uint      `gorm:"not null;uniqueIndex:idx_pipeline_build_number" json:"pipelineId"`
	BuildNumber uint      `gorm:"not null;uniqueIndex:idx_pipeline_build_number" json:"buildNumber"`
	Params      Map       `gorm:"type:json" json:"params"`
	Status      string    `gorm:"size:50;not null" json:"status"`
	Env         Map       `gorm:"type:json" json:"env"`
	Operator    string    `gorm:"size:50;not null" json:"operator"`
	CreateTime  time.Time `gorm:"not null;autoCreateTime" json:"createTime"`
	UpdateTime  time.Time `gorm:"not null;autoUpdateTime" json:"updateTime"`
}

func (*PipelineRun) Unmarshal

func (p *PipelineRun) Unmarshal(bytes []byte) (interface{}, error)

type PipelineRunJob

type PipelineRunJob struct {
	ID             uint                       `gorm:"primaryKey" json:"id"`
	PipelineRunId  uint                       `gorm:"not null" json:"PipelineRunId"`
	StageRunId     uint                       `gorm:"not null" json:"stageRunId"`
	Name           string                     `gorm:"size:50;not null" json:"name"`
	PluginKey      string                     `gorm:"size:255;not null" json:"pluginKey"`
	Status         string                     `gorm:"size:50;not null" json:"status"`
	Env            Map                        `gorm:"type:json;comment:任务执行完成后的变量参数值" json:"env"`
	Params         Map                        `gorm:"type:json;not null;comment:任务执行时参数" json:"params"`
	Result         *utils.Response            `gorm:"type:json;comment:任务执行结果" json:"result"`
	PipeFlowId     uint                       `gorm:"comment:任务执行时的pipeflow代理节点" json:"pipeFlowId"`
	SchedulePolicy *PipelineJobSchedulePolicy `gorm:"type:json;comment:任务执行时调度策略" json:"schedulePolicy"`
	CreateTime     time.Time                  `gorm:"not null;autoCreateTime" json:"createTime"`
	UpdateTime     time.Time                  `gorm:"not null;autoUpdateTime" json:"updateTime"`
}

func (*PipelineRunJob) Unmarshal

func (p *PipelineRunJob) Unmarshal(bytes []byte) (interface{}, error)

type PipelineRunJobLog

type PipelineRunJobLog struct {
	ID         uint      `gorm:"primaryKey" json:"id"`
	JobRunId   uint      `gorm:"column:job_run_id;not null" json:"jobRunId"`
	Logs       string    `gorm:"type:longtext" json:"logs"`
	CreateTime time.Time `gorm:"not null;autoCreateTime" json:"createTime"`
	UpdateTime time.Time `gorm:"not null;autoUpdateTime" json:"updateTime"`
}

type PipelineRunJobs

type PipelineRunJobs []*PipelineRunJob

type PipelineRunStage

type PipelineRunStage struct {
	ID             uint            `gorm:"primaryKey" json:"id"`
	Name           string          `gorm:"name;size:255;not null" json:"name"`
	TriggerMode    string          `gorm:"size:20;not null" json:"triggerMode"`
	PrevStageRunId uint            `gorm:"not null" json:"prevStageRunId"`
	PipelineRunId  uint            `gorm:"not null" json:"pipelineRunId"`
	Status         string          `gorm:"size:50;not null" json:"status"`
	Env            Map             `gorm:"type:json" json:"env"`
	CustomParams   Map             `gorm:"json" json:"customParams"`
	Jobs           PipelineRunJobs `gorm:"-" json:"jobs"`
	ExecTime       time.Time       `gorm:"not null;autoCreateTime" json:"execTime"`
	FinishTime     *time.Time      `gorm:"" json:"finish_time"`
	CreateTime     time.Time       `gorm:"not null;autoCreateTime" json:"createTime"`
	UpdateTime     time.Time       `gorm:"not null;autoUpdateTime" json:"updateTime"`
}

type PipelineSource

type PipelineSource struct {
	Type          string `json:"type"`
	Workspace     uint   `json:"workspace"`
	WorkspaceName string `json:"workspace_name"`
	Pipeline      uint   `json:"pipeline"`
	PipelineName  string `json:"pipeline_name"`
	Stage         uint   `json:"stage"`
	BranchType    string `json:"branch_type"`
	Operator      string `json:"operator"`
	Branch        string `json:"branch"`
}

PipelineSource 流水线触发源,代码分支以及其他流水线

type PipelineSources

type PipelineSources []*PipelineSource

type PipelineStage

type PipelineStage struct {
	ID           uint         `gorm:"primaryKey" json:"id"`
	Name         string       `gorm:"size:50;not null;uniqueIndex:idx_pipeline_stage_name" json:"name"`
	PipelineId   uint         `gorm:"not null;uniqueIndex:idx_pipeline_stage_name" json:"pipelineId"`
	CustomParams Map          `gorm:"type:json" json:"customParams"` // 在流水线中对阶段的自定义参数,执行时自动放到阶段的env中
	TriggerMode  string       `gorm:"size:20;not null;" json:"triggerMode"`
	PrevStageId  uint         `gorm:"not null" json:"prevStageId"`
	Jobs         PipelineJobs `gorm:"type:json;not null" json:"jobs"`
}

PipelineStage 流水线阶段

type PipelineTrigger

type PipelineTrigger struct {
	ID              uint                  `gorm:"primaryKey" json:"id"`
	PipelineId      uint                  `gorm:"" json:"pipelineId"`
	Type            string                `json:"type"`
	Config          PipelineTriggerConfig `gorm:"type:json" json:"config"`
	NextTriggerTime *sql.NullTime         `gorm:"" json:"NextTriggerTime"`
	UpdateUser      string                `gorm:"size:50;not null" json:"updateUser"`
	CreateTime      time.Time             `gorm:"not null;autoCreateTime" json:"createTime"`
	UpdateTime      time.Time             `gorm:"not null;autoUpdateTime" json:"updateTime"`
}

PipelineTrigger 流水线触发配置

func (*PipelineTrigger) Unmarshal

func (p *PipelineTrigger) Unmarshal(bytes []byte) (interface{}, error)

type PipelineTriggerConfig

type PipelineTriggerConfig struct {
	// 定时触发配置
	Cron *PipelineTriggerConfigCron `json:"cron,omitempty"`
	// 代码源分支最近一次触发的提交记录
	Code *PipelineTriggerConfigCode `json:"code,omitempty"`
}

type PipelineTriggerConfigCode

type PipelineTriggerConfigCode struct {
	BranchLatestCommit map[string]*PipelineBuildCodeBranch `json:"branches"`
}

PipelineTriggerConfigCode 流水线代码源分支最新提交记录

type PipelineTriggerConfigCron

type PipelineTriggerConfigCron struct {
	Cron string `json:"cron"`
}

PipelineTriggerConfigCron 流水线定时触发配置

type PipelineTriggerEvent

type PipelineTriggerEvent struct {
	ID          uint                `gorm:"primaryKey" json:"id"`
	PipelineId  uint                `gorm:"" json:"pipelineId"`
	From        string              `gorm:"size:50" json:"from"`
	TriggerId   uint                `gorm:"" json:"triggerId"`
	Status      string              `gorm:"size:50;" json:"status"`
	EventConfig PipelineBuildConfig `gorm:"type:json" json:"eventConfig"`
	EventResult *utils.Response     `gorm:"type:json" json:"eventResult"`
	TriggerUser string              `gorm:"size:255;" json:"triggerUser"`
	CreateTime  time.Time           `gorm:"not null;autoCreateTime" json:"createTime"`
	UpdateTime  time.Time           `gorm:"not null;autoUpdateTime" json:"updateTime"`
}

PipelineTriggerEvent 根据流水线触发配置,当触发条件达到时生成触发事件,根据事件生成新的流水线构建任务

func (*PipelineTriggerEvent) Unmarshal

func (p *PipelineTriggerEvent) Unmarshal(bytes []byte) (interface{}, error)

type Secret

type Secret struct {
	Type        string `json:"type"`
	User        string `json:"user"`
	Password    string `json:"password"`
	PrivateKey  string `json:"privateKey"`
	AccessToken string `json:"accessToken"`
}

Secret 用于所有地方的密钥,比如git、镜像仓库等

type SettingsImageRegistry

type SettingsImageRegistry struct {
	ID         uint      `gorm:"primaryKey" json:"id"`
	Registry   string    `gorm:"size:255;not null;uniqueIndex" json:"registry"`
	User       string    `gorm:"size:255;not null;" json:"user"`
	Password   string    `gorm:"size:255;not null;" json:"password"`
	CreateUser string    `gorm:"size:255;not null" json:"createUser"`
	UpdateUser string    `gorm:"size:255;not null" json:"updateUser"`
	CreateTime time.Time `gorm:"not null;autoCreateTime" json:"createTime"`
	UpdateTime time.Time `gorm:"not null;autoUpdateTime" json:"updateTime"`
}

func (*SettingsImageRegistry) GetImageRegistry

func (s *SettingsImageRegistry) GetImageRegistry() *ImageRegistry

type SettingsSecret

type SettingsSecret struct {
	ID          uint      `gorm:"primaryKey" json:"id"`
	Name        string    `gorm:"size:255;not null;uniqueIndex" json:"name"`
	Description string    `gorm:"size:2000;" json:"description"`
	Type        string    `gorm:"size:50;not null" json:"type"`
	User        string    `gorm:"size:255;" json:"user"`
	Password    string    `gorm:"size:255;" json:"-"`
	PrivateKey  string    `gorm:"size:5000;" json:"-"`
	AccessToken string    `gorm:"size:2000;" json:"-"`
	CreateUser  string    `gorm:"size:255;not null" json:"createUser"`
	UpdateUser  string    `gorm:"size:255;not null" json:"updateUser"`
	CreateTime  time.Time `gorm:"not null;autoCreateTime" json:"createTime"`
	UpdateTime  time.Time `gorm:"not null;autoUpdateTime" json:"updateTime"`
}

func (*SettingsSecret) GetSecret

func (s *SettingsSecret) GetSecret() *Secret

Jump to

Keyboard shortcuts

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