Documentation ¶
Overview ¶
Package stages defines the stages which are included in pipelines.
walter: a deployment pipeline template * Copyright (C) 2014 Recruit Technologies Co., Ltd. and contributors * (see CONTRIBUTORS.md) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. walter: a deployment pipeline template * Copyright (C) 2014 Recruit Technologies Co., Ltd. and contributors * (see CONTRIBUTORS.md) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. walter: a deployment pipeline template * Copyright (C) 2014 Recruit Technologies Co., Ltd. and contributors * (see CONTRIBUTORS.md) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. walter: a deployment pipeline template * Copyright (C) 2014 Recruit Technologies Co., Ltd. and contributors * (see CONTRIBUTORS.md) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- func PrepareCh(stage Stage)
- type BaseStage
- func (b *BaseStage) AddChildStage(stage Stage)
- func (b *BaseStage) GetChildStages() list.List
- func (b *BaseStage) GetErrResult() string
- func (b *BaseStage) GetInputCh() *chan Mediator
- func (b *BaseStage) GetOutResult() string
- func (b *BaseStage) GetOutputCh() *chan Mediator
- func (b *BaseStage) GetStageName() string
- func (b *BaseStage) GetStageOpts() StageOpts
- func (b *BaseStage) Run() bool
- func (b *BaseStage) SetErrResult(result string)
- func (b *BaseStage) SetInputCh(inputCh *chan Mediator)
- func (b *BaseStage) SetOutResult(result string)
- func (b *BaseStage) SetOutputCh(outputCh *chan Mediator)
- func (b *BaseStage) SetStageName(stageName string)
- func (b *BaseStage) SetStageOpts(stageOpts StageOpts)
- type CommandStage
- type Mediator
- type ResourceValidator
- type Runner
- type ShellScriptStage
- type Stage
- type StageOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseStage ¶
type BaseStage struct { // Run specified process. The required method (Run) is defined in the inheirted structs. Runner // Input channel. This channel stores the input of the statge. InputCh *chan Mediator // Output channel. This channel stores the output of the statge. OutputCh *chan Mediator // List of child stages. ChildStages list.List // Stage name. StageName string `config:"name"` // Results of stdout flush by the stage. OutResult string // Results of stderr flush by the stage. ErrResult string // options of the stage. Opts StageOpts }
BaseStage is an abstract struct implemented by the inherited struct that wishes to run somthing in a stage.
func (*BaseStage) AddChildStage ¶
AddChildStage appends one child stage.
func (*BaseStage) GetChildStages ¶
GetChildStages returns a list of child stages.
func (*BaseStage) GetErrResult ¶ added in v1.1.0
GetErrResult returns standard error results.
func (*BaseStage) GetInputCh ¶
GetInputCh retruns input channel.
func (*BaseStage) GetOutResult ¶ added in v1.1.0
GetOutResult returns standard output results.
func (*BaseStage) GetOutputCh ¶
GetOutputCh retruns output channel.
func (*BaseStage) GetStageOpts ¶ added in v1.1.0
GetStageOpts returns stage options.
func (*BaseStage) SetErrResult ¶ added in v1.1.0
SetErrResult sets standard error results.
func (*BaseStage) SetInputCh ¶
SetInputCh sets input channel.
func (*BaseStage) SetOutResult ¶ added in v1.1.0
SetOutResult sets standard output results.
func (*BaseStage) SetOutputCh ¶
SetOutputCh sets output channel.
func (*BaseStage) SetStageName ¶
SetStageName sets stage name.
func (*BaseStage) SetStageOpts ¶ added in v1.1.0
SetStageOpts sets stage options.
type CommandStage ¶
type CommandStage struct { BaseStage Command string `config:"command" is_replace:"false"` Directory string `config:"directory" is_replace:"true"` OnlyIf string `config:"only_if" is_replace:"false"` }
CommandStage executes more than one commands.
func (*CommandStage) AddCommand ¶
func (self *CommandStage) AddCommand(command string)
Register specified command.
func (*CommandStage) GetStdoutResult ¶
func (self *CommandStage) GetStdoutResult() string
Get standard output results.
func (*CommandStage) SetDirectory ¶
func (self *CommandStage) SetDirectory(directory string)
Set the directory where the command is executed.
type Mediator ¶
Mediator stores the intermidate results.
func (*Mediator) IsAnyFailure ¶ added in v0.2.0
IsAnyFailure returns true when mediator found any failures. Otherwise This method returns false.
type ResourceValidator ¶
type ResourceValidator struct {
// contains filtered or unexported fields
}
ResourceValidator class check if the resources to run the target staget are satisfied.
func NewResourceValidator ¶
func NewResourceValidator() *ResourceValidator
func (*ResourceValidator) AddCommandName ¶
func (self *ResourceValidator) AddCommandName(c string)
func (*ResourceValidator) AddFile ¶
func (self *ResourceValidator) AddFile(f string)
TODO add permission
func (*ResourceValidator) Validate ¶
func (self *ResourceValidator) Validate() bool
type Runner ¶
type Runner interface {
Run() bool
}
Runer contains the Run method which is deined in Stage implemantations.
type ShellScriptStage ¶
type ShellScriptStage struct { ResourceValidator CommandStage File string `config:"file"` }
ShellScriptStage executes one shell script file.
func NewShellScriptStage ¶
func NewShellScriptStage() *ShellScriptStage
Generate one ShellScriptStage object.
func (*ShellScriptStage) Run ¶
func (self *ShellScriptStage) Run() bool
Run exectues specified shell script.
type Stage ¶
type Stage interface { AddChildStage(Stage) GetChildStages() list.List GetStageName() string SetStageName(string) GetStageOpts() StageOpts SetStageOpts(StageOpts) GetInputCh() *chan Mediator SetInputCh(*chan Mediator) GetOutputCh() *chan Mediator SetOutputCh(*chan Mediator) GetOutResult() string SetOutResult(string) GetErrResult() string SetErrResult(string) }
Stage is a interface type which declares a list of methods every Stage object should define.