Documentation
¶
Index ¶
- Constants
- Variables
- func DownloadTemplate(manifestURL string, tBuf io.Writer) error
- func Marshal(i interface{}, f Format) ([]byte, error)
- func OpenFile(filename string) (io.ReadCloser, error)
- func OpenURL(u string) (io.ReadCloser, error)
- func ParseWorkflow(ctx context.Context, exportWorkflow Workflow) (*sdk.Workflow, error)
- func ReadTemplateFromTar(tr *tar.Reader) (sdk.WorkflowTemplate, error)
- func TarWorkflowComponents(ctx context.Context, w WorkflowComponents, writer io.Writer) error
- func Unmarshal(btes []byte, f Format, i interface{}) error
- func UnmarshalStrict(btes []byte, f Format, i interface{}) error
- type Action
- type ActionVersion
- type Application
- type ApplicationVersion
- type EncryptedKey
- type Environment
- type Format
- type GRPCPlugin
- type Job
- type KeyValue
- type Options
- type ParameterValue
- type PipelineV1
- type PipelineVersion
- type Pipeliner
- type Requirement
- type ServiceRequirement
- type Stage
- type Step
- type StepArtifactDownload
- type StepArtifactUpload
- type StepAscodeAction
- type StepCheckout
- type StepCoverage
- type StepCustom
- type StepDeploy
- type StepGitClone
- type StepGitTag
- type StepInstallKey
- type StepJUnitReport
- type StepParameters
- type StepPromote
- type StepPushBuildInfo
- type StepRelease
- type StepReleaseVCS
- type Template
- type TemplateInstance
- type TemplateParameter
- type VariableValue
- type WorkerModel
- type WorkerModelOption
- type Workflow
- type WorkflowComponents
- type WorkflowComponentsRaw
- type WorkflowPulled
- type WorkflowPulledItem
- type WorkflowVersion
Constants ¶
const ( TemplateWorkflowName = "workflow.yml" TemplatePipelineName = "%d.pipeline.yml" TemplateApplicationName = "%d.application.yml" TemplateEnvironmentName = "%d.environment.yml" )
Name pattern for template files.
const ( PullWorkflowName = "%s.yml" PullPipelineName = "%s.pip.yml" PullApplicationName = "%s.app.yml" PullEnvironmentName = "%s.env.yml" )
Name pattern for pull files.
const ( WorkflowVersion1 = "v1.0" WorkflowVersion2 = "v2.0" )
const (
ActionVersion1 = "v1.0"
)
There are the supported versions
const (
ApplicationVersion1 = "v1.0"
)
There are the supported versions
const (
PipelineVersion1 = "v1.0"
)
There are the supported versions
Variables ¶
var WorkerModelLoadOptions = struct { HideAdminFields WorkerModelOption }{ HideAdminFields: loadWorkerModelWithoutAdminFields, }
Functions ¶
func DownloadTemplate ¶
DownloadTemplate returns a new tar.
func ParseWorkflow ¶
func ReadTemplateFromTar ¶
func ReadTemplateFromTar(tr *tar.Reader) (sdk.WorkflowTemplate, error)
ReadFromTar returns a workflow template from given tar reader.
func TarWorkflowComponents ¶
TarWorkflowComponents returns a tar containing all files for a workflow.
func UnmarshalStrict ¶
UnmarshalStrict supports JSON, YAML
Types ¶
type Action ¶
type Action struct {
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Group string `json:"group,omitempty" yaml:"group,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
Parameters map[string]ParameterValue `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Requirements []Requirement `json:"requirements,omitempty" yaml:"requirements,omitempty"`
Steps []Step `json:"steps,omitempty" yaml:"steps,omitempty"`
}
Action represents exported sdk.Action
type Application ¶
type Application struct {
Version string `json:"version,omitempty" yaml:"version,omitempty" jsonschema_description:"Version for the yaml syntax, latest is v1.0."`
Name string `json:"name" yaml:"name" jsonschema_description:"The name of the application."`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
VCSServer string `` /* 157-byte string literal not displayed */
RepositoryName string `` /* 129-byte string literal not displayed */
Variables map[string]VariableValue `json:"variables,omitempty" yaml:"variables,omitempty"`
Keys map[string]KeyValue `json:"keys,omitempty" yaml:"keys,omitempty"`
VCSConnectionType string `` /* 142-byte string literal not displayed */
VCSSSHKey string `` /* 148-byte string literal not displayed */
VCSUser string `json:"vcs_user,omitempty" yaml:"vcs_user,omitempty"`
VCSPassword string `json:"vcs_password,omitempty" yaml:"vcs_password,omitempty"`
VCSPGPKey string `` /* 157-byte string literal not displayed */
DeploymentStrategies map[string]map[string]VariableValue `json:"deployments,omitempty" yaml:"deployments,omitempty"`
}
Application represents exported sdk.Application
func NewApplication ¶
func NewApplication(app sdk.Application, keys []EncryptedKey) (a Application, err error)
NewApplication instanciance an exportable application from an sdk.Application
type EncryptedKey ¶
EncryptedKey represents an encrypted secret
type Environment ¶
type Environment struct {
Name string `json:"name" yaml:"name" jsonschema_description:"The name of the environment."`
Values map[string]VariableValue `json:"values,omitempty" yaml:"values,omitempty"`
Keys map[string]KeyValue `json:"keys,omitempty" yaml:"keys,omitempty"`
}
Environment is a struct to export sdk.Environment
func NewEnvironment ¶
func NewEnvironment(e sdk.Environment, keys []EncryptedKey) Environment
NewEnvironment returns an Environment from an sdk.Environment pointer
func (*Environment) Environment ¶
func (e *Environment) Environment() (env *sdk.Environment)
Environment returns a sdk.Environment entity
type Format ¶
type Format int
Format is a type
func GetFormatFromContentType ¶
GetFormatFromContentType return a format.
func GetFormatFromPath ¶
GetFormatFromPath return a format.
func OpenPath ¶
func OpenPath(path string) (io.ReadCloser, Format, error)
OpenPath opens an URL or a file
func (Format) ContentType ¶
type GRPCPlugin ¶
type GRPCPlugin struct {
Name string `json:"name" yaml:"name" cli:"name,key"`
Type string `json:"type" yaml:"type" cli:"type"`
Integration string `json:"integration" yaml:"integration" cli:"integration"`
Author string `json:"author" yaml:"author" cli:"author"`
Description string `json:"description" yaml:"description" cli:"description"`
Inputs map[string]sdk.PluginInput `json:"inputs,omitempty" yaml:"inputs,omitempty"`
Post sdk.PluginPost `json:"post" yaml:"post"`
}
GRPCPlugin represents exported sdk.GRPCPlugin
func NewGRPCPlugin ¶
func NewGRPCPlugin(p sdk.GRPCPlugin) (plg GRPCPlugin)
NewGRPCPlugin returns a ready to export action
func (*GRPCPlugin) GRPCPlugin ¶
func (plg *GRPCPlugin) GRPCPlugin() *sdk.GRPCPlugin
GRPCPlugin returns an sdk.GRPCPlugin
type Job ¶
type Job struct {
Name string `json:"job,omitempty" yaml:"job,omitempty" jsonschema_description:"The name of the job."`
Stage string `json:"stage,omitempty" yaml:"stage,omitempty" jsonschema_description:"The name of the stage for the job."`
Description string `json:"description,omitempty" yaml:"description,omitempty" jsonschema_description:"The description of the job."`
Enabled *bool `` /* 143-byte string literal not displayed */
Steps []Step `json:"steps,omitempty" yaml:"steps,omitempty" jsonschema_description:"The list of steps for the job."`
Requirements []Requirement `json:"requirements,omitempty" yaml:"requirements,omitempty" jsonschema_description:"The list of requirements for the jobs."`
Optional *bool `json:"optional,omitempty" yaml:"optional,omitempty" jsonschema_description:"Set this option to ignore job's errors."`
AlwaysExecuted *bool `` /* 157-byte string literal not displayed */
}
Job represents exported sdk.Job
type KeyValue ¶
type KeyValue struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Value string `json:"value,omitempty" yaml:"value,omitempty"`
Regen *bool `json:"regen,omitempty" yaml:"regen,omitempty"`
}
KeyValue is a struct to export a value of Key
type ParameterValue ¶
type ParameterValue struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"`
DefaultValue string `json:"default,omitempty" yaml:"default,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Advanced *bool `json:"advanced,omitempty" yaml:"advanced,omitempty"`
}
ParameterValue is a struct to export a defautl value of Parameter
type PipelineV1 ¶
type PipelineV1 struct {
Version string `json:"version,omitempty" yaml:"version,omitempty" jsonschema_description:"The version for the current pipeline file (v1.0)."`
Name string `json:"name,omitempty" yaml:"name,omitempty" jsonschema_description:"The name of the pipeline."`
Description string `json:"description,omitempty" yaml:"description,omitempty" jsonschema_description:"The description of the pipeline."`
Parameters map[string]ParameterValue `json:"parameters,omitempty" yaml:"parameters,omitempty" jsonschema_description:"The list of parameters of the pipeline."`
Stages []string `json:"stages,omitempty" yaml:"stages,omitempty" jsonschema_description:"The list of stage's names for the pipeline."`
StageOptions map[string]Stage `json:"options,omitempty" yaml:"options,omitempty" jsonschema_description:"The options for stages of the pipeline."` //Here Stage.Jobs will NEVER be set
Jobs []Job `json:"jobs,omitempty" yaml:"jobs,omitempty" jsonschema_description:"The list of jobs for the pipeline."`
}
PipelineV1 represents exported sdk.Pipeline
func NewPipelineV1 ¶
func NewPipelineV1(pip sdk.Pipeline) (p PipelineV1)
NewPipelineV1 creates an exportable pipeline from a sdk.Pipeline
type Requirement ¶
type Requirement struct {
Binary string `json:"binary,omitempty" yaml:"binary,omitempty"`
Model string `json:"model,omitempty" yaml:"model,omitempty"`
Modelv2 string `json:"modelv2,omitempty" yaml:"modelv2,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
Plugin string `json:"plugin,omitempty" yaml:"plugin,omitempty"`
Service ServiceRequirement `json:"service,omitempty" yaml:"service,omitempty"`
Memory string `json:"memory,omitempty" yaml:"memory,omitempty"`
OSArchRequirement string `json:"os-architecture,omitempty" yaml:"os-architecture,omitempty"`
RegionRequirement string `json:"region,omitempty" yaml:"region,omitempty"`
SecretRequirement string `json:"secret,omitempty" yaml:"secret,omitempty"`
FlavorRequirement string `json:"flavor,omitempty" yaml:"flavor,omitempty"`
}
Requirement represents an exported sdk.Requirement
func NewRequirements ¶
func NewRequirements(req []sdk.Requirement) []Requirement
type ServiceRequirement ¶
type ServiceRequirement struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Value string `json:"value,omitempty" yaml:"value,omitempty"`
}
ServiceRequirement represents an exported sdk.Requirement of type ServiceRequirement
type Stage ¶
type Stage struct {
Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
Jobs map[string]Job `json:"jobs,omitempty" yaml:"jobs,omitempty"`
Conditions *sdk.WorkflowNodeConditions `json:"conditions,omitempty" yaml:"conditions,omitempty"`
}
Stage represents exported sdk.Stage
type Step ¶
type Step struct {
// common step data
Name string `json:"name,omitempty" yaml:"name,omitempty" jsonschema_description:"The name for this step."`
Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
Optional *bool `json:"optional,omitempty" yaml:"optional,omitempty"`
AlwaysExecuted *bool `json:"always_executed,omitempty" yaml:"always_executed,omitempty"`
// step specific data, only one option should be set
StepCustom `json:"-" yaml:",inline"`
Script interface{} `` /* 200-byte string literal not displayed */
PushBuildInfo *StepPushBuildInfo `` /* 215-byte string literal not displayed */
Coverage *StepCoverage `` /* 199-byte string literal not displayed */
ArtifactDownload *StepArtifactDownload `` /* 242-byte string literal not displayed */
ArtifactUpload *StepArtifactUpload `` /* 234-byte string literal not displayed */
GitClone *StepGitClone `` /* 200-byte string literal not displayed */
GitTag *StepGitTag `` /* 186-byte string literal not displayed */
ReleaseVCS *StepReleaseVCS `` /* 208-byte string literal not displayed */
Release *StepRelease `` /* 196-byte string literal not displayed */
Promote *StepPromote `` /* 191-byte string literal not displayed */
JUnitReport *StepJUnitReport `` /* 196-byte string literal not displayed */
Checkout *StepCheckout `` /* 227-byte string literal not displayed */
InstallKey *StepInstallKey `` /* 236-byte string literal not displayed */
Deploy *StepDeploy `` /* 202-byte string literal not displayed */
AsCodeAction *StepAscodeAction `` /* 139-byte string literal not displayed */
}
Step represents exported step used in a job.
func (Step) MarshalJSON ¶
MarshalJSON custom marshal json impl to inline custom step.
func (*Step) UnmarshalJSON ¶
UnmarshalJSON custom unmarshal json impl to get custom step data.
type StepArtifactDownload ¶
type StepArtifactDownload struct {
Path string `json:"path,omitempty" yaml:"path,omitempty" jsonschema:"required"`
Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"`
Tag string `json:"tag,omitempty" yaml:"tag,omitempty" jsonschema:"required"`
}
StepArtifactDownload represents exported artifact download step.
type StepArtifactUpload ¶
type StepArtifactUpload struct {
Destination string `json:"destination,omitempty" yaml:"destination,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty" jsonschema:"required"`
Tag string `json:"tag,omitempty" yaml:"tag,omitempty" jsonschema:"required"`
}
StepArtifactUpload represents exported artifact upload step.
type StepAscodeAction ¶ added in v0.53.0
type StepCoverage ¶
type StepCoverage struct {
Path string `json:"path,omitempty" yaml:"path,omitempty"`
}
StepCoverage represents exported coverage step.
type StepCustom ¶
type StepCustom map[string]StepParameters
StepCustom represents exported custom step.
type StepGitClone ¶
type StepGitClone struct {
Branch string `json:"branch,omitempty" yaml:"branch,omitempty"`
Commit string `json:"commit,omitempty" yaml:"commit,omitempty"`
Depth string `json:"depth,omitempty" yaml:"depth,omitempty"`
Directory string `json:"directory,omitempty" yaml:"directory,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
PrivateKey string `json:"privateKey,omitempty" yaml:"privateKey,omitempty"`
SubModules string `json:"submodules,omitempty" yaml:"submodules,omitempty"`
Tag *string `json:"tag,omitempty" yaml:"tag,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty" jsonschema:"required"`
User string `json:"user,omitempty" yaml:"user,omitempty"`
}
StepGitClone represents exported git clone step.
type StepGitTag ¶
type StepGitTag struct {
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty"`
TagLevel string `json:"tagLevel,omitempty" yaml:"tagLevel,omitempty" jsonschema:"required"`
TagMessage string `json:"tagMessage,omitempty" yaml:"tagMessage,omitempty"`
TagMetadata string `json:"tagMetadata,omitempty" yaml:"tagMetadata,omitempty"`
TagPrerelease string `json:"tagPrerelease,omitempty" yaml:"tagPrerelease,omitempty"`
}
StepGitTag represents exported git tag step.
type StepInstallKey ¶
type StepInstallKey interface{}
StepInstallKey represents exported installKey step.
type StepJUnitReport ¶
type StepJUnitReport string
StepJUnitReport represents exported junit report step.
type StepParameters ¶
StepParameters represents exported custom step parameters.
type StepPromote ¶
type StepPromote struct {
Artifacts string `json:"artifacts,omitempty" yaml:"artifacts,omitempty"`
SrcMaturity string `json:"srcMaturity,omitempty" yaml:"srcMaturity,omitempty"`
DestMaturity string `json:"destMaturity,omitempty" yaml:"destMaturity,omitempty"`
SetProperties string `json:"setProperties,omitempty" yaml:"setProperties,omitempty"`
}
StepPromote represents exported promote step.
type StepPushBuildInfo ¶
type StepPushBuildInfo string
type StepRelease ¶
type StepRelease struct {
Artifacts string `json:"artifacts,omitempty" yaml:"artifacts,omitempty"`
ReleaseNote string `json:"releaseNote,omitempty" yaml:"releaseNote,omitempty"`
SrcMaturity string `json:"srcMaturity,omitempty" yaml:"srcMaturity,omitempty"`
DestMaturity string `json:"destMaturity,omitempty" yaml:"destMaturity,omitempty"`
SetProperties string `json:"setProperties,omitempty" yaml:"setProperties,omitempty"`
}
StepRelease represents exported release step.
type StepReleaseVCS ¶
type StepReleaseVCS struct {
Artifacts string `json:"artifacts,omitempty" yaml:"artifacts,omitempty"`
ReleaseNote string `json:"releaseNote,omitempty" yaml:"releaseNote,omitempty"`
Tag string `json:"tag,omitempty" yaml:"tag,omitempty" jsonschema:"required"`
Title string `json:"title,omitempty" yaml:"title,omitempty" jsonschema:"required"`
}
StepReleaseVCS represents exported release step.
type Template ¶
type Template struct {
Slug string `json:"slug" yaml:"slug"`
Name string `json:"name" yaml:"name"`
Group string `json:"group" yaml:"group"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Parameters []TemplateParameter `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Workflow string
Pipelines []string
Applications []string
Environments []string
}
Template is the "as code" representation of a sdk.WorkflowTemplate.
func NewTemplate ¶
func NewTemplate(wt sdk.WorkflowTemplate) (Template, error)
NewTemplate creates a new exportable workflow template.
func (Template) GetTemplate ¶
func (w Template) GetTemplate(wkf []byte, pips, apps, envs [][]byte) sdk.WorkflowTemplate
GetTemplate returns a sdk.WorkflowTemplate.
type TemplateInstance ¶
type TemplateInstance struct {
Name string `json:"name,omitempty" yaml:"name,omitempty" jsonschema_description:"Name of the generated the workflow."`
From string `` /* 149-byte string literal not displayed */
Parameters map[string]string `json:"parameters,omitempty" yaml:"parameters,omitempty" jsonschema_description:"Optional template parameters."`
}
type TemplateParameter ¶
type TemplateParameter struct {
Key string `json:"key" yaml:"key"`
Type string `json:"type" yaml:"type"`
Required bool `json:"required" yaml:"required"`
}
TemplateParameter is the "as code" representation of a sdk.TemplateParameter.
type VariableValue ¶
type VariableValue struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Value string `json:"value,omitempty" yaml:"value,omitempty"`
}
VariableValue is a struct to export a value of Variable
type WorkerModel ¶
type WorkerModel struct {
Name string `json:"name" yaml:"name"`
Group string `json:"group" yaml:"group"`
Image string `json:"image" yaml:"image"`
Registry string `json:"registry,omitempty" yaml:"registry,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Description string `json:"description" yaml:"description"`
Type string `json:"type" yaml:"type"`
Flavor string `json:"flavor,omitempty" yaml:"flavor,omitempty"`
Envs map[string]string `json:"envs,omitempty" yaml:"envs,omitempty"`
PatternName string `json:"pattern_name,omitempty" yaml:"pattern_name,omitempty"`
Shell string `json:"shell,omitempty" yaml:"shell,omitempty"`
PreCmd string `json:"pre_cmd,omitempty" yaml:"pre_cmd,omitempty"`
Cmd string `json:"cmd,omitempty" yaml:"cmd,omitempty"`
PostCmd string `json:"post_cmd,omitempty" yaml:"post_cmd,omitempty"`
Restricted bool `json:"restricted,omitempty" yaml:"restricted,omitempty"`
IsDeprecated bool `json:"is_deprecated,omitempty" yaml:"is_deprecated,omitempty"`
}
WorkerModel is the as code format of a worker model
func NewWorkerModel ¶
func NewWorkerModel(wm sdk.Model, opts ...WorkerModelOption) WorkerModel
NewWorkerModel creates an exportentities WorkerModel from a struct sdk.Model
func (WorkerModel) GetWorkerModel ¶
func (wm WorkerModel) GetWorkerModel() sdk.Model
GetWorkerModel convert an exportentities to a real sdk.Model
type WorkerModelOption ¶
type WorkerModelOption func(sdk.Model, *WorkerModel) error
type WorkflowComponents ¶
type WorkflowComponents struct {
Template TemplateInstance
Workflow Workflow
Applications []Application
Pipelines []PipelineV1
Environments []Environment
}
func UntarWorkflowComponents ¶
func (WorkflowComponents) ToRaw ¶
func (w WorkflowComponents) ToRaw() (WorkflowComponentsRaw, error)
type WorkflowComponentsRaw ¶
type WorkflowPulled ¶
type WorkflowPulled struct {
Workflow WorkflowPulledItem `json:"workflow"`
Pipelines []WorkflowPulledItem `json:"pipelines"`
Applications []WorkflowPulledItem `json:"applications"`
Environments []WorkflowPulledItem `json:"environments"`
}
WorkflowPulled contains all the yaml base64 that are needed to generate a workflow tar file.
type WorkflowPulledItem ¶
WorkflowPulledItem contains data for a workflow item.
type WorkflowVersion ¶
type WorkflowVersion struct {
Version string `yaml:"version"`
}