config

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceNameRegexString = "^[a-zA-Z0-9-_]+$"
	ConfigNameRegexString  = "^[a-zA-Z0-9-]+$"
	ImageRegexString       = "^[a-zA-Z0-9.:\\/-]+$"
	CVMNameRegexString     = "^[a-zA-Z_]\\w*$"

	EnvRecyclePolicyAlways     = "always"
	EnvRecyclePolicyTaskStatus = "success"
	EnvRecyclePolicyNever      = "never"

	// 定时器的所属job类型
	WorkflowCronjob    = "workflow"
	WorkflowV4Cronjob  = "workflow_v4"
	TestingCronjob     = "test"
	EnvAnalysisCronjob = "env_analysis"
	EnvSleepCronjob    = "env_sleep"
)
View Source
const (
	ZadigIstioCopySuffix     = "zadig-copy"
	ZadigLastAppliedImage    = "last-applied-image"
	ZadigLastAppliedReplicas = "last-applied-replicas"
)
View Source
const (
	EnvTypeTest       = "test"
	EvnTypeProduction = "production"
)
View Source
const (
	HookEventPush    = HookEventType("push")
	HookEventPr      = HookEventType("pull_request")
	HookEventTag     = HookEventType("tag")
	HookEventUpdated = HookEventType("ref-updated")
)
View Source
const (
	Day       = 7
	LatestDay = 10
	Date      = "2006-01-02"
)
View Source
const (
	RegistryTypeSWR = "swr"
	RegistryTypeAWS = "ecr"
)
View Source
const (
	ImageResourceType = "image"
	TarResourceType   = "tar"
)
View Source
const (
	RoleBindingNameEdit = setting.ProductName + "-edit"
	RoleBindingNameView = setting.ProductName + "-view"
)
View Source
const (
	BlueGreenVersionLabelName = "zadig-blue-green-version"
	BlueServiceNameSuffix     = "-zadig-blue"
	OriginVersion             = "origin"
	BlueVersion               = "blue"
)

for custom blue-green release job

View Source
const (
	GrayLabelKey               = "zadig-gray-release"
	GrayLabelValue             = "released-by-zadig"
	GrayImageAnnotationKey     = "zadig-gray-release-image"
	GrayContainerAnnotationKey = "zadig-gray-release-container"
	GrayReplicaAnnotationKey   = "zadig-gray-release-replica"
	GrayDeploymentSuffix       = "-zadig-gray"
)

for custom gray release job

View Source
const (
	ProjectTypeHelm   = "helm"
	ProjectTypeYaml   = "yaml"
	ProjectTypeVM     = "vm"
	ProjectTypeLoaded = "loaded"
)
View Source
const (
	ParamTypeString = "string"
	ParamTypeBool   = "bool"
	ParamTypeChoice = "choice"
)
View Source
const (
	ParamSourceRuntime = "runtime"
	ParamSourceFixed   = "fixed"
	ParamSourceGlobal  = "global"
)
View Source
const (
	RegistryProviderACR           = "acr"
	RegistryProviderACREnterprise = "acr-enterprise"
	RegistryProviderSWR           = "swr"
	RegistryProviderTCR           = "tcr"
	RegistryProviderTCREnterprise = "tcr-enterprise"
	RegistryProviderHarbor        = "harbor"
	RegistryProviderDockerhub     = "dockerhub"
	RegistryProviderECR           = "ecr"
	RegistryProviderJFrog         = "jfrog"
	RegistryProviderNative        = "native"
)
View Source
const (
	ClusterProviderAmazonEKS     = 4
	ClusterProviderTKEServerless = 5
)
View Source
const (
	TestJobJunitReportStepName   = "junit-report-step"
	TestJobHTMLReportStepName    = "html-report-step"
	TestJobArchiveResultStepName = "archive-result-step"
	TestJobObjectStorageStepName = "object-storage-step"
)
View Source
const (
	SourceFromTemplate = "template"
	SourceFromYaml     = "yaml"
)

