mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-24 10:07:21 +02:00
refact yaml operations to yaml package
This commit is contained in:
parent
62ccf1bd60
commit
fd63d6e03d
0
.github/pull_request_template.md
vendored
Normal file
0
.github/pull_request_template.md
vendored
Normal file
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
drone
|
||||
drone/drone
|
||||
drone_*
|
||||
*.sqlite
|
||||
*_gen.go
|
||||
|
10
web/hook.go
10
web/hook.go
@ -11,13 +11,13 @@ import (
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/drone/drone/engine"
|
||||
"github.com/drone/drone/engine/parser"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/queue"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/drone/drone/shared/token"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/drone/drone/queue"
|
||||
"github.com/drone/drone/yaml"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -148,13 +148,13 @@ func PostHook(c *gin.Context) {
|
||||
// NOTE we don't exit on failure. The sec file is optional
|
||||
}
|
||||
|
||||
axes, err := parser.ParseMatrix(raw)
|
||||
axes, err := yaml.ParseMatrix(raw)
|
||||
if err != nil {
|
||||
c.String(500, "Failed to parse yaml file or calculate matrix. %s", err)
|
||||
return
|
||||
}
|
||||
if len(axes) == 0 {
|
||||
axes = append(axes, parser.Axis{})
|
||||
axes = append(axes, yaml.Axis{})
|
||||
}
|
||||
|
||||
netrc, err := remote_.Netrc(user, repo)
|
||||
@ -166,7 +166,7 @@ func PostHook(c *gin.Context) {
|
||||
key, _ := store.GetKey(c, repo)
|
||||
|
||||
// verify the branches can be built vs skipped
|
||||
branches := parser.ParseBranch(raw)
|
||||
branches := yaml.ParseBranch(raw)
|
||||
if !branches.Matches(build.Branch) {
|
||||
c.String(200, "Branch does not match restrictions defined in yaml")
|
||||
return
|
||||
|
@ -1,4 +1,4 @@
|
||||
package parser
|
||||
package yaml
|
||||
|
||||
import (
|
||||
"path/filepath"
|
@ -1,4 +1,4 @@
|
||||
package parser
|
||||
package yaml
|
||||
|
||||
import (
|
||||
"testing"
|
@ -1,4 +1,4 @@
|
||||
package shasum
|
||||
package checksum
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
@ -1,4 +1,4 @@
|
||||
package shasum
|
||||
package checksum
|
||||
|
||||
import (
|
||||
"testing"
|
@ -1,4 +1,4 @@
|
||||
package parser
|
||||
package yaml
|
||||
|
||||
import (
|
||||
"strings"
|
@ -1,4 +1,4 @@
|
||||
package parser
|
||||
package yaml
|
||||
|
||||
import (
|
||||
"testing"
|
@ -1,4 +1,4 @@
|
||||
package parser
|
||||
package yaml
|
||||
|
||||
// stringOrSlice represents a string or an array of strings.
|
||||
type stringOrSlice struct {
|
@ -1,4 +1,4 @@
|
||||
package parser
|
||||
package yaml
|
||||
|
||||
import (
|
||||
"testing"
|
Loading…
Reference in New Issue
Block a user