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:
authorPavlo Strokov <pstrokov@gitlab.com>2021-01-19 11:56:27 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-01-19 11:56:27 +0300
commitbfbd64eceae6adf1b2066abaf1f144779bd52580 (patch)
treeb3be8584e91b058039ab18d85dbbacaa040aadfc
parentc5cb5cf98e2d2191d5bb2fd734210ca150e13174 (diff)
parent56a65012b022bf4a2e9d70b260d20015fc21b05e (diff)
Merge branch 'pks-revert-go-user-update-submodule-default' into 'master'
Revert "Merge branch 'po-remove-ruby-userupdatesubmodule' into 'master'" See merge request gitlab-org/gitaly!3021
-rw-r--r--changelogs/unreleased/po-remove-ruby-userupdatesubmodule.yml5
-rw-r--r--internal/gitaly/service/operations/submodules.go18
-rw-r--r--internal/gitaly/service/operations/submodules_test.go43
-rw-r--r--internal/metadata/featureflag/feature_flags.go4
4 files changed, 52 insertions, 18 deletions
diff --git a/changelogs/unreleased/po-remove-ruby-userupdatesubmodule.yml b/changelogs/unreleased/po-remove-ruby-userupdatesubmodule.yml
deleted file mode 100644
index b2056a316..000000000
--- a/changelogs/unreleased/po-remove-ruby-userupdatesubmodule.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Remove Ruby implementation of UserUpdateSubmodule
-merge_request: 3005
-author:
-type: performance
diff --git a/internal/gitaly/service/operations/submodules.go b/internal/gitaly/service/operations/submodules.go
index 897464dd2..32eaf6a99 100644
--- a/internal/gitaly/service/operations/submodules.go
+++ b/internal/gitaly/service/operations/submodules.go
@@ -11,7 +11,9 @@ import (
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
"gitlab.com/gitlab-org/gitaly/internal/git"
"gitlab.com/gitlab-org/gitaly/internal/git2go"
+ "gitlab.com/gitlab-org/gitaly/internal/gitaly/rubyserver"
"gitlab.com/gitlab-org/gitaly/internal/helper"
+ "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -24,7 +26,21 @@ func (s *Server) UserUpdateSubmodule(ctx context.Context, req *gitalypb.UserUpda
return nil, status.Errorf(codes.InvalidArgument, userUpdateSubmoduleName+": %v", err)
}
- return s.userUpdateSubmodule(ctx, req)
+ if featureflag.IsEnabled(ctx, featureflag.GoUserUpdateSubmodule) {
+ return s.userUpdateSubmodule(ctx, req)
+ }
+
+ client, err := s.ruby.OperationServiceClient(ctx)
+ if err != nil {
+ return nil, err
+ }
+
+ clientCtx, err := rubyserver.SetHeaders(ctx, s.locator, req.GetRepository())
+ if err != nil {
+ return nil, err
+ }
+
+ return client.UserUpdateSubmodule(clientCtx, req)
}
func validateUserUpdateSubmoduleRequest(req *gitalypb.UserUpdateSubmoduleRequest) error {
diff --git a/internal/gitaly/service/operations/submodules_test.go b/internal/gitaly/service/operations/submodules_test.go
index a98a14ef7..d1b7e2088 100644
--- a/internal/gitaly/service/operations/submodules_test.go
+++ b/internal/gitaly/service/operations/submodules_test.go
@@ -11,15 +11,19 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/git/log"
"gitlab.com/gitlab-org/gitaly/internal/git/lstree"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
+ "gitlab.com/gitlab-org/gitaly/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
)
func TestSuccessfulUserUpdateSubmoduleRequest(t *testing.T) {
- ctx, cancel := testhelper.Context()
- defer cancel()
+ testhelper.NewFeatureSets(
+ []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule},
+ ).Run(t, testSuccessfulUserUpdateSubmoduleRequest)
+}
+func testSuccessfulUserUpdateSubmoduleRequest(t *testing.T, ctx context.Context) {
locator := config.NewLocator(config.Config)
serverSocketPath, stop := runOperationServiceServer(t)
@@ -86,9 +90,12 @@ func TestSuccessfulUserUpdateSubmoduleRequest(t *testing.T) {
}
func TestFailedUserUpdateSubmoduleRequestDueToValidations(t *testing.T) {
- ctx, cancel := testhelper.Context()
- defer cancel()
+ testhelper.NewFeatureSets(
+ []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule},
+ ).Run(t, testFailedUserUpdateSubmoduleRequestDueToValidations)
+}
+func testFailedUserUpdateSubmoduleRequestDueToValidations(t *testing.T, ctx context.Context) {
serverSocketPath, stop := runOperationServiceServer(t)
defer stop()
@@ -214,9 +221,12 @@ func TestFailedUserUpdateSubmoduleRequestDueToValidations(t *testing.T) {
}
func TestFailedUserUpdateSubmoduleRequestDueToInvalidBranch(t *testing.T) {
- ctx, cancel := testhelper.Context()
- defer cancel()
+ testhelper.NewFeatureSets(
+ []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule},
+ ).Run(t, testFailedUserUpdateSubmoduleRequestDueToInvalidBranch)
+}
+func testFailedUserUpdateSubmoduleRequestDueToInvalidBranch(t *testing.T, ctx context.Context) {
serverSocketPath, stop := runOperationServiceServer(t)
defer stop()
@@ -241,9 +251,12 @@ func TestFailedUserUpdateSubmoduleRequestDueToInvalidBranch(t *testing.T) {
}
func TestFailedUserUpdateSubmoduleRequestDueToInvalidSubmodule(t *testing.T) {
- ctx, cancel := testhelper.Context()
- defer cancel()
+ testhelper.NewFeatureSets(
+ []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule},
+ ).Run(t, testFailedUserUpdateSubmoduleRequestDueToInvalidSubmodule)
+}
+func testFailedUserUpdateSubmoduleRequestDueToInvalidSubmodule(t *testing.T, ctx context.Context) {
serverSocketPath, stop := runOperationServiceServer(t)
defer stop()
@@ -268,9 +281,12 @@ func TestFailedUserUpdateSubmoduleRequestDueToInvalidSubmodule(t *testing.T) {
}
func TestFailedUserUpdateSubmoduleRequestDueToSameReference(t *testing.T) {
- ctx, cancel := testhelper.Context()
- defer cancel()
+ testhelper.NewFeatureSets(
+ []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule},
+ ).Run(t, testFailedUserUpdateSubmoduleRequestDueToSameReference)
+}
+func testFailedUserUpdateSubmoduleRequestDueToSameReference(t *testing.T, ctx context.Context) {
serverSocketPath, stop := runOperationServiceServer(t)
defer stop()
@@ -298,9 +314,12 @@ func TestFailedUserUpdateSubmoduleRequestDueToSameReference(t *testing.T) {
}
func TestFailedUserUpdateSubmoduleRequestDueToRepositoryEmpty(t *testing.T) {
- ctx, cancel := testhelper.Context()
- defer cancel()
+ testhelper.NewFeatureSets(
+ []featureflag.FeatureFlag{featureflag.GoUserUpdateSubmodule},
+ ).Run(t, testFailedUserUpdateSubmoduleRequestDueToRepositoryEmpty)
+}
+func testFailedUserUpdateSubmoduleRequestDueToRepositoryEmpty(t *testing.T, ctx context.Context) {
serverSocketPath, stop := runOperationServiceServer(t)
defer stop()
diff --git a/internal/metadata/featureflag/feature_flags.go b/internal/metadata/featureflag/feature_flags.go
index f3b3bcf1b..20dd2a695 100644
--- a/internal/metadata/featureflag/feature_flags.go
+++ b/internal/metadata/featureflag/feature_flags.go
@@ -29,6 +29,9 @@ var (
GoUserCommitFiles = FeatureFlag{Name: "go_user_commit_files", OnByDefault: false}
// GoResolveConflicts enables the Go implementation of ResolveConflicts
GoResolveConflicts = FeatureFlag{Name: "go_resolve_conflicts", OnByDefault: false}
+ // GoUserUpdateSubmodule enables the Go implementation of
+ // UserUpdateSubmodules
+ GoUserUpdateSubmodule = FeatureFlag{Name: "go_user_update_submodule", OnByDefault: false}
// GoUserDeleteTag enables the Go implementation of UserDeleteTag
GoUserDeleteTag = FeatureFlag{Name: "go_user_delete_tag", OnByDefault: true}
// GoUserCreateTag enables the Go implementation of UserCreateTag
@@ -112,6 +115,7 @@ var All = []FeatureFlag{
GoUserDeleteBranch,
GoUserCommitFiles,
GoResolveConflicts,
+ GoUserUpdateSubmodule,
GoUserDeleteTag,
GoUserCreateTag,
GoUserRevert,