Service creation source for openAPI

View Source
const (
	DashboardDataTypeTestPassRate           = "test_pass_rate"
	DashboardDataTypeTestAverageDuration    = "test_average_duration"
	DashboardDataTypeBuildSuccessRate       = "build_success_rate"
	DashboardDataTypeBuildAverageDuration   = "build_average_duration"
	DashboardDataTypeBuildFrequency         = "build_frequency"
	DashboardDataTypeDeploySuccessRate      = "deploy_success_rate"
	DashboardDataTypeDeployAverageDuration  = "deploy_average_duration"
	DashboardDataTypeDeployFrequency        = "deploy_frequency"
	DashboardDataTypeReleaseSuccessRate     = "release_success_rate"
	DashboardDataTypeReleaseAverageDuration = "release_average_duration"
	DashboardDataTypeReleaseFrequency       = "release_frequency"

	DashboardDataSourceZadig = "zadig"
	DashboardDataSourceApi   = "api"

	DashboardDataCategoryQuality    = "quality"
	DashboardDataCategoryEfficiency = "efficiency"
	DashboardDataCategorySchedule   = "schedule"

	DashboardFunctionBuildAverageDuration = "5400/(x+540)"
	DashboardFunctionBuildSuccessRate     = "-2400/(x-120)-20"
	DashboardFunctionDeploySuccessRate    = "-2400/(x-120)-20"
	DashboardFunctionDeployFrequency      = "100-40000/(3*x+400)"
	DashboardFunctionTestPassRate         = "(x**2)/80-x/4+1.25"
	DashboardFunctionTestAverageDuration  = "90000/(x+900)"
	DashboardFunctionReleaseFrequency     = "100-200/(x+2)"
)

statistics dashboard id enum

View Source
const (
	CUSTOME_THEME = "custom"
)
View Source
const DefaultDeleteDeploymentTimeout = 10 * time.Minute
View Source
const (
	NameSpaceRegexString = "[^a-z0-9.-]"
)

Validation constants

View Source
const (
	S3StorageProviderAmazonS3 = 5
)
View Source
const (
	VMProviderAmazon = 4
)

Variables

View Source
var (
	// RenderTemplateAlias ...
	RenderTemplateAlias = regexp.MustCompile(`{{\s?\.\w+\s?}}`)
	ServiceNameAlias    = regexp.MustCompile(`\$Service\$`)
	ProductNameAlias    = regexp.MustCompile(`\$Product\$`)
	NameSpaceRegex      = regexp.MustCompile(NameSpaceRegexString)
)

ReleasePlanStatusMap is a map of status and its available next status

Functions

func CleanSkippedList

func CleanSkippedList() []string

CleanIgnoredList is a list which will be ignored during environment cleanup.

func CollieAPIAddress

func CollieAPIAddress() string

func CustomDNSNotSupported

func CustomDNSNotSupported() bool

func DefaultIngressClass

func DefaultIngressClass() string

func DefaultRecycleDay

func DefaultRecycleDay() int

环境默认回收天数,默认为0

func DindImage

func DindImage() string

func DockerHosts

func DockerHosts() []string

func EnableGitCheck

func EnableGitCheck() bool

func EnableTransaction

func EnableTransaction() bool

func ExecutorImage

func ExecutorImage() string

func Features

func Features() string

func GithubKnownHost

func GithubKnownHost() string

func GithubSSHKey

func GithubSSHKey() string

func Home

func Home() string

func HubAgentImage

func HubAgentImage() string

func HubServerAddress

func HubServerAddress() string

func JenkinsImage

func JenkinsImage() string

func KodespaceVersion

func KodespaceVersion() string

func KubeServerAddr

func KubeServerAddr() string

func LocalDeliveryChartPathWithRevision

func LocalDeliveryChartPathWithRevision(project, service string, revision int64) string

LocalDeliveryChartPathWithRevision returns the path of the normal service with the specific revision

func LocalProductionDeliveryChartPathWithRevision

func LocalProductionDeliveryChartPathWithRevision(project, service string, revision int64) string

func LocalProductionServicePath

func LocalProductionServicePath(project, service string) string

LocalProductionServicePath returns the path of the production service with the latest version

func LocalProductionServicePathWithRevision

func LocalProductionServicePathWithRevision(project, service string, version string) string

LocalProductionServicePathWithRevision returns the path of the normal service with the specific revision

func LocalServicePath

func LocalServicePath(project, service string, production bool) string

func LocalServicePathWithRevision

func LocalServicePathWithRevision(project, service string, version string, production bool) string

func LocalTestServicePath

func LocalTestServicePath(project, service string) string

LocalTestServicePath returns the path of the normal service with the latest version

func LocalTestServicePathWithRevision

func LocalTestServicePathWithRevision(project, service string, revision string) string

LocalTestServicePathWithRevision returns the path of the normal service with the specific revision

func LogLevel

func LogLevel() int

func MongoDatabase

func MongoDatabase() string

func MongoURI

func MongoURI() string

func Namespace

func Namespace() string

func ObjectStorageProductionServicePath

func ObjectStorageProductionServicePath(project, service string) string

func ObjectStorageServicePath

func ObjectStorageServicePath(project, service string, production bool) string

func ObjectStorageTestServicePath

func ObjectStorageTestServicePath(project, service string) string

func OldEnvSupported

func OldEnvSupported() bool

func PackagerImage

func PackagerImage() string

func PodName

func PodName() string

func PredatorImage

func PredatorImage() string

func ProxyHTTPAddr

func ProxyHTTPAddr() string

func ProxyHTTPSAddr

func ProxyHTTPSAddr() string

func ProxySocks5Addr

func ProxySocks5Addr() string

func ReaperBinaryFile

func ReaperBinaryFile() string

func ReaperImage

func ReaperImage() string

func RegistryAccessKey

func RegistryAccessKey() string

func RegistryAddress

func RegistryAddress() string

func RegistryNamespace

func RegistryNamespace() string

func RegistrySecretKey

func RegistrySecretKey() string

func S3StorageAK

func S3StorageAK() string

func S3StorageBucket

func S3StorageBucket() string

func S3StorageEndpoint

func S3StorageEndpoint() string

func S3StoragePath

func S3StoragePath() string

S3StoragePath returns a local path used to store downloaded code and other files

func S3StorageProtocol

func S3StorageProtocol() string

func S3StorageSK

func S3StorageSK() string

func ServiceAccountNameForUser

func ServiceAccountNameForUser(userID string) string

func ServiceNameWithRevision

func ServiceNameWithRevision(serviceName string, revision int64) string

func ServiceStartTimeout

func ServiceStartTimeout() int

服务默认等待启动时间,默认5分钟

func SetProxy

func SetProxy(HTTPSAddr, HTTPAddr, Socks5Addr string)

func UseClassicBuild

func UseClassicBuild() bool

func WebHookURL

func WebHookURL() string

Types

type ApprovalType

type ApprovalType string
const (
	NativeApproval   ApprovalType = "native"
	LarkApproval     ApprovalType = "lark"
	DingTalkApproval ApprovalType = "dingtalk"
)

type ApproveOrReject

type ApproveOrReject string
const (
	Approve ApproveOrReject = "approve"
	Reject  ApproveOrReject = "reject"
)

type ClusterProvider

type ClusterProvider int

type CommonEnvCfgType

type CommonEnvCfgType string
const (
	CommonEnvCfgTypeIngress   CommonEnvCfgType = "Ingress"
	CommonEnvCfgTypeConfigMap CommonEnvCfgType = "ConfigMap"
	CommonEnvCfgTypeSecret    CommonEnvCfgType = "Secret"
	CommonEnvCfgTypePvc       CommonEnvCfgType = "PVC"
)

