Skip to content

Commit

Permalink
Fully support .yaml (#1713)
Browse files Browse the repository at this point in the history
Follow-up to #1388
Closes #1073

---------

Co-authored-by: 6543 <[email protected]>
  • Loading branch information
qwerty287 and 6543 authored Apr 29, 2023
1 parent 2dd1b4f commit cfdb32a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cli/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...),
}
Expand All @@ -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("")
Expand Down
4 changes: 2 additions & 2 deletions cli/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions server/forge/configFetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -124,7 +124,7 @@ func TestFetch(t *testing.T) {
data: dummyData,
}},
expectedFileNames: []string{
".woodpecker.yml",
".woodpecker.yaml",
},
expectedError: false,
},
Expand Down
2 changes: 1 addition & 1 deletion shared/constant/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}

Expand Down
2 changes: 1 addition & 1 deletion web/src/assets/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
},
Expand Down

0 comments on commit cfdb32a

Please sign in to comment.