abstract polling and execution to runner-go library

This commit is contained in:
Brad Rydzewski
2019-12-06 16:10:27 -08:00
parent 99e80a0352
commit 2e48cd1b3b
27 changed files with 500 additions and 1394 deletions

View File

@@ -11,6 +11,8 @@ import (
"strings"
"github.com/drone-runners/drone-runner-docker/engine/resource"
"github.com/drone/drone-go/drone"
"github.com/drone/runner-go/manifest"
)
// ErrDuplicateStepName is returned when two Pipeline steps
@@ -43,8 +45,8 @@ func New() *Linter {
// Lint executes the linting rules for the pipeline
// configuration.
func (l *Linter) Lint(pipeline *resource.Pipeline, opts Opts) error {
return checkPipeline(pipeline, opts.Trusted)
func (l *Linter) Lint(pipeline manifest.Resource, repo *drone.Repo) error {
return checkPipeline(pipeline.(*resource.Pipeline), repo.Trusted)
}
func checkPipeline(pipeline *resource.Pipeline, trusted bool) error {

View File

@@ -9,6 +9,7 @@ import (
"testing"
"github.com/drone-runners/drone-runner-docker/engine/resource"
"github.com/drone/drone-go/drone"
"github.com/drone/runner-go/manifest"
)
@@ -212,7 +213,7 @@ func TestLint(t *testing.T) {
}
lint := New()
opts := Opts{Trusted: test.trusted}
opts := &drone.Repo{Trusted: test.trusted}
err = lint.Lint(resources.Resources[0].(*resource.Pipeline), opts)
if err == nil && test.invalid == true {
t.Logf("yaml: %s", test.path)