type CustomWorkflowTaskType

type CustomWorkflowTaskType string
const (
	WorkflowTaskTypeWorkflow CustomWorkflowTaskType = "workflow"
	WorkflowTaskTypeTesting  CustomWorkflowTaskType = "test"
	WorkflowTaskTypeScanning CustomWorkflowTaskType = "scan"
	WorkflowTaskTypeDelivery CustomWorkflowTaskType = "delivery"
)

type DBInstanceType

type DBInstanceType string
const (
	DBInstanceTypeMySQL   DBInstanceType = "mysql"
	DBInstanceTypeMariaDB DBInstanceType = "mariadb"
)

type DeployContent

type DeployContent string
const (
	DeployImage  DeployContent = "image"
	DeployVars   DeployContent = "vars"
	DeployConfig DeployContent = "config"
)

type DeploySourceType

type DeploySourceType string
const (
	SourceRuntime DeploySourceType = "runtime"
	SourceFromJob DeploySourceType = "fromjob"
)

type DistributeType

type DistributeType string
const (
	File  DistributeType = "file"
	Image DistributeType = "image"
	Chart DistributeType = "chart"
)

type EnvType

type EnvType string

type HookEventType

type HookEventType string

type JiraAuthType

type JiraAuthType string
const (
	JiraBasicAuth           JiraAuthType = "password_or_token"
	JiraPersonalAccessToken JiraAuthType = "personal_access_token"
)

type JobRunPolicy

type JobRunPolicy string
const (
	DefaultRun    JobRunPolicy = ""                // default run this job
	DefaultNotRun JobRunPolicy = "default_not_run" // default not run this job
	ForceRun      JobRunPolicy = "force_run"       // force run this job
)

type JobType

type JobType string
const (
	JobBuild                JobType = "build"
	JobDeploy               JobType = "deploy"
	JobZadigBuild           JobType = "zadig-build"
	JobZadigDistributeImage JobType = "zadig-distribute-image"
	JobZadigTesting         JobType = "zadig-test"
	JobZadigScanning        JobType = "zadig-scanning"
	JobCustomDeploy         JobType = "custom-deploy"
	JobZadigDeploy          JobType = "zadig-deploy"
	JobZadigVMDeploy        JobType = "zadig-vm-deploy"
	JobZadigHelmDeploy      JobType = "zadig-helm-deploy"
	JobZadigHelmChartDeploy JobType = "zadig-helm-chart-deploy"
	JobFreestyle            JobType = "freestyle"
	JobPlugin               JobType = "plugin"
	JobK8sBlueGreenDeploy   JobType = "k8s-blue-green-deploy"
	JobK8sBlueGreenRelease  JobType = "k8s-blue-green-release"
	JobK8sCanaryDeploy      JobType = "k8s-canary-deploy"
	JobK8sCanaryRelease     JobType = "k8s-canary-release"
	JobK8sGrayRelease       JobType = "k8s-gray-release"
	JobK8sGrayRollback      JobType = "k8s-gray-rollback"
	JobK8sPatch             JobType = "k8s-resource-patch"
	JobIstioRelease         JobType = "istio-release"
	JobIstioRollback        JobType = "istio-rollback"
	JobUpdateEnvIstioConfig JobType = "update-env-istio-config"
	JobJira                 JobType = "jira"
	JobNacos                JobType = "nacos"
	JobApollo               JobType = "apollo"
	JobSQL                  JobType = "sql"
	JobJenkins              JobType = "jenkins"
	JobMeegoTransition      JobType = "meego-transition"
	JobWorkflowTrigger      JobType = "workflow-trigger"
	JobOfflineService       JobType = "offline-service"
	JobMseGrayRelease       JobType = "mse-gray-release"
	JobMseGrayOffline       JobType = "mse-gray-offline"
	JobGuanceyunCheck       JobType = "guanceyun-check"
	JobGrafana              JobType = "grafana"
)

