refact yaml operations to yaml package
This commit is contained in:
parent
62ccf1bd60
commit
fd63d6e03d
16 changed files with 14 additions and 14 deletions
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_*
|
drone_*
|
||||||
*.sqlite
|
*.sqlite
|
||||||
*_gen.go
|
*_gen.go
|
||||||
|
|
10
web/hook.go
10
web/hook.go
|
@ -11,13 +11,13 @@ import (
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/drone/drone/engine"
|
"github.com/drone/drone/engine"
|
||||||
"github.com/drone/drone/engine/parser"
|
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
|
"github.com/drone/drone/queue"
|
||||||
"github.com/drone/drone/remote"
|
"github.com/drone/drone/remote"
|
||||||
"github.com/drone/drone/shared/httputil"
|
"github.com/drone/drone/shared/httputil"
|
||||||
"github.com/drone/drone/shared/token"
|
"github.com/drone/drone/shared/token"
|
||||||
"github.com/drone/drone/store"
|
"github.com/drone/drone/store"
|
||||||
"github.com/drone/drone/queue"
|
"github.com/drone/drone/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -148,13 +148,13 @@ func PostHook(c *gin.Context) {
|
||||||
// NOTE we don't exit on failure. The sec file is optional
|
// 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 {
|
if err != nil {
|
||||||
c.String(500, "Failed to parse yaml file or calculate matrix. %s", err)
|
c.String(500, "Failed to parse yaml file or calculate matrix. %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(axes) == 0 {
|
if len(axes) == 0 {
|
||||||
axes = append(axes, parser.Axis{})
|
axes = append(axes, yaml.Axis{})
|
||||||
}
|
}
|
||||||
|
|
||||||
netrc, err := remote_.Netrc(user, repo)
|
netrc, err := remote_.Netrc(user, repo)
|
||||||
|
@ -166,7 +166,7 @@ func PostHook(c *gin.Context) {
|
||||||
key, _ := store.GetKey(c, repo)
|
key, _ := store.GetKey(c, repo)
|
||||||
|
|
||||||
// verify the branches can be built vs skipped
|
// verify the branches can be built vs skipped
|
||||||
branches := parser.ParseBranch(raw)
|
branches := yaml.ParseBranch(raw)
|
||||||
if !branches.Matches(build.Branch) {
|
if !branches.Matches(build.Branch) {
|
||||||
c.String(200, "Branch does not match restrictions defined in yaml")
|
c.String(200, "Branch does not match restrictions defined in yaml")
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package parser
|
package yaml
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
|
@ -1,4 +1,4 @@
|
||||||
package parser
|
package yaml
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
|
@ -1,4 +1,4 @@
|
||||||
package shasum
|
package checksum
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
|
@ -1,4 +1,4 @@
|
||||||
package shasum
|
package checksum
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
|
@ -1,4 +1,4 @@
|
||||||
package parser
|
package yaml
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
|
@ -1,4 +1,4 @@
|
||||||
package parser
|
package yaml
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
|
@ -1,4 +1,4 @@
|
||||||
package parser
|
package yaml
|
||||||
|
|
||||||
// stringOrSlice represents a string or an array of strings.
|
// stringOrSlice represents a string or an array of strings.
|
||||||
type stringOrSlice struct {
|
type stringOrSlice struct {
|
|
@ -1,4 +1,4 @@
|
||||||
package parser
|
package yaml
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
Loading…
Reference in a new issue