jobcontroller

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DindServer              = "dind"
	KoderoverAgentNamespace = "koderover-agent"
)
View Source
const (
	BusyBoxImage       = "koderover.tencentcloudcr.com/koderover-public/busybox:latest"
	ZadigContextDir    = "/zadig/"
	ZadigLogFile       = ZadigContextDir + "zadig.log"
	ZadigLifeCycleFile = ZadigContextDir + "lifecycle"
	JobExecutorFile    = "http://resource-server/jobexecutor"
	ResourceServer     = "resource-server"
)
View Source
const (
	CanaryDeploymentSuffix = "-zadig-canary"
)

Variables

This section is empty.

Functions

func CleanWorkflowJobs

func CleanWorkflowJobs(ctx context.Context, workflowTask *commonmodels.WorkflowTask, workflowCtx *commonmodels.WorkflowTaskCtx, logger *zap.SugaredLogger, ack func())

func GetK8sClients

func GetK8sClients(hubServerAddr, clusterID string) (crClient.Client, kubernetes.Interface, *rest.Config, error)

func GetObjectPath

func GetObjectPath(subFolder, name string) string

func RunJobs

func RunJobs(ctx context.Context, jobs []*commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, concurrency int, logger *zap.SugaredLogger, ack func())

Types

type BlueGreenDeployJobCtl

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

func NewBlueGreenDeployJobCtl

func NewBlueGreenDeployJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, ack func(), logger *zap.SugaredLogger) *BlueGreenDeployJobCtl

func (*BlueGreenDeployJobCtl) Clean

func (c *BlueGreenDeployJobCtl) Clean(ctx context.Context)

func (*BlueGreenDeployJobCtl) Run

type BlueGreenReleaseJobCtl

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

func NewBlueGreenReleaseJobCtl

func NewBlueGreenReleaseJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, ack func(), logger *zap.SugaredLogger) *BlueGreenReleaseJobCtl

func (*BlueGreenReleaseJobCtl) Clean

func (c *BlueGreenReleaseJobCtl) Clean(ctx context.Context)

func (*BlueGreenReleaseJobCtl) Run

type CanaryDeployJobCtl

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

func NewCanaryDeployJobCtl

func NewCanaryDeployJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, ack func(), logger *zap.SugaredLogger) *CanaryDeployJobCtl

func (*CanaryDeployJobCtl) Clean

func (c *CanaryDeployJobCtl) Clean(ctx context.Context)

func (*CanaryDeployJobCtl) Run

func (c *CanaryDeployJobCtl) Run(ctx context.Context)

type CanaryReleaseJobCtl

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

func NewCanaryReleaseJobCtl

func NewCanaryReleaseJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, ack func(), logger *zap.SugaredLogger) *CanaryReleaseJobCtl

func (*CanaryReleaseJobCtl) Clean

func (c *CanaryReleaseJobCtl) Clean(ctx context.Context)

func (*CanaryReleaseJobCtl) Run

func (c *CanaryReleaseJobCtl) Run(ctx context.Context)

type CustomDeployJobCtl

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

func NewCustomDeployJobCtl

func NewCustomDeployJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, ack func(), logger *zap.SugaredLogger) *CustomDeployJobCtl

func (*CustomDeployJobCtl) Clean

func (c *CustomDeployJobCtl) Clean(ctx context.Context)

func (*CustomDeployJobCtl) Run

func (c *CustomDeployJobCtl) Run(ctx context.Context)

type DeployJobCtl

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

func NewDeployJobCtl

func NewDeployJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, ack func(), logger *zap.SugaredLogger) *DeployJobCtl

func (*DeployJobCtl) Clean

func (c *DeployJobCtl) Clean(ctx context.Context)

func (*DeployJobCtl) Run

func (c *DeployJobCtl) Run(ctx context.Context)

type EnvVar

type EnvVar []string

type FreestyleJobCtl

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

func NewFreestyleJobCtl

func NewFreestyleJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, ack func(), logger *zap.SugaredLogger) *FreestyleJobCtl

func (*FreestyleJobCtl) Clean

func (c *FreestyleJobCtl) Clean(ctx context.Context)

func (*FreestyleJobCtl) Run

func (c *FreestyleJobCtl) Run(ctx context.Context)

type HelmDeployJobCtl

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

func NewHelmDeployJobCtl

func NewHelmDeployJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, ack func(), logger *zap.SugaredLogger) *HelmDeployJobCtl

func (*HelmDeployJobCtl) Clean

func (c *HelmDeployJobCtl) Clean(ctx context.Context)

func (*HelmDeployJobCtl) Run

func (c *HelmDeployJobCtl) Run(ctx context.Context)

type JobContext

type JobContext struct {
	Name string `yaml:"name"`
	// Workspace 容器工作目录 [必填]
	Workspace string `yaml:"workspace"`
	Proxy     *Proxy `yaml:"proxy"`
	// Envs 用户注入环境变量, 包括安装脚本环境变量 [optional]
	Envs EnvVar `yaml:"envs"`
	// SecretEnvs 用户注入敏感信息环境变量, value不能在stdout stderr中输出 [optional]
	SecretEnvs EnvVar `yaml:"secret_envs"`
	// WorkflowName
	WorkflowName string `yaml:"workflow_name"`
	// TaskID
	TaskID int64 `yaml:"task_id"`
	// Paths 执行脚本Path
	Paths string `yaml:"paths"`

	Steps   []*commonmodels.StepTask `yaml:"steps"`
	Outputs []string                 `yaml:"outputs"`
}

func BuildJobExcutorContext

func BuildJobExcutorContext(jobTaskSpec *commonmodels.JobTaskFreestyleSpec, job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, logger *zap.SugaredLogger) *JobContext

type JobCtl

type JobCtl interface {
	Run(ctx context.Context)
	// do some clean stuff when workflow finished, like collect reports or clean up resources.
	Clean(ctx context.Context)
}

type JobLabel

type JobLabel struct {
	JobName string
	JobType string
}

type PluginJobCtl

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

func NewPluginsJobCtl

func NewPluginsJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, ack func(), logger *zap.SugaredLogger) *PluginJobCtl

func (*PluginJobCtl) Clean

func (c *PluginJobCtl) Clean(ctx context.Context)

func (*PluginJobCtl) Run

func (c *PluginJobCtl) Run(ctx context.Context)

type Pool

type Pool struct {
	Jobs []*commonmodels.JobTask
	// contains filtered or unexported fields
}

Pool is a worker group that runs a number of tasks at a configured concurrency.

func NewPool

func NewPool(ctx context.Context, jobs []*commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTaskCtx, concurrency int, logger *zap.SugaredLogger, ack func()) *Pool

NewPool initializes a new pool with the given tasks and at the given concurrency.

func (*Pool) Run

func (p *Pool) Run()

Run runs all job within the pool and blocks until it's finished.

type Proxy

type Proxy struct {
	Type                   string `yaml:"type"`
	Address                string `yaml:"address"`
	Port                   int    `yaml:"port"`
	NeedPassword           bool   `yaml:"need_password"`
	Username               string `yaml:"username"`
	Password               string `yaml:"password"`
	EnableRepoProxy        bool   `yaml:"enable_repo_proxy"`
	EnableApplicationProxy bool   `yaml:"enable_application_proxy"`
}

Proxy 翻墙配置信息

Jump to

Keyboard shortcuts

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