type NotifyType

type NotifyType int
var (
	Announcement       NotifyType = 1 // 公告
	PipelineStatus     NotifyType = 2 // 提醒
	Message            NotifyType = 3 // 消息
	WorkflowTaskStatus NotifyType = 4 // 工作流任务状态
)

type ObservabilityType

type ObservabilityType string
const (
	ObservabilityTypeGrafana   ObservabilityType = "grafana"
	ObservabilityTypeGuanceyun ObservabilityType = "guanceyun"
)

type ParamSourceType

type ParamSourceType string

type ParamType

type ParamType string

type PipelineType

type PipelineType string

Type pipeline type

const (
	// SingleType 单服务工作流
	SingleType PipelineType = "single"
	// WorkflowType 多服务工作流
	WorkflowType PipelineType = "workflow"
	// FreestyleType 自由编排工作流
	FreestyleType PipelineType = "freestyle"
	// TestType 测试
	TestType PipelineType = "test"
	// ServiceType 服务
	ServiceType PipelineType = "service"
	// WorkflowTypeV3
	WorkflowTypeV3 PipelineType = "workflow_v3"
	// WorkflowTypeV4
	WorkflowTypeV4 PipelineType = "workflow_v4"
	// ArtifactPackageType package artifact
	ArtifactType PipelineType = "artifact"
	// ScanningType is the type for scanning
	ScanningType PipelineType = "scanning"
)

type ProjectType

type ProjectType string

type RegistryProvider

type RegistryProvider string

type ReleasePlanJobStatus

type ReleasePlanJobStatus string
const (
	ReleasePlanJobStatusTodo    ReleasePlanJobStatus = "todo"
	ReleasePlanJobStatusDone    ReleasePlanJobStatus = "done"
	ReleasePlanJobStatusSkipped ReleasePlanJobStatus = "skipped"
	ReleasePlanJobStatusFailed  ReleasePlanJobStatus = "failed"
	ReleasePlanJobStatusRunning ReleasePlanJobStatus = "running"
)

type ReleasePlanJobType

type ReleasePlanJobType string
const (
	JobText     ReleasePlanJobType = "text"
	JobWorkflow ReleasePlanJobType = "workflow"
)

type ReleasePlanStatus

type ReleasePlanStatus string
const (
	StatusPlanning       ReleasePlanStatus = "planning"
	StatusWaitForApprove ReleasePlanStatus = "waitforapprove"
	StatusExecuting      ReleasePlanStatus = "executing"
	StatusSuccess        ReleasePlanStatus = "success"
	StatusCancel         ReleasePlanStatus = "cancel"
)

type S3StorageProvider

type S3StorageProvider int

type ScheduleType

type ScheduleType string

ScheduleType 触发模式

const (
	// TimingSchedule 定时循环
	TimingSchedule ScheduleType = "timing"
	// GapSchedule 间隔循环
	GapSchedule ScheduleType = "gap"
)

type SlackNotifyType

type SlackNotifyType string
const (
	// SlackAll SlackNotifyType = "all"
	SlackOnChange  SlackNotifyType = "onchange"
	SlackOnfailure SlackNotifyType = "onfailure"
)

type StageType

type StageType string
const (
	StageCustom  StageType = "custom"
	StepApproval StageType = "approval"
)

type Status

type Status string
const (
	StatusDisabled       Status = "disabled"
	StatusCreated        Status = "created"
	StatusRunning        Status = "running"
	StatusPassed         Status = "passed"
	StatusSkipped        Status = "skipped"
	StatusFailed         Status = "failed"
	StatusTimeout        Status = "timeout"
	StatusCancelled      Status = "cancelled"
	StatusWaiting        Status = "waiting"
	StatusQueued         Status = "queued"
	StatusBlocked        Status = "blocked"
	QueueItemPending     Status = "pending"
	StatusChanged        Status = "changed"
	StatusNotRun         Status = "notRun"
	StatusPrepare        Status = "prepare"
	StatusReject         Status = "reject"
	StatusDistributed    Status = "distributed"
	StatusWaitingApprove Status = "waitforapprove"
	StatusDebugBefore    Status = "debug_before"
	StatusDebugAfter     Status = "debug_after"
)

