mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 00:46:30 +00:00
Remove deprecated options parsing (#2480)
Main change is that backwards compatibility to `platform` was removed. Part of https://github.com/woodpecker-ci/woodpecker/discussions/2170#discussioncomment-7047394
This commit is contained in:
parent
6d86ec7fe7
commit
842e8a8e50
3 changed files with 0 additions and 68 deletions
|
@ -15,12 +15,9 @@
|
|||
package yaml
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"codeberg.org/6543/xyaml"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/pipeline/frontend/yaml/types"
|
||||
"github.com/woodpecker-ci/woodpecker/pipeline/frontend/yaml/types/base"
|
||||
)
|
||||
|
||||
// ParseBytes parses the configuration from bytes b.
|
||||
|
@ -31,27 +28,6 @@ func ParseBytes(b []byte) (*types.Workflow, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// fail hard on deprecated branch filter
|
||||
if out.BranchesDontUseIt != nil {
|
||||
return nil, fmt.Errorf("\"branches:\" filter got removed, use \"branch\" in global when filter instead")
|
||||
}
|
||||
|
||||
// fail hard on deprecated pipeline keyword
|
||||
if len(out.PipelineDontUseIt.ContainerList) != 0 {
|
||||
return nil, fmt.Errorf("\"pipeline:\" got removed, use \"steps:\" instead")
|
||||
}
|
||||
|
||||
// support deprecated platform filter
|
||||
if out.PlatformDontUseIt != "" {
|
||||
if out.Labels == nil {
|
||||
out.Labels = make(base.SliceOrMap)
|
||||
}
|
||||
if _, set := out.Labels["platform"]; !set {
|
||||
out.Labels["platform"] = out.PlatformDontUseIt
|
||||
}
|
||||
out.PlatformDontUseIt = ""
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/pipeline/frontend/metadata"
|
||||
yaml_base_types "github.com/woodpecker-ci/woodpecker/pipeline/frontend/yaml/types/base"
|
||||
|
@ -138,42 +137,6 @@ func TestParse(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestParseLegacy(t *testing.T) {
|
||||
sampleYamlPipelineLegacy := `
|
||||
platform: linux/amd64
|
||||
|
||||
steps:
|
||||
say hello:
|
||||
image: bash
|
||||
commands: echo hello
|
||||
`
|
||||
|
||||
sampleYamlPipelineLegacyIgnore := `
|
||||
platform: windows/amd64
|
||||
labels:
|
||||
platform: linux/amd64
|
||||
|
||||
steps:
|
||||
say hello:
|
||||
image: bash
|
||||
commands: echo hello
|
||||
`
|
||||
|
||||
workflow1, err := ParseString(sampleYamlPipelineLegacy)
|
||||
if !assert.NoError(t, err) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
workflow2, err := ParseString(sampleYamlPipelineLegacyIgnore)
|
||||
if !assert.NoError(t, err) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
assert.EqualValues(t, workflow1, workflow2)
|
||||
assert.Len(t, workflow1.Steps.ContainerList, 1)
|
||||
assert.EqualValues(t, "say hello", workflow1.Steps.ContainerList[0].Name)
|
||||
}
|
||||
|
||||
var sampleYaml = `
|
||||
image: hello-world
|
||||
when:
|
||||
|
|
|
@ -36,13 +36,6 @@ type (
|
|||
Cache base.StringOrSlice `yaml:"cache,omitempty"`
|
||||
Networks WorkflowNetworks `yaml:"networks,omitempty"`
|
||||
Volumes WorkflowVolumes `yaml:"volumes,omitempty"`
|
||||
|
||||
// Deprecated
|
||||
PlatformDontUseIt string `yaml:"platform,omitempty"` // TODO: remove after v1.2.x version
|
||||
// Deprecated
|
||||
BranchesDontUseIt *constraint.List `yaml:"branches,omitempty"` // TODO: remove after v1.1.x version
|
||||
// Deprecated
|
||||
PipelineDontUseIt ContainerList `yaml:"pipeline,omitempty"` // TODO: remove after v1.1.x version
|
||||
}
|
||||
|
||||
// Workspace defines a pipeline workspace.
|
||||
|
|
Loading…
Reference in a new issue