Fully support .yaml (#1713)

Follow-up to https://github.com/woodpecker-ci/woodpecker/pull/1388
Closes https://github.com/woodpecker-ci/woodpecker/issues/1073

---------

Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
qwerty287 2023-04-29 10:12:36 +02:00 committed by GitHub
parent 2dd1b4f777
commit cfdb32ae45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions

View file

@ -45,7 +45,7 @@ import (
var Command = &cli.Command{
Name: "exec",
Usage: "execute a local pipeline",
ArgsUsage: "[path/to/.woodpecker.yml]",
ArgsUsage: "[path/to/.woodpecker.yaml]",
Action: run,
Flags: append(common.GlobalFlags, flags...),
}
@ -66,7 +66,7 @@ func execDir(c *cli.Context, dir string) error {
}
// check if it is a regular file (not dir)
if info.Mode().IsRegular() && strings.HasSuffix(info.Name(), ".yml") {
if info.Mode().IsRegular() && (strings.HasSuffix(info.Name(), ".yaml") || strings.HasSuffix(info.Name(), ".yml")) {
fmt.Println("#", info.Name())
_ = runExec(c, path, repoPath) // TODO: should we drop errors or store them and report back?
fmt.Println("")

View file

@ -16,7 +16,7 @@ import (
var Command = &cli.Command{
Name: "lint",
Usage: "lint a pipeline configuration file",
ArgsUsage: "[path/to/.woodpecker.yml]",
ArgsUsage: "[path/to/.woodpecker.yaml]",
Action: lint,
Flags: common.GlobalFlags,
}
@ -33,7 +33,7 @@ func lintDir(c *cli.Context, dir string) error {
}
// check if it is a regular file (not dir)
if info.Mode().IsRegular() && strings.HasSuffix(info.Name(), ".yml") {
if info.Mode().IsRegular() && (strings.HasSuffix(info.Name(), ".yaml") || strings.HasSuffix(info.Name(), ".yml")) {
fmt.Println("#", info.Name())
if err := lintFile(c, path); err != nil {
errorStrings = append(errorStrings, err.Error())

View file

@ -114,7 +114,7 @@ func TestFetch(t *testing.T) {
expectedError: false,
},
{
name: "Default config check .woodpecker.yml before .woodpecker.yaml",
name: "Default config check .woodpecker.yaml before .woodpecker.yml",
repoConfig: "",
files: []file{{
name: ".woodpecker.yaml",
@ -124,7 +124,7 @@ func TestFetch(t *testing.T) {
data: dummyData,
}},
expectedFileNames: []string{
".woodpecker.yml",
".woodpecker.yaml",
},
expectedError: false,
},

View file

@ -26,8 +26,8 @@ var PrivilegedPlugins = []string{
// folders are indicated by supplying a trailing /
var DefaultConfigOrder = [...]string{
".woodpecker/",
".woodpecker.yml",
".woodpecker.yaml",
".woodpecker.yml",
".drone.yml",
}

View file

@ -81,7 +81,7 @@
"success": "Repository settings updated",
"pipeline_path": {
"path": "Pipeline path",
"default": "By default: .woodpecker/*.yml -> .woodpecker.yml -> .drone.yml",
"default": "By default: .woodpecker/*.{'{yaml,yml}'} -> .woodpecker.yaml -> .woodpecker.yml -> .drone.yml",
"desc": "Path to your pipeline config (for example {0}). Folders should end with a {1}.",
"desc_path_example": "my/path/"
},