func CompletedStatus

func CompletedStatus() []Status

func FailedStatus

func FailedStatus() []Status

func InCompletedStatus

func InCompletedStatus() []Status

func (Status) ToLower

func (s Status) ToLower() Status

type StepType

type StepType string
const (
	StepTools             StepType = "tools"
	StepShell             StepType = "shell"
	StepBatchFile         StepType = "batch_file"
	StepPowerShell        StepType = "powershell"
	StepGit               StepType = "git"
	StepDockerBuild       StepType = "docker_build"
	StepDeploy            StepType = "deploy"
	StepHelmDeploy        StepType = "helm_deploy"
	StepCustomDeploy      StepType = "custom_deploy"
	StepImageDistribute   StepType = "image_distribute"
	StepDownloadArchive   StepType = "download_archive"
	StepArchive           StepType = "archive"
	StepArchiveDistribute StepType = "archive_distribute"
	StepJunitReport       StepType = "junit_report"
	StepHtmlReport        StepType = "html_report"
	StepTarArchive        StepType = "tar_archive"
	StepSonarCheck        StepType = "sonar_check"
	StepDistributeImage   StepType = "distribute_image"
	StepDebugBefore       StepType = "debug_before"
	StepDebugAfter        StepType = "debug_after"
)

type TaskStatus

type TaskStatus string
const (
	TaskStatusRunning   TaskStatus = "running"
	TaskStatusCompleted TaskStatus = "completed"
	TaskStatusReady     TaskStatus = "ready"
	TaskStatusFailed    TaskStatus = "failed"
	TaskStatusTimeout   TaskStatus = "timeout"
	TaskStatusCancelled TaskStatus = "cancelled"
	TaskStatusPass      TaskStatus = "pass"
)

type TaskType

type TaskType string
const (
	TaskPipeline        TaskType = "pipeline"
	TaskBuild           TaskType = "buildv2"
	TaskBuildV3         TaskType = "buildv3"
	TaskJenkinsBuild    TaskType = "jenkins_build"
	TaskArtifact        TaskType = "artifact"
	TaskArtifactDeploy  TaskType = "artifact_deploy"
	TaskDeploy          TaskType = "deploy"
	TaskTestingV2       TaskType = "testingv2"
	TaskScanning        TaskType = "scanning"
	TaskDistributeToS3  TaskType = "distribute2kodo"
	TaskReleaseImage    TaskType = "release_image"
	TaskJira            TaskType = "jira"
	TaskDockerBuild     TaskType = "docker_build"
	TaskSecurity        TaskType = "security"
	TaskResetImage      TaskType = "reset_image"
	TaskDistribute      TaskType = "distribute"
	TaskTrigger         TaskType = "trigger"
	TaskExtension       TaskType = "extension"
	TaskArtifactPackage TaskType = "artifact_package"
)

type TestModuleType

type TestModuleType string
const (
	ProductTestType TestModuleType = ""
	ServiceTestType TestModuleType = "service_test"
)

type TriggerWorkflowSourceType

type TriggerWorkflowSourceType string
const (
	TriggerWorkflowSourceRuntime TriggerWorkflowSourceType = "runtime"
	TriggerWorkflowSourceFromJob TriggerWorkflowSourceType = "fromjob"
)

type VMProvider

type VMProvider int

type WorkflowTriggerType

type WorkflowTriggerType string
const (
	WorkflowTriggerTypeCommon WorkflowTriggerType = "common"
	WorkflowTriggerTypeFixed  WorkflowTriggerType = "fixed"
)

Jump to

Keyboard shortcuts

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