Documentation ¶
Index ¶
- Constants
- Variables
- func CommandsForShipping(p *Project, push bool) (commands []*exec.Cmd)
- func LoadEnv(envName string, feature string) map[string]string
- func ProcessDeployment(p *Project, env, deployConfig, serviceConfig string) error
- func RegisterBuilder(name string, builder *Builder)
- func RegisterWorkFlow(name string, flow *Workflow)
- func SetEnv(k string, v string)
- func WrapEnv(s string) string
- type AliyunLoginResponse
- type AliyunLoginResponseData
- type AliyunShippingProcessor
- type BranchFlow
- type BranchFlows
- type Builder
- type Builders
- type CIArtifact
- type CICache
- type CIConfig
- func (c CIConfig) AddJob(name string, job *CIJob) *CIConfig
- func (c CIConfig) AddJobWithDependencies(name string, job *CIJob, dependencies ...string) *CIConfig
- func (c CIConfig) WithCache(cache CICache) *CIConfig
- func (c CIConfig) WithCommon(job *CIJob) *CIConfig
- func (c CIConfig) WithStages(stages ...string) *CIConfig
- func (c *CIConfig) WriteToFile()
- type CIEnv
- type CIJob
- func (c CIJob) AllowFail() *CIJob
- func (c CIJob) WithArtifacts(artifact *CIArtifact) *CIJob
- func (c CIJob) WithDependencies(dependencies ...string) *CIJob
- func (c CIJob) WithEnv(name string) *CIJob
- func (c CIJob) WithExcept(except ...string) *CIJob
- func (c CIJob) WithImage(image string) *CIJob
- func (c CIJob) WithOnly(only ...string) *CIJob
- func (c CIJob) WithScript(script ...string) *CIJob
- func (c CIJob) WithTags(tags ...string) *CIJob
- func (c CIJob) WithVariable(key string, value string) CIJob
- func (c CIJob) WithWhen(when string) *CIJob
- type CIJobMap
- type FullImage
- type Job
- type Jobs
- type Project
- func (p *Project) Command(args ...string) *exec.Cmd
- func (p *Project) Execute(args ...string)
- func (p *Project) Run(commands ...*exec.Cmd)
- func (p *Project) RunScript(key string, inDocker bool) error
- func (p *Project) SetEnviron()
- func (p *Project) String() string
- func (p *Project) UnmarshalFromFile(filePath, fileName string) error
- func (p Project) WithDesc(desc string) Project
- func (p Project) WithFeature(f string) Project
- func (p Project) WithGroup(group string) Project
- func (p Project) WithLanguage(pl string) Project
- func (p Project) WithName(name string) Project
- func (p Project) WithOwner(owner string) Project
- func (p Project) WithScripts(key string, scripts ...string) Project
- func (p Project) WithVersion(s string) Project
- func (p Project) WithWorkflow(workflow string) Project
- func (p *Project) WriteToFile(filePath, fileName string)
- type Script
- type ShippingProcessor
- type ShippingProcessorType
- func (ShippingProcessorType) EnumType() string
- func (ShippingProcessorType) Enums() map[int][]string
- func (v ShippingProcessorType) Label() string
- func (v ShippingProcessorType) MarshalText() ([]byte, error)
- func (v ShippingProcessorType) String() string
- func (v *ShippingProcessorType) UnmarshalText(data []byte) (err error)
- type Version
- func (v Version) IncreaseMajor() Version
- func (v Version) IncreaseMinor() Version
- func (v Version) IncreasePatch() Version
- func (v Version) IsStable() bool
- func (v Version) MarshalYAML() (interface{}, error)
- func (v Version) String() string
- func (v *Version) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Workflow
- type Workflows
Constants ¶
View Source
const ( EnvKeyProjectName = "PROJECT_NAME" EnvKeyProjectVersion = "PROJECT_VERSION" EnvKeyProjectOwner = "PROJECT_OWNER" EnvKeyProjectGroup = "PROJECT_GROUP" EnvKeyProjectFeature = "PROJECT_FEATURE" EnvKeyProjectSelector = "PROJECT_SELECTOR" EnvKeyCICommitSHA = "DRONE_COMMIT_SHA" EnvKeyCIBranch = "DRONE_BRANCH" EnvKeyDeploymentUID = "DEPLOYMENT_UID" EnvKeyDockerRegistryKey = internal.DockerRegistry )
View Source
const ( STAGE_TEST = "test" STAGE_BUILD = "build" STAGE_SHIP = "ship" STAGE_DEPLOY = "deploy" )
Variables ¶
View Source
var ( DefaultConfigFile = "project.yml" DockerRegistry string )
View Source
var DefaultCICache = CICache{ Key: "${CI_BUILD_REF}_${CI_BUILD_REF_NAME}", UnTracked: true, }
View Source
var DockerfileYmlOrders = []string{
"build/dockerfile.default.yml",
"build/dockerfile.yml",
}
View Source
var InvalidShippingProcessorType = errors.New("invalid ShippingProcessorType")
View Source
var PresetWorkflows = Workflows{}
View Source
var RegisteredBuilders = Builders{}
View Source
var VersionRegexp = regexp.MustCompile("(\\d+)\\.(\\d+)\\.(\\d+)")
Functions ¶
func ProcessDeployment ¶
func RegisterBuilder ¶
func RegisterWorkFlow ¶
Types ¶
type AliyunLoginResponse ¶
type AliyunLoginResponse struct {
Data AliyunLoginResponseData `json:"data"`
}
type AliyunLoginResponseData ¶
type AliyunShippingProcessor ¶
type AliyunShippingProcessor struct{}
type BranchFlow ¶
type BranchFlow struct { Skip bool `yaml:"skip,omitempty"` Extends string `yaml:"extends,omitempty"` Env map[string]string `yaml:"env,omitempty"` Jobs Jobs `yaml:"jobs,inline,omitempty"` }
func (BranchFlow) Merge ¶
func (branchFlow BranchFlow) Merge(nextBranchFlow *BranchFlow) BranchFlow
func (*BranchFlow) UnmarshalYAML ¶
func (branchFlow *BranchFlow) UnmarshalYAML(unmarshal func(interface{}) error) error
type BranchFlows ¶
type BranchFlows map[string]BranchFlow
func (BranchFlows) Merge ¶
func (branchFlows BranchFlows) Merge(nextBranches BranchFlows) BranchFlows
type CIArtifact ¶
type CIConfig ¶
type CIConfig struct { Stages []string `yaml:"stages"` Cache CICache `yaml:"cache,omitempty"` CommonJob CIJob `yaml:"common_job,inline,omitempty"` CIJobMap `yaml:"jobs,inline"` }
func NewCIConfig ¶
func NewCIConfig() *CIConfig
func (CIConfig) AddJobWithDependencies ¶
func (CIConfig) WithCommon ¶
func (CIConfig) WithStages ¶
func (*CIConfig) WriteToFile ¶
func (c *CIConfig) WriteToFile()
type CIJob ¶
type CIJob struct { Stage string `yaml:"stage,omitempty"` Image string `yaml:"image,omitempty"` Tags []string `yaml:"tags,omitempty"` Services []string `yaml:"services,omitempty"` Dependencies []string `yaml:"dependencies,omitempty"` Variables map[string]string `yaml:"variables,omitempty"` Environment CIEnv `yaml:"environment,omitempty"` BeforeScript []string `yaml:"before_script,omitempty"` AfterScript []string `yaml:"after_script,omitempty"` Script []string `yaml:"script,omitempty"` AllowFailure bool `yaml:"allow_failure,omitempty"` Artifacts *CIArtifact `yaml:"artifacts,omitempty"` Only []string `yaml:"only,omitempty"` Except []string `yaml:"except,omitempty"` When string `yaml:"when,omitempty"` Coverage string `yaml:"coverage,omitempty"` }
func (CIJob) WithArtifacts ¶
func (c CIJob) WithArtifacts(artifact *CIArtifact) *CIJob
func (CIJob) WithDependencies ¶
func (CIJob) WithExcept ¶
func (CIJob) WithScript ¶
type Job ¶
type Job struct { Stage string `yaml:"stage,omitempty"` Skip bool `yaml:"skip,omitempty"` Builder string `yaml:"builder,omitempty"` Run Script `yaml:"run,omitempty"` Artifacts *CIArtifact `yaml:"artifacts,omitempty"` }
func (Job) MarshalYAML ¶
func (*Job) UnmarshalYAML ¶
type Project ¶
type Project struct { Name string `env:"name" yaml:"name"` Group string `env:"group" yaml:"group,omitempty"` Owner string `env:"owner" yaml:"owner,omitempty"` Version Version `env:"version" yaml:"version"` Desc string `env:"description" yaml:"description"` ProgramLanguage string `env:"program_language" yaml:"program_language"` Workflow Workflow `yaml:"workflow,omitempty"` Scripts map[string]Script `yaml:"scripts,omitempty"` Feature string `yaml:"feature,omitempty"` Selector string `env:"selector" yaml:"-"` }
func (*Project) SetEnviron ¶
func (p *Project) SetEnviron()
func (*Project) UnmarshalFromFile ¶
func (Project) WithFeature ¶
func (Project) WithLanguage ¶
func (Project) WithVersion ¶
func (Project) WithWorkflow ¶
func (*Project) WriteToFile ¶
type ShippingProcessor ¶
type ShippingProcessor interface { Login(p *Project) []*exec.Cmd Push(p *Project, image string) []*exec.Cmd }
func NewShippingProcessor ¶
func NewShippingProcessor(typ ShippingProcessorType) ShippingProcessor
type ShippingProcessorType ¶
type ShippingProcessorType uint8
api:enum
const ( SHIPPING_PROCESSOR_TYPE_UNKNOWN ShippingProcessorType = iota SHIPPING_PROCESSOR_TYPE__ALIYUN_REGISTRY // aliyun registry )
打包处理器类型
func ParseShippingProcessorTypeFromLabelString ¶
func ParseShippingProcessorTypeFromLabelString(s string) (ShippingProcessorType, error)
func ParseShippingProcessorTypeFromString ¶
func ParseShippingProcessorTypeFromString(s string) (ShippingProcessorType, error)
func (ShippingProcessorType) EnumType ¶
func (ShippingProcessorType) EnumType() string
func (ShippingProcessorType) Enums ¶
func (ShippingProcessorType) Enums() map[int][]string
func (ShippingProcessorType) Label ¶
func (v ShippingProcessorType) Label() string
func (ShippingProcessorType) MarshalText ¶
func (v ShippingProcessorType) MarshalText() ([]byte, error)
func (ShippingProcessorType) String ¶
func (v ShippingProcessorType) String() string
func (*ShippingProcessorType) UnmarshalText ¶
func (v *ShippingProcessorType) UnmarshalText(data []byte) (err error)
type Version ¶
func FromVersionString ¶
func (Version) IncreaseMajor ¶
func (Version) IncreaseMinor ¶
func (Version) IncreasePatch ¶
func (Version) MarshalYAML ¶
func (*Version) UnmarshalYAML ¶
type Workflow ¶
type Workflow struct { Extends string `yaml:"extends,omitempty"` BranchFlows BranchFlows `yaml:"branch_flows,inline"` }
func (Workflow) GetAvailableEnv ¶
func (*Workflow) ToCIConfig ¶
func (*Workflow) ToDroneConfig ¶
func (w *Workflow) ToDroneConfig(p *Project) *drone.CIDronePipelineDocker
func (Workflow) TryExtendsOrSetDefaults ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.