mirror of https://github.com/harness/drone.git
add ENABLE_CI and pass in CI implementations to harness wire
parent
501605721e
commit
9361734683
|
@ -29,6 +29,7 @@ import (
|
|||
type command struct {
|
||||
envfile string
|
||||
enableGitRPC bool
|
||||
enableCI bool
|
||||
initializer func(context.Context, *types.Config) (*System, error)
|
||||
}
|
||||
|
||||
|
@ -82,15 +83,18 @@ func (c *command) run(*kingpin.ParseContext) error {
|
|||
// start server
|
||||
gHTTP, shutdownHTTP := system.server.ListenAndServe()
|
||||
g.Go(gHTTP.Wait)
|
||||
g.Go(func() error {
|
||||
if c.enableCI {
|
||||
// start poller for CI build executions.
|
||||
log := logrus.New()
|
||||
log.Out = os.Stdout
|
||||
log.Level = logrus.DebugLevel // print all debug logs in common runner code.
|
||||
ctx = logger.WithContext(ctx, logger.Logrus(log.WithContext(ctx)))
|
||||
system.poller.Poll(ctx, config.CI.ParallelWorkers)
|
||||
return nil
|
||||
})
|
||||
g.Go(func() error {
|
||||
log := logrus.New()
|
||||
log.Out = os.Stdout
|
||||
log.Level = logrus.DebugLevel // print all debug logs in common runner code.
|
||||
ctx = logger.WithContext(ctx, logger.Logrus(log.WithContext(ctx)))
|
||||
system.poller.Poll(ctx, config.CI.ParallelWorkers)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
log.Info().
|
||||
Str("port", config.Server.HTTP.Bind).
|
||||
Str("revision", version.GitCommit).
|
||||
|
@ -194,4 +198,9 @@ func Register(app *kingpin.Application, initializer func(context.Context, *types
|
|||
Default("true").
|
||||
Envar("ENABLE_GITRPC").
|
||||
BoolVar(&c.enableGitRPC)
|
||||
|
||||
cmd.Flag("enable-ci", "start ci runners for build executions").
|
||||
Default("true").
|
||||
Envar("ENABLE_CI").
|
||||
BoolVar(&c.enableCI)
|
||||
}
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"github.com/drone/runner-go/poller"
|
||||
gitrpcserver "github.com/harness/gitness/gitrpc/server"
|
||||
gitrpccron "github.com/harness/gitness/gitrpc/server/cron"
|
||||
"github.com/harness/gitness/internal/bootstrap"
|
||||
"github.com/harness/gitness/internal/server"
|
||||
"github.com/harness/gitness/internal/services"
|
||||
|
||||
"github.com/drone/runner-go/poller"
|
||||
)
|
||||
|
||||
// System stores high level System sub-routines.
|
||||
|
|
|
@ -8,12 +8,7 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"github.com/harness/gitness/internal/pipeline/commit"
|
||||
"github.com/harness/gitness/internal/pipeline/file"
|
||||
"github.com/harness/gitness/internal/pipeline/manager"
|
||||
"github.com/harness/gitness/internal/pipeline/runner"
|
||||
"github.com/harness/gitness/internal/pipeline/scheduler"
|
||||
"github.com/harness/gitness/internal/pipeline/triggerer"
|
||||
|
||||
"github.com/harness/gitness/cli/server"
|
||||
"github.com/harness/gitness/encrypt"
|
||||
"github.com/harness/gitness/events"
|
||||
|
@ -44,6 +39,12 @@ import (
|
|||
"github.com/harness/gitness/internal/bootstrap"
|
||||
events3 "github.com/harness/gitness/internal/events/git"
|
||||
events2 "github.com/harness/gitness/internal/events/pullreq"
|
||||
"github.com/harness/gitness/internal/pipeline/commit"
|
||||
"github.com/harness/gitness/internal/pipeline/file"
|
||||
"github.com/harness/gitness/internal/pipeline/manager"
|
||||
"github.com/harness/gitness/internal/pipeline/runner"
|
||||
"github.com/harness/gitness/internal/pipeline/scheduler"
|
||||
"github.com/harness/gitness/internal/pipeline/triggerer"
|
||||
"github.com/harness/gitness/internal/router"
|
||||
server2 "github.com/harness/gitness/internal/server"
|
||||
"github.com/harness/gitness/internal/services"
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
gitness_store "github.com/harness/gitness/store"
|
||||
"github.com/harness/gitness/types"
|
||||
"github.com/harness/gitness/types/enum"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
gitness_store "github.com/harness/gitness/store"
|
||||
"github.com/harness/gitness/types"
|
||||
"github.com/harness/gitness/types/enum"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"github.com/harness/gitness/internal/store"
|
||||
"github.com/harness/gitness/types"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,8 +7,9 @@ package triggerer
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone-yaml/yaml"
|
||||
"github.com/harness/gitness/types/enum"
|
||||
|
||||
"github.com/drone/drone-yaml/yaml"
|
||||
)
|
||||
|
||||
func skipBranch(document *yaml.Pipeline, branch string) bool {
|
||||
|
|
Loading…
Reference in New Issue