mirror of https://github.com/harness/drone.git
[GITRPC] Add GitRPC Binary (#257)
parent
bfb0466b11
commit
114cdb34e0
|
@ -8,7 +8,8 @@ _research
|
|||
web/node_modules
|
||||
web/dist/files
|
||||
release
|
||||
gitness
|
||||
/gitness
|
||||
/gitrpcserver
|
||||
.idea
|
||||
coverage.out
|
||||
gitness.session.sql
|
||||
|
|
30
Makefile
30
Makefile
|
@ -35,22 +35,27 @@ tools: $(tools) ## Install tools required for the build
|
|||
mocks: $(mocks)
|
||||
@echo "Generating Test Mocks"
|
||||
|
||||
wire: cli/server/harness.wire_gen.go cli/server/standalone.wire_gen.go
|
||||
wire: cli/server/harness.wire_gen.go cli/server/standalone.wire_gen.go cmd/gitrpcserver/wire_gen.go
|
||||
|
||||
force-wire: ## Force wire code generation
|
||||
@sh ./scripts/wire/standalone.sh
|
||||
@sh ./scripts/wire/harness.sh
|
||||
@sh ./scripts/wire/server/standalone.sh
|
||||
@sh ./scripts/wire/server/harness.sh
|
||||
@sh ./scripts/wire/gitrpcserver/wire.sh
|
||||
|
||||
generate: $(mocks) wire mocks/mock_client.go proto
|
||||
@echo "Generating Code"
|
||||
|
||||
build: generate ## Build the gitness service binary
|
||||
build: generate ## Build the all-in-one gitness binary
|
||||
@echo "Building Gitness Server"
|
||||
go build -ldflags="-X github.com/harness/gitness/version.GitCommit=${GIT_COMMIT} -X github.com/harness/gitness/version.Version.Major=${GITNESS_VERSION}" -o ./gitness .
|
||||
go build -ldflags="-X github.com/harness/gitness/version.GitCommit=${GIT_COMMIT} -X github.com/harness/gitness/version.Version.Major=${GITNESS_VERSION}" -o ./gitness ./cmd/gitness
|
||||
|
||||
harness-build: generate ## Build the gitness service binary for harness embedded mode
|
||||
harness-build: generate ## Build the all-in-one gitness binary for harness embedded mode
|
||||
@echo "Building Gitness Server for Harness"
|
||||
go build -tags=harness -ldflags="-X github.com/harness/gitness/version.GitCommit=${GIT_COMMIT} -X github.com/harness/gitness/version.Version.Major=${GITNESS_VERSION}" -o ./gitness .
|
||||
go build -tags=harness -ldflags="-X github.com/harness/gitness/version.GitCommit=${GIT_COMMIT} -X github.com/harness/gitness/version.Version.Major=${GITNESS_VERSION}" -o ./gitness ./cmd/gitness
|
||||
|
||||
build-gitrpc: generate ## Build the gitrpc binary
|
||||
@echo "Building GitRPC Server"
|
||||
go build -ldflags="-X github.com/harness/gitness/version.GitCommit=${GIT_COMMIT} -X github.com/harness/gitness/version.Version.Major=${GITNESS_VERSION}" -o ./gitrpcserver ./cmd/gitrpcserver
|
||||
|
||||
test: generate ## Run the go tests
|
||||
@echo "Running tests"
|
||||
|
@ -126,11 +131,14 @@ lint: tools generate # lint the golang code
|
|||
# Some code generation can be slow, so we only run it if
|
||||
# the source file has changed.
|
||||
###########################################
|
||||
cli/server/harness.wire_gen.go: cli/server/harness.wire.go ## Update the wire dependency injection if harness.wire.go has changed.
|
||||
@sh ./scripts/wire/harness.sh
|
||||
cli/server/harness.wire_gen.go: cli/server/harness.wire.go
|
||||
@sh ./scripts/wire/server/harness.sh
|
||||
|
||||
cli/server/standalone.wire_gen.go: cli/server/standalone.wire.go ## Update the wire dependency injection if standalone.wire.go has changed.
|
||||
@sh ./scripts/wire/standalone.sh
|
||||
cli/server/standalone.wire_gen.go: cli/server/standalone.wire.go
|
||||
@sh ./scripts/wire/server/standalone.sh
|
||||
|
||||
cmd/gitrpcserver/wire_gen.go: cmd/gitrpcserver/wire.go
|
||||
@sh ./scripts/wire/gitrpcserver/wire.sh
|
||||
|
||||
mocks/mock_client.go: internal/store/database.go client/client.go
|
||||
go generate mocks/mock.go
|
||||
|
|
|
@ -89,7 +89,7 @@ func ProvideGitRPCServerConfig() (server.Config, error) {
|
|||
return server.Config{}, err
|
||||
}
|
||||
|
||||
config.GitRoot = filepath.Join(homedir, ".gitness")
|
||||
config.GitRoot = filepath.Join(homedir, ".gitrpc")
|
||||
}
|
||||
|
||||
return config, nil
|
||||
|
|
|
@ -68,7 +68,9 @@ func (c *command) run(*kingpin.ParseContext) error {
|
|||
return fmt.Errorf("encountered an error while bootstrapping the system: %w", err)
|
||||
}
|
||||
|
||||
// collects all go routines - gCTX cancels if any go routine encounters an error
|
||||
// gCtx is canceled if any of the following occurs:
|
||||
// - any go routine launched with g encounters an error
|
||||
// - ctx is canceled
|
||||
g, gCtx := errgroup.WithContext(ctx)
|
||||
|
||||
// start server
|
||||
|
@ -90,6 +92,7 @@ func (c *command) run(*kingpin.ParseContext) error {
|
|||
|
||||
// start grpc server
|
||||
g.Go(system.gitRPCServer.Start)
|
||||
log.Info().Msg("gitrpc server started")
|
||||
|
||||
// wait until the error group context is done
|
||||
<-gCtx.Done()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
echo "Updating harness.wire_gen.go"
|
||||
echo "Updating cli/server/harness.wire_gen.go"
|
||||
go run github.com/google/wire/cmd/wire gen -tags=harness -output_file_prefix="harness." github.com/harness/gitness/cli/server
|
||||
perl -ni -e 'print unless /go:generate/' cli/server/harness.wire_gen.go
|
||||
perl -i -pe's/\+build !wireinject/\+build !wireinject,harness/g' cli/server/harness.wire_gen.go
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
echo "Updating standalone.wire_gen.go"
|
||||
echo "Updating cli/server/standalone.wire_gen.go"
|
||||
go run github.com/google/wire/cmd/wire gen -tags= -output_file_prefix="standalone." github.com/harness/gitness/cli/server
|
||||
perl -ni -e 'print unless /go:generate/' cli/server/standalone.wire_gen.go
|
||||
perl -i -pe's/\+build !wireinject/\+build !wireinject,!harness/g' cli/server/standalone.wire_gen.go
|
Loading…
Reference in New Issue