Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2020-04-14 14:30:39 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2020-04-14 14:30:39 +0300
commitd553929c0bd936f2e7687d7ebbce0d0ff28b91d0 (patch)
tree1ece1fe3247157df130ea2a5be9e862dc683dd93
parent44dc3b019e9bf5d52aeba2c76ad908cb25af013e (diff)
Revert "Merge branch 'jc-operations-service-call-hook-rpcs' into 'master'"
This reverts merge request !2034
-rw-r--r--changelogs/unreleased/jc-operations-service-call-hook-rpcs.yml5
-rw-r--r--internal/rubyserver/rubyserver.go1
-rw-r--r--internal/service/operations/tags_test.go18
-rw-r--r--internal/service/operations/testhelper_test.go28
-rw-r--r--ruby/lib/gitlab/config.rb4
-rw-r--r--ruby/lib/gitlab/git/hook.rb5
-rw-r--r--ruby/lib/gitlab/git/repository.rb10
7 files changed, 6 insertions, 65 deletions
diff --git a/changelogs/unreleased/jc-operations-service-call-hook-rpcs.yml b/changelogs/unreleased/jc-operations-service-call-hook-rpcs.yml
deleted file mode 100644
index 6d4cab2b6..000000000
--- a/changelogs/unreleased/jc-operations-service-call-hook-rpcs.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Call hook rpcs from operations service
-merge_request: 2034
-author:
-type: added
diff --git a/internal/rubyserver/rubyserver.go b/internal/rubyserver/rubyserver.go
index 4a779ddfd..d3e8863f8 100644
--- a/internal/rubyserver/rubyserver.go
+++ b/internal/rubyserver/rubyserver.go
@@ -96,7 +96,6 @@ func (s *Server) start() error {
"GITALY_RUBY_DIR="+cfg.Ruby.Dir,
"GITALY_VERSION="+version.GetVersion(),
"GITALY_GIT_HOOKS_DIR="+hooks.Path(),
- "GITALY_SOCKET="+config.GitalyInternalSocketPath(),
"GITALY_RUGGED_GIT_CONFIG_SEARCH_PATH="+cfg.Ruby.RuggedGitConfigSearchPath)
env = append(env, gitlabshell.Env()...)
diff --git a/internal/service/operations/tags_test.go b/internal/service/operations/tags_test.go
index 474d13d03..d4ed59b3b 100644
--- a/internal/service/operations/tags_test.go
+++ b/internal/service/operations/tags_test.go
@@ -209,14 +209,6 @@ func TestSuccessfulUserCreateTagRequest(t *testing.T) {
}
func TestSuccessfulGitHooksForUserCreateTagRequest(t *testing.T) {
- testSuccessfulGitHooksForUserCreateTagRequest(t, false)
-}
-
-func TestSuccessfulGitHooksForUserCreateTagRequestWithHookRPCs(t *testing.T) {
- testSuccessfulGitHooksForUserCreateTagRequest(t, true)
-}
-
-func testSuccessfulGitHooksForUserCreateTagRequest(t *testing.T, callHookRPC bool) {
serverSocketPath, stop := runOperationServiceServer(t)
defer stop()
@@ -244,13 +236,6 @@ func testSuccessfulGitHooksForUserCreateTagRequest(t *testing.T, callHookRPC boo
User: user,
}
- ctx, cancel := testhelper.Context()
- defer cancel()
-
- if callHookRPC {
- ctx = outgoingCtxWithRubyFeatureFlag(ctx, "call-hook-rpc")
- }
-
for _, hookName := range GitlabHooks {
t.Run(hookName, func(t *testing.T) {
defer exec.Command("git", "-C", testRepoPath, "tag", "-d", tagName).Run()
@@ -258,6 +243,9 @@ func testSuccessfulGitHooksForUserCreateTagRequest(t *testing.T, callHookRPC boo
hookOutputTempPath, cleanup := testhelper.WriteEnvToCustomHook(t, testRepoPath, hookName)
defer cleanup()
+ ctx, cancel := testhelper.Context()
+ defer cancel()
+
response, err := client.UserCreateTag(ctx, request)
require.NoError(t, err)
require.Empty(t, response.PreReceiveError)
diff --git a/internal/service/operations/testhelper_test.go b/internal/service/operations/testhelper_test.go
index 801c25f06..c9a59c580 100644
--- a/internal/service/operations/testhelper_test.go
+++ b/internal/service/operations/testhelper_test.go
@@ -1,23 +1,17 @@
package operations
import (
- "context"
- "fmt"
- "net"
"os"
"path/filepath"
- "strings"
"testing"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/config"
"gitlab.com/gitlab-org/gitaly/internal/rubyserver"
- hook "gitlab.com/gitlab-org/gitaly/internal/service/hooks"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc"
- "google.golang.org/grpc/metadata"
"google.golang.org/grpc/reflection"
)
@@ -75,19 +69,10 @@ func runOperationServiceServer(t *testing.T) (string, func()) {
srv := testhelper.NewServer(t, nil, nil)
gitalypb.RegisterOperationServiceServer(srv.GrpcServer(), &server{ruby: RubyServer})
- gitalypb.RegisterHookServiceServer(srv.GrpcServer(), hook.NewServer())
reflection.Register(srv.GrpcServer())
require.NoError(t, srv.Start())
- internalSocket := config.GitalyInternalSocketPath()
- internalListener, err := net.Listen("unix", internalSocket)
- require.NoError(t, err)
-
- go func() {
- srv.GrpcServer().Serve(internalListener)
- }()
-
return "unix://" + srv.Socket(), srv.Stop
}
@@ -115,16 +100,3 @@ func SetupAndStartGitlabServer(t *testing.T, glID, glRepository string, gitPushO
GitPushOptions: gitPushOptions,
})
}
-
-func outgoingCtxWithRubyFeatureFlag(ctx context.Context, flag string) context.Context {
- md, ok := metadata.FromOutgoingContext(ctx)
- if !ok {
- md = metadata.New(map[string]string{})
- }
- md.Set(rubyHeaderKey(flag), "true")
- return metadata.NewOutgoingContext(ctx, md)
-}
-
-func rubyHeaderKey(flag string) string {
- return fmt.Sprintf("gitaly-feature-ruby-%s", strings.ReplaceAll(flag, "_", "-"))
-}
diff --git a/ruby/lib/gitlab/config.rb b/ruby/lib/gitlab/config.rb
index 1631315f1..d644d88aa 100644
--- a/ruby/lib/gitlab/config.rb
+++ b/ruby/lib/gitlab/config.rb
@@ -64,10 +64,6 @@ module Gitlab
@ruby_dir ||= ENV['GITALY_RUBY_DIR']
end
- def internal_socket
- @internal_socket ||= ENV['GITALY_SOCKET']
- end
-
def rbtrace_enabled?
@rbtrace_enabled ||= enabled?(ENV['GITALY_RUBY_RBTRACE_ENABLED'])
end
diff --git a/ruby/lib/gitlab/git/hook.rb b/ruby/lib/gitlab/git/hook.rb
index 096e67843..7a5e15871 100644
--- a/ruby/lib/gitlab/git/hook.rb
+++ b/ruby/lib/gitlab/git/hook.rb
@@ -115,10 +115,7 @@ module Gitlab
'GL_REPOSITORY' => repository.gl_repository,
'GL_PROTOCOL' => GL_PROTOCOL,
'PWD' => repo_path,
- 'GIT_DIR' => repo_path,
- 'GITALY_REPO' => repository.gitaly_repository.to_json,
- 'GITALY_SOCKET' => Gitlab.config.gitaly.internal_socket,
- 'GITALY_HOOK_RPCS_ENABLED' => repository.feature_enabled?('call-hook-rpc').to_s
+ 'GIT_DIR' => repo_path
}
end
end
diff --git a/ruby/lib/gitlab/git/repository.rb b/ruby/lib/gitlab/git/repository.rb
index 326c4c563..ccb251fcb 100644
--- a/ruby/lib/gitlab/git/repository.rb
+++ b/ruby/lib/gitlab/git/repository.rb
@@ -41,8 +41,7 @@ module Gitlab
GitalyServer.repo_path(call),
GitalyServer.gl_repository(call),
Gitlab::Git::GitlabProjects.from_gitaly(gitaly_repository, call),
- GitalyServer.repo_alt_dirs(call),
- GitalyServer.feature_flags(call)
+ GitalyServer.repo_alt_dirs(call)
)
end
@@ -64,7 +63,7 @@ module Gitlab
attr_reader :gitlab_projects, :storage, :gl_repository, :relative_path
- def initialize(gitaly_repository, path, gl_repository, gitlab_projects, combined_alt_dirs = "", feature_flags = GitalyServer::FeatureFlags.new({}))
+ def initialize(gitaly_repository, path, gl_repository, gitlab_projects, combined_alt_dirs = "")
@gitaly_repository = gitaly_repository
@alternate_object_directories = combined_alt_dirs
@@ -76,17 +75,12 @@ module Gitlab
@path = path
@gl_repository = gl_repository
@gitlab_projects = gitlab_projects
- @feature_flags = feature_flags
end
def ==(other)
[storage, relative_path] == [other.storage, other.relative_path]
end
- def feature_enabled?(flag)
- @feature_flags.enabled?(flag)
- end
-
def add_branch(branch_name, user:, target:)
target_object = Ref.dereference_object(lookup(target))
raise InvalidRef, "target not found: #{target}" unless target_object