*: rename GitServer to Gitserver
This commit is contained in:
parent
1e34dca95d
commit
43341f2cba
|
@ -43,8 +43,8 @@ var componentsNames = []string{
|
||||||
"all",
|
"all",
|
||||||
"gateway",
|
"gateway",
|
||||||
"scheduler",
|
"scheduler",
|
||||||
"runservicescheduler",
|
"runservice",
|
||||||
"runserviceexecutor",
|
"executor",
|
||||||
"configstore",
|
"configstore",
|
||||||
"gitserver",
|
"gitserver",
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ func serve(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
var rs *rsscheduler.Runservice
|
var rs *rsscheduler.Runservice
|
||||||
if isComponentEnabled("runservicescheduler") {
|
if isComponentEnabled("runservice") {
|
||||||
rs, err = rsscheduler.NewRunservice(ctx, &c.Runservice)
|
rs, err = rsscheduler.NewRunservice(ctx, &c.Runservice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "failed to start run service scheduler")
|
return errors.Wrapf(err, "failed to start run service scheduler")
|
||||||
|
@ -148,7 +148,7 @@ func serve(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
var ex *rsexecutor.Executor
|
var ex *rsexecutor.Executor
|
||||||
if isComponentEnabled("runserviceexecutor") {
|
if isComponentEnabled("executor") {
|
||||||
ex, err = executor.NewExecutor(&c.Executor)
|
ex, err = executor.NewExecutor(&c.Executor)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "failed to start run service executor")
|
return errors.Wrapf(err, "failed to start run service executor")
|
||||||
|
@ -179,9 +179,9 @@ func serve(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var gs *gitserver.GitServer
|
var gs *gitserver.Gitserver
|
||||||
if isComponentEnabled("gitserver") {
|
if isComponentEnabled("gitserver") {
|
||||||
gs, err = gitserver.NewGitServer(&c.GitServer)
|
gs, err = gitserver.NewGitserver(&c.Gitserver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "failed to start git server")
|
return errors.Wrapf(err, "failed to start git server")
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ gateway:
|
||||||
webExposedURL: "http://172.17.0.1:8080"
|
webExposedURL: "http://172.17.0.1:8080"
|
||||||
runserviceURL: "http://localhost:4000"
|
runserviceURL: "http://localhost:4000"
|
||||||
configstoreURL: "http://localhost:4002"
|
configstoreURL: "http://localhost:4002"
|
||||||
gitServerURL: "http://172.17.0.1:4003"
|
gitserverURL: "http://172.17.0.1:4003"
|
||||||
|
|
||||||
web:
|
web:
|
||||||
listenAddress: ":8000"
|
listenAddress: ":8000"
|
||||||
|
@ -33,11 +33,11 @@ configstore:
|
||||||
runservice:
|
runservice:
|
||||||
#debug: true
|
#debug: true
|
||||||
dataDir: /tmp/agola/runservice
|
dataDir: /tmp/agola/runservice
|
||||||
|
etcd:
|
||||||
|
endpoints: "http://localhost:2379"
|
||||||
objectStorage:
|
objectStorage:
|
||||||
type: posix
|
type: posix
|
||||||
path: /tmp/agola/runservice/ost
|
path: /tmp/agola/runservice/ost
|
||||||
etcd:
|
|
||||||
endpoints: "http://localhost:2379"
|
|
||||||
web:
|
web:
|
||||||
listenAddress: ":4000"
|
listenAddress: ":4000"
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ executor:
|
||||||
driver:
|
driver:
|
||||||
type: docker
|
type: docker
|
||||||
|
|
||||||
gitServer:
|
gitserver:
|
||||||
dataDir: /tmp/agola/gitserver
|
dataDir: /tmp/agola/gitserver
|
||||||
githookPath: ./bin/agola-git-hook
|
githookPath: ./bin/agola-git-hook
|
||||||
gatewayURL: "http://localhost:8000"
|
gatewayURL: "http://localhost:8000"
|
||||||
|
|
|
@ -38,7 +38,7 @@ type Config struct {
|
||||||
Runservice Runservice `yaml:"runservice"`
|
Runservice Runservice `yaml:"runservice"`
|
||||||
Executor Executor `yaml:"executor"`
|
Executor Executor `yaml:"executor"`
|
||||||
Configstore Configstore `yaml:"configstore"`
|
Configstore Configstore `yaml:"configstore"`
|
||||||
GitServer GitServer `yaml:"gitServer"`
|
Gitserver Gitserver `yaml:"gitserver"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Gateway struct {
|
type Gateway struct {
|
||||||
|
@ -53,7 +53,7 @@ type Gateway struct {
|
||||||
|
|
||||||
RunserviceURL string `yaml:"runserviceURL"`
|
RunserviceURL string `yaml:"runserviceURL"`
|
||||||
ConfigstoreURL string `yaml:"configstoreURL"`
|
ConfigstoreURL string `yaml:"configstoreURL"`
|
||||||
GitServerURL string `yaml:"gitServerURL"`
|
GitserverURL string `yaml:"gitserverURL"`
|
||||||
|
|
||||||
Web Web `yaml:"web"`
|
Web Web `yaml:"web"`
|
||||||
Etcd Etcd `yaml:"etcd"`
|
Etcd Etcd `yaml:"etcd"`
|
||||||
|
@ -108,7 +108,7 @@ type Configstore struct {
|
||||||
ObjectStorage ObjectStorage `yaml:"objectStorage"`
|
ObjectStorage ObjectStorage `yaml:"objectStorage"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GitServer struct {
|
type Gitserver struct {
|
||||||
Debug bool `yaml:"debug"`
|
Debug bool `yaml:"debug"`
|
||||||
|
|
||||||
DataDir string `yaml:"dataDir"`
|
DataDir string `yaml:"dataDir"`
|
||||||
|
@ -315,13 +315,13 @@ func Validate(c *Config) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Git server
|
// Git server
|
||||||
if c.GitServer.DataDir == "" {
|
if c.Gitserver.DataDir == "" {
|
||||||
return errors.Errorf("git server dataDir is empty")
|
return errors.Errorf("git server dataDir is empty")
|
||||||
}
|
}
|
||||||
if c.GitServer.GithookPath == "" {
|
if c.Gitserver.GithookPath == "" {
|
||||||
return errors.Errorf("git server githookPath is empty")
|
return errors.Errorf("git server githookPath is empty")
|
||||||
}
|
}
|
||||||
if c.GitServer.GatewayURL == "" {
|
if c.Gitserver.GatewayURL == "" {
|
||||||
return errors.Errorf("git server gatewayURL is empty")
|
return errors.Errorf("git server gatewayURL is empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ func (g *Gateway) Run(ctx context.Context) error {
|
||||||
|
|
||||||
logsHandler := api.NewLogsHandler(logger, g.ah)
|
logsHandler := api.NewLogsHandler(logger, g.ah)
|
||||||
|
|
||||||
reposHandler := api.NewReposHandler(logger, g.c.GitServerURL)
|
reposHandler := api.NewReposHandler(logger, g.c.GitserverURL)
|
||||||
userRemoteReposHandler := api.NewUserRemoteReposHandler(logger, g.ah, g.configstoreClient)
|
userRemoteReposHandler := api.NewUserRemoteReposHandler(logger, g.ah, g.configstoreClient)
|
||||||
|
|
||||||
loginUserHandler := api.NewLoginUserHandler(logger, g.ah)
|
loginUserHandler := api.NewLoginUserHandler(logger, g.ah)
|
||||||
|
|
|
@ -127,7 +127,7 @@ func Matcher(matchRegexp *regexp.Regexp) mux.MatcherFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GitServer) repoPostCreateFunc(githookPath, gatewayURL string) handlers.RepoPostCreateFunc {
|
func (s *Gitserver) repoPostCreateFunc(githookPath, gatewayURL string) handlers.RepoPostCreateFunc {
|
||||||
return func(repoPath, repoAbsPath string) error {
|
return func(repoPath, repoAbsPath string) error {
|
||||||
f, err := os.OpenFile(filepath.Join(repoAbsPath, "hooks/post-receive"), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0760)
|
f, err := os.OpenFile(filepath.Join(repoAbsPath, "hooks/post-receive"), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0760)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -154,11 +154,11 @@ func (s *GitServer) repoPostCreateFunc(githookPath, gatewayURL string) handlers.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type GitServer struct {
|
type Gitserver struct {
|
||||||
c *config.GitServer
|
c *config.Gitserver
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGitServer(c *config.GitServer) (*GitServer, error) {
|
func NewGitserver(c *config.Gitserver) (*Gitserver, error) {
|
||||||
if c.Debug {
|
if c.Debug {
|
||||||
level.SetLevel(zapcore.DebugLevel)
|
level.SetLevel(zapcore.DebugLevel)
|
||||||
}
|
}
|
||||||
|
@ -176,12 +176,12 @@ func NewGitServer(c *config.GitServer) (*GitServer, error) {
|
||||||
c.GithookPath = path
|
c.GithookPath = path
|
||||||
}
|
}
|
||||||
|
|
||||||
return &GitServer{
|
return &Gitserver{
|
||||||
c: c,
|
c: c,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GitServer) Run(ctx context.Context) error {
|
func (s *Gitserver) Run(ctx context.Context) error {
|
||||||
gitSmartHandler := handlers.NewGitSmartHandler(logger, s.c.DataDir, true, repoAbsPath, s.repoPostCreateFunc(s.c.GithookPath, s.c.GatewayURL))
|
gitSmartHandler := handlers.NewGitSmartHandler(logger, s.c.DataDir, true, repoAbsPath, s.repoPostCreateFunc(s.c.GithookPath, s.c.GatewayURL))
|
||||||
fetchFileHandler := handlers.NewFetchFileHandler(logger, s.c.DataDir, repoAbsPath)
|
fetchFileHandler := handlers.NewFetchFileHandler(logger, s.c.DataDir, repoAbsPath)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue