Add depends_on
This commit is contained in:
parent
80b4fa4e23
commit
06d9534619
11
README.md
11
README.md
|
@ -6,3 +6,14 @@
|
|||
Go library and utility to convert different pipelines to Woodpecker CI pipeline(s).
|
||||
|
||||
Currently supports converting only from Drone CI pipeline format with limited functionality.
|
||||
|
||||
## Drone pipeline supported features
|
||||
|
||||
* `kind` - must be `pipeline`
|
||||
* `type` - only `docker` supported
|
||||
* `name`
|
||||
* `steps`
|
||||
* `name`
|
||||
* `image`
|
||||
* `commands`
|
||||
* `depends_on`
|
||||
|
|
|
@ -31,8 +31,9 @@ func (d DronePipeline) Convert(pipeline *Pipeline) (*transform.Pipeline, error)
|
|||
}
|
||||
|
||||
p := &transform.Pipeline{
|
||||
Name: pipeline.Name,
|
||||
Steps: make(transform.Steps, 0, len(pipeline.Steps)),
|
||||
Name: pipeline.Name,
|
||||
Steps: make(transform.Steps, 0, len(pipeline.Steps)),
|
||||
DependsOn: pipeline.DependsOn,
|
||||
}
|
||||
|
||||
for _, step := range pipeline.Steps {
|
||||
|
|
|
@ -42,7 +42,7 @@ func TestTransformSimple(t *testing.T) {
|
|||
pipeline := getPipelineByName(pipelines, "build")
|
||||
require.NotNil(t, pipeline, "build pipeline not found")
|
||||
|
||||
assert.Len(t, pipeline.Steps, 2)
|
||||
require.Len(t, pipeline.Steps, 2)
|
||||
assert.Equal(t, "test", pipeline.Steps[0].Name)
|
||||
assert.Equal(t, "golang:1.18", pipeline.Steps[0].Image)
|
||||
assert.Len(t, pipeline.Steps[0].Commands, 1)
|
||||
|
@ -54,8 +54,10 @@ func TestTransformSimple(t *testing.T) {
|
|||
pipeline = getPipelineByName(pipelines, "deploy")
|
||||
require.NotNil(t, pipeline, "deploy pipeline not found")
|
||||
|
||||
assert.Len(t, pipeline.Steps, 1)
|
||||
require.Len(t, pipeline.Steps, 1)
|
||||
assert.Equal(t, "deploy", pipeline.Steps[0].Name)
|
||||
assert.Equal(t, "alpine:latest", pipeline.Steps[0].Image)
|
||||
assert.Len(t, pipeline.Steps[0].Commands, 1)
|
||||
require.Len(t, pipeline.DependsOn, 1)
|
||||
assert.Equal(t, "build", pipeline.DependsOn[0])
|
||||
}
|
||||
|
|
|
@ -11,8 +11,9 @@ type Step struct {
|
|||
}
|
||||
|
||||
type Pipeline struct {
|
||||
Kind string `yaml:"kind"`
|
||||
Type string `yaml:"type"`
|
||||
Name string `yaml:"name"`
|
||||
Steps []*Step `yaml:"steps"`
|
||||
Kind string `yaml:"kind"`
|
||||
Type string `yaml:"type"`
|
||||
Name string `yaml:"name"`
|
||||
Steps []*Step `yaml:"steps"`
|
||||
DependsOn []string `yaml:"depends_on"`
|
||||
}
|
||||
|
|
|
@ -40,4 +40,5 @@ type Pipeline struct {
|
|||
Name string `yaml:"-"`
|
||||
Workspace *Workspace `yaml:"workspace,omitempty"`
|
||||
Steps Steps `yaml:"pipeline"`
|
||||
DependsOn []string `yaml:"depends_on,omitempty"`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue