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:
-rw-r--r--CHANGELOG.md12
-rw-r--r--changelogs/unreleased/pks-remote-find-root-ref-inmemory-remote.yml5
-rw-r--r--cmd/gitaly-hooks/hooks.go38
-rw-r--r--internal/cache/cachedb_test.go12
-rw-r--r--internal/cache/testhelper_test.go19
-rw-r--r--internal/cache/walker_test.go10
-rw-r--r--internal/gitaly/service/operations/rebase_test.go45
-rw-r--r--internal/gitaly/service/remote/find_remote_root_ref.go55
-rw-r--r--internal/gitaly/service/remote/find_remote_root_ref_test.go161
-rw-r--r--proto/go/gitalypb/remote.pb.go154
-rw-r--r--proto/remote.proto24
-rw-r--r--ruby/proto/gitaly/remote_pb.rb2
-rw-r--r--ruby/proto/gitaly/remote_services_pb.rb5
13 files changed, 382 insertions, 160 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a58fa2fad..e4d88a3ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Gitaly changelog
+## 13.11.2 (2021-04-27)
+
+- No changes.
+
## 13.11.1 (2021-04-22)
- No changes.
@@ -62,6 +66,10 @@
- Update gitlab-gollum-rugged_adapter to 0.4.4.4.gitlab.1. !3357 (Takuya Noguchi)
+## 13.10.4 (2021-04-27)
+
+- No changes.
+
## 13.10.3 (2021-04-13)
- No changes.
@@ -138,6 +146,10 @@
- Remove unused Ruby code. !3203
+## 13.9.7 (2021-04-27)
+
+- No changes.
+
## 13.9.6 (2021-04-13)
- No changes.
diff --git a/changelogs/unreleased/pks-remote-find-root-ref-inmemory-remote.yml b/changelogs/unreleased/pks-remote-find-root-ref-inmemory-remote.yml
new file mode 100644
index 000000000..3fe24b4d0
--- /dev/null
+++ b/changelogs/unreleased/pks-remote-find-root-ref-inmemory-remote.yml
@@ -0,0 +1,5 @@
+---
+title: 'remote: Add RemoteUrl parameter to FindRemoteRootRef'
+merge_request: 3412
+author:
+type: added
diff --git a/cmd/gitaly-hooks/hooks.go b/cmd/gitaly-hooks/hooks.go
index 980f0cf92..b83c995eb 100644
--- a/cmd/gitaly-hooks/hooks.go
+++ b/cmd/gitaly-hooks/hooks.go
@@ -62,19 +62,28 @@ var (
func main() {
logger = gitalylog.NewHookLogger()
- if len(os.Args) < 2 {
- logger.Fatalf("requires hook name. args: %v", os.Args)
+ returnCode, err := run(os.Args)
+ if err != nil {
+ logger.Fatalf("%s", err)
}
- subCmd := os.Args[1]
+ os.Exit(returnCode)
+}
+
+func run(args []string) (int, error) {
+ if len(args) < 2 {
+ return 0, fmt.Errorf("requires hook name. args: %v", args)
+ }
+
+ subCmd := args[1]
if subCmd == "check" {
logrus.SetLevel(logrus.ErrorLevel)
- if len(os.Args) != 3 {
+ if len(args) != 3 {
log.Fatal(errors.New("no configuration file path provided invoke with: gitaly-hooks check <config_path>"))
}
- configPath := os.Args[2]
+ configPath := args[2]
fmt.Print("Checking GitLab API access: ")
info, err := check(configPath)
@@ -89,7 +98,8 @@ func main() {
fmt.Printf("GitLab Api version: %s\n", info.APIVersion)
fmt.Printf("Redis reachable for GitLab: %t\n", info.RedisReachable)
fmt.Println("OK")
- os.Exit(0)
+
+ return 0, nil
}
ctx, cancel := context.WithCancel(context.Background())
@@ -103,33 +113,35 @@ func main() {
payload, err := git.HooksPayloadFromEnv(os.Environ())
if err != nil {
- logger.Fatalf("error when getting hooks payload: %v", err)
+ return 0, fmt.Errorf("error when getting hooks payload: %v", err)
}
hookCommand, ok := hooksBySubcommand[subCmd]
if !ok {
- logger.Fatalf("subcommand name invalid: %q", subCmd)
+ return 0, fmt.Errorf("subcommand name invalid: %q", subCmd)
}
// If the hook wasn't requested, then we simply skip executing any
// logic.
if !payload.IsHookRequested(hookCommand.hookType) {
- os.Exit(0)
+ return 0, nil
}
conn, err := dialGitaly(payload)
if err != nil {
- logger.Fatalf("error when connecting to gitaly: %v", err)
+ return 0, fmt.Errorf("error when connecting to gitaly: %v", err)
}
+ defer conn.Close()
+
hookClient := gitalypb.NewHookServiceClient(conn)
ctx = featureflag.OutgoingWithRaw(ctx, payload.FeatureFlags)
- returnCode, err := hookCommand.exec(ctx, payload, hookClient, os.Args)
+ returnCode, err := hookCommand.exec(ctx, payload, hookClient, args)
if err != nil {
- logger.Fatal(err)
+ return 0, err
}
- os.Exit(returnCode)
+ return returnCode, nil
}
func noopSender(c chan error) {}
diff --git a/internal/cache/cachedb_test.go b/internal/cache/cachedb_test.go
index 2be2d70f8..c9d4f4a22 100644
--- a/internal/cache/cachedb_test.go
+++ b/internal/cache/cachedb_test.go
@@ -4,7 +4,6 @@ import (
"context"
"io"
"io/ioutil"
- "os"
"strings"
"sync"
"testing"
@@ -20,17 +19,6 @@ import (
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
-func TestMain(m *testing.M) {
- os.Exit(testMain(m))
-}
-
-func testMain(m *testing.M) int {
- defer testhelper.MustHaveNoChildProcess()
- cleanup := testhelper.Configure()
- defer cleanup()
- return m.Run()
-}
-
func TestStreamDBNaiveKeyer(t *testing.T) {
cfg := testcfg.Build(t)
diff --git a/internal/cache/testhelper_test.go b/internal/cache/testhelper_test.go
new file mode 100644
index 000000000..a5dfb2e41
--- /dev/null
+++ b/internal/cache/testhelper_test.go
@@ -0,0 +1,19 @@
+package cache_test
+
+import (
+ "os"
+ "testing"
+
+ "gitlab.com/gitlab-org/gitaly/internal/testhelper"
+)
+
+func TestMain(m *testing.M) {
+ os.Exit(testMain(m))
+}
+
+func testMain(m *testing.M) int {
+ defer testhelper.MustHaveNoChildProcess()
+ cleanup := testhelper.Configure()
+ defer cleanup()
+ return m.Run()
+}
diff --git a/internal/cache/walker_test.go b/internal/cache/walker_test.go
index 1c7139ba0..3af0f7c67 100644
--- a/internal/cache/walker_test.go
+++ b/internal/cache/walker_test.go
@@ -70,6 +70,11 @@ func TestDiskCacheObjectWalker(t *testing.T) {
}
func TestDiskCacheInitialClear(t *testing.T) {
+ // disable the background walkers since we are only
+ // evaluating the initial move-and-clear function
+ *cache.ExportDisableWalker = true
+ defer func() { *cache.ExportDisableWalker = false }()
+
cfg := testcfg.Build(t)
cacheDir := tempdir.CacheDir(cfg.Storages[0])
@@ -78,11 +83,6 @@ func TestDiskCacheInitialClear(t *testing.T) {
require.NoError(t, os.MkdirAll(filepath.Dir(canary), 0755))
require.NoError(t, ioutil.WriteFile(canary, []byte("chirp chirp"), 0755))
- // disable the background walkers since we are only
- // evaluating the initial move-and-clear function
- *cache.ExportDisableWalker = true
- defer func() { *cache.ExportDisableWalker = false }()
-
// validation will run cache walker hook which synchronously
// runs the move-and-clear function
require.NoError(t, cfg.Validate())
diff --git a/internal/gitaly/service/operations/rebase_test.go b/internal/gitaly/service/operations/rebase_test.go
index abe28c079..7724acefb 100644
--- a/internal/gitaly/service/operations/rebase_test.go
+++ b/internal/gitaly/service/operations/rebase_test.go
@@ -5,6 +5,7 @@ package operations
import (
"context"
"fmt"
+ "io"
"strings"
"testing"
"time"
@@ -69,10 +70,8 @@ func testSuccessfulUserRebaseConfirmableRequestFeatured(t *testing.T, ctx contex
secondResponse, err := rebaseStream.Recv()
require.NoError(t, err, "receive second response")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
newBranchSha := getBranchSha(t, repoPath, rebaseBranchName)
@@ -175,11 +174,9 @@ func testUserRebaseConfirmableTransactionFeatured(t *testing.T, ctx context.Cont
require.NoError(t, err)
require.True(t, secondResponse.GetRebaseApplied(), "the second rebase is applied")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- response, err := rebaseStream.Recv()
- require.Nil(t, response)
- return err
- })
+ response, err := rebaseStream.Recv()
+ require.Nil(t, response)
+ require.Equal(t, io.EOF, err)
require.Equal(t, tc.expectedVotes, voteCount)
if tc.expectPreReceiveHook {
@@ -233,10 +230,8 @@ func testUserRebaseConfirmableStableCommitIDsFeatured(t *testing.T, ctx context.
require.NoError(t, err, "receive second response")
require.True(t, response.GetRebaseApplied())
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
commit, err := repo.ReadCommit(ctx, git.Revision(rebaseBranchName))
require.NoError(t, err, "look up git commit")
@@ -465,10 +460,8 @@ func testFailedUserRebaseConfirmableRequestDueToPreReceiveErrorFeatured(t *testi
require.NoError(t, err, "receive second response")
require.Contains(t, secondResponse.PreReceiveError, "failure")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
newBranchSha := getBranchSha(t, repoPath, rebaseBranchName)
require.Equal(t, branchSha, newBranchSha, "branch should not change when the rebase fails due to PreReceiveError")
@@ -500,10 +493,8 @@ func testFailedUserRebaseConfirmableDueToGitErrorFeatured(t *testing.T, ctx cont
require.NoError(t, err, "receive first response")
require.Contains(t, firstResponse.GitError, "conflict")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
newBranchSha := getBranchSha(t, repoPath, failedBranchName)
require.Equal(t, branchSha, newBranchSha, "branch should not change when the rebase fails due to GitError")
@@ -556,10 +547,8 @@ func testRebaseRequestWithDeletedFileFeatured(t *testing.T, ctx context.Context,
secondResponse, err := rebaseStream.Recv()
require.NoError(t, err, "receive second response")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
newBranchSha := getBranchSha(t, repoPath, branch)
@@ -613,10 +602,8 @@ func testRebaseOntoRemoteBranchFeatured(t *testing.T, ctx context.Context, cfg c
secondResponse, err := rebaseStream.Recv()
require.NoError(t, err, "receive second response")
- testhelper.ReceiveEOFWithTimeout(t, func() error {
- _, err = rebaseStream.Recv()
- return err
- })
+ _, err = rebaseStream.Recv()
+ require.Equal(t, io.EOF, err)
rebasedBranchHash := getBranchSha(t, repoPath, localBranch)
diff --git a/internal/gitaly/service/remote/find_remote_root_ref.go b/internal/gitaly/service/remote/find_remote_root_ref.go
index 374c483d9..7474751d4 100644
--- a/internal/gitaly/service/remote/find_remote_root_ref.go
+++ b/internal/gitaly/service/remote/find_remote_root_ref.go
@@ -3,9 +3,11 @@ package remote
import (
"bufio"
"context"
+ "fmt"
"strings"
"gitlab.com/gitlab-org/gitaly/internal/git"
+ "gitlab.com/gitlab-org/gitaly/internal/helper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -13,14 +15,32 @@ import (
const headPrefix = "HEAD branch: "
-func (s *server) findRemoteRootRef(ctx context.Context, repo *gitalypb.Repository, remote string) (string, error) {
- cmd, err := s.gitCmdFactory.New(ctx, repo,
+func (s *server) findRemoteRootRef(ctx context.Context, request *gitalypb.FindRemoteRootRefRequest) (string, error) {
+ remoteName := request.Remote
+ var config []git.ConfigPair
+
+ if request.RemoteUrl != "" {
+ remoteName = "inmemory"
+ config = []git.ConfigPair{
+ {Key: "remote.inmemory.url", Value: request.RemoteUrl},
+ }
+
+ if authHeader := request.GetHttpAuthorizationHeader(); authHeader != "" {
+ config = append(config, git.ConfigPair{
+ Key: fmt.Sprintf("http.%s.extraHeader", request.RemoteUrl),
+ Value: "Authorization: " + authHeader,
+ })
+ }
+ }
+
+ cmd, err := s.gitCmdFactory.New(ctx, request.Repository,
git.SubSubCmd{
Name: "remote",
Action: "show",
- Args: []string{remote},
+ Args: []string{remoteName},
},
- git.WithRefTxHook(ctx, repo, s.cfg),
+ git.WithRefTxHook(ctx, request.Repository, s.cfg),
+ git.WithConfigEnv(config...),
)
if err != nil {
return "", err
@@ -31,7 +51,11 @@ func (s *server) findRemoteRootRef(ctx context.Context, repo *gitalypb.Repositor
line := strings.TrimSpace(scanner.Text())
if strings.HasPrefix(line, headPrefix) {
- return strings.TrimPrefix(line, headPrefix), nil
+ rootRef := strings.TrimPrefix(line, headPrefix)
+ if rootRef == "(unknown)" {
+ return "", status.Error(codes.NotFound, "no remote HEAD found")
+ }
+ return rootRef, nil
}
}
@@ -48,18 +72,21 @@ func (s *server) findRemoteRootRef(ctx context.Context, repo *gitalypb.Repositor
// FindRemoteRootRef queries the remote to determine its HEAD
func (s *server) FindRemoteRootRef(ctx context.Context, in *gitalypb.FindRemoteRootRefRequest) (*gitalypb.FindRemoteRootRefResponse, error) {
- remote := in.GetRemote()
- if remote == "" {
- return nil, status.Error(codes.InvalidArgument, "empty remote can't be queried")
+ //nolint:staticcheck // GetRemote() is deprecated
+ if in.GetRemote() == "" && in.GetRemoteUrl() == "" {
+ return nil, status.Error(codes.InvalidArgument, "got neither remote name nor URL")
+ }
+ //nolint:staticcheck // GetRemote() is deprecated
+ if in.GetRemote() != "" && in.GetRemoteUrl() != "" {
+ return nil, status.Error(codes.InvalidArgument, "got remote name and URL")
+ }
+ if in.Repository == nil {
+ return nil, status.Error(codes.InvalidArgument, "missing repository")
}
- ref, err := s.findRemoteRootRef(ctx, in.GetRepository(), remote)
+ ref, err := s.findRemoteRootRef(ctx, in)
if err != nil {
- if _, ok := status.FromError(err); ok {
- return nil, err
- }
-
- return nil, status.Errorf(codes.Internal, err.Error())
+ return nil, helper.ErrInternal(err)
}
return &gitalypb.FindRemoteRootRefResponse{Ref: ref}, nil
diff --git a/internal/gitaly/service/remote/find_remote_root_ref_test.go b/internal/gitaly/service/remote/find_remote_root_ref_test.go
index 47161233b..c30fccb53 100644
--- a/internal/gitaly/service/remote/find_remote_root_ref_test.go
+++ b/internal/gitaly/service/remote/find_remote_root_ref_test.go
@@ -4,21 +4,76 @@ import (
"testing"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/internal/git/gittest"
+ "gitlab.com/gitlab-org/gitaly/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
)
func TestFindRemoteRootRefSuccess(t *testing.T) {
- _, repo, _, client := setupRemoteService(t)
+ _, repo, repoPath, client := setupRemoteService(t)
+
+ originURL := text.ChompBytes(testhelper.MustRunCommand(t, nil,
+ "git", "-C", repoPath, "remote", "get-url", "origin"))
+
+ for _, tc := range []struct {
+ desc string
+ request *gitalypb.FindRemoteRootRefRequest
+ }{
+ {
+ desc: "with remote name",
+ request: &gitalypb.FindRemoteRootRefRequest{Repository: repo, Remote: "origin"},
+ },
+ {
+ desc: "with remote URL",
+ request: &gitalypb.FindRemoteRootRefRequest{Repository: repo, RemoteUrl: originURL},
+ },
+ {
+ // Unfortunately, we do not really have a nice way to verify we actually got
+ // the auth header. So this test case only really verifies that it doesn't
+ // break the world to set up one.
+ desc: "with remote URL and auth header",
+ request: &gitalypb.FindRemoteRootRefRequest{
+ Repository: repo,
+ RemoteUrl: originURL,
+ HttpAuthorizationHeader: "mysecret",
+ },
+ },
+ } {
+ t.Run(tc.desc, func(t *testing.T) {
+ ctx, cancel := testhelper.Context()
+ defer cancel()
- request := &gitalypb.FindRemoteRootRefRequest{Repository: repo, Remote: "origin"}
- testCtx, cancelCtx := testhelper.Context()
- defer cancelCtx()
+ response, err := client.FindRemoteRootRef(ctx, tc.request)
+ require.NoError(t, err)
+ require.Equal(t, "master", response.Ref)
+ })
+ }
+}
+
+func TestFindRemoteRootRefWithUnbornRemoteHead(t *testing.T) {
+ cfg, remoteRepo, remoteRepoPath, client := setupRemoteService(t)
- response, err := client.FindRemoteRootRef(testCtx, request)
- require.NoError(t, err)
- require.Equal(t, "master", response.Ref)
+ // We're creating an empty repository. Empty repositories do have a HEAD set up, but they
+ // point to an unborn branch because the default branch hasn't yet been created.
+ _, clientRepoPath, cleanup := gittest.InitBareRepoAt(t, cfg.Storages[0])
+ defer cleanup()
+ testhelper.MustRunCommand(t, nil, "git", "-C", remoteRepoPath, "remote", "add",
+ "foo", "file://"+clientRepoPath)
+
+ ctx, cancel := testhelper.Context()
+ defer cancel()
+
+ for _, request := range []*gitalypb.FindRemoteRootRefRequest{
+ &gitalypb.FindRemoteRootRefRequest{Repository: remoteRepo, Remote: "foo"},
+ &gitalypb.FindRemoteRootRefRequest{Repository: remoteRepo, RemoteUrl: "file://" + clientRepoPath},
+ } {
+ response, err := client.FindRemoteRootRef(ctx, request)
+ require.Equal(t, status.Error(codes.NotFound, "no remote HEAD found"), err)
+ require.Nil(t, response)
+ }
}
func TestFindRemoteRootRefFailedDueToValidation(t *testing.T) {
@@ -27,48 +82,92 @@ func TestFindRemoteRootRefFailedDueToValidation(t *testing.T) {
invalidRepo := &gitalypb.Repository{StorageName: "fake", RelativePath: "path"}
testCases := []struct {
- desc string
- request *gitalypb.FindRemoteRootRefRequest
- code codes.Code
+ desc string
+ request *gitalypb.FindRemoteRootRefRequest
+ expectedErr []error
}{
{
- desc: "Invalid repository",
- request: &gitalypb.FindRemoteRootRefRequest{Repository: invalidRepo},
- code: codes.InvalidArgument,
+ desc: "Invalid repository",
+ request: &gitalypb.FindRemoteRootRefRequest{
+ Repository: invalidRepo,
+ Remote: "remote-name",
+ },
+ expectedErr: []error{
+ status.Error(codes.InvalidArgument, "GetStorageByName: no such storage: \"fake\""),
+ status.Error(codes.InvalidArgument, "repo scoped: invalid Repository"),
+ },
},
{
- desc: "Repository is nil",
- request: &gitalypb.FindRemoteRootRefRequest{},
- code: codes.InvalidArgument,
+ desc: "Repository is nil",
+ request: &gitalypb.FindRemoteRootRefRequest{
+ Remote: "remote-name",
+ },
+ expectedErr: []error{
+ status.Error(codes.InvalidArgument, "missing repository"),
+ status.Error(codes.InvalidArgument, "repo scoped: empty Repository"),
+ },
},
{
- desc: "Remote is nil",
- request: &gitalypb.FindRemoteRootRefRequest{Repository: repo},
- code: codes.InvalidArgument,
+ desc: "Remote name and URL is empty",
+ request: &gitalypb.FindRemoteRootRefRequest{
+ Repository: repo,
+ },
+ expectedErr: []error{
+ status.Error(codes.InvalidArgument, "got neither remote name nor URL"),
+ },
},
{
- desc: "Remote is empty",
- request: &gitalypb.FindRemoteRootRefRequest{Repository: repo, Remote: ""},
- code: codes.InvalidArgument,
+ desc: "Remote name and URL is set",
+ request: &gitalypb.FindRemoteRootRefRequest{
+ Repository: repo,
+ Remote: "remote-name",
+ RemoteUrl: "remote-url",
+ },
+ expectedErr: []error{
+ status.Error(codes.InvalidArgument, "got remote name and URL"),
+ },
},
}
for _, testCase := range testCases {
- testCtx, cancelCtx := testhelper.Context()
- defer cancelCtx()
+ t.Run(testCase.desc, func(t *testing.T) {
+ ctx, cancel := testhelper.Context()
+ defer cancel()
- _, err := client.FindRemoteRootRef(testCtx, testCase.request)
- testhelper.RequireGrpcError(t, err, testCase.code)
+ _, err := client.FindRemoteRootRef(ctx, testCase.request)
+ // We cannot test for equality given that some errors depend on whether we
+ // proxy via Praefect or not. We thus simply assert that the actual error is
+ // one of the possible errors, which is the same as equality for all the
+ // other tests.
+ require.Contains(t, testCase.expectedErr, err)
+ })
}
}
func TestFindRemoteRootRefFailedDueToInvalidRemote(t *testing.T) {
_, repo, _, client := setupRemoteService(t)
- request := &gitalypb.FindRemoteRootRefRequest{Repository: repo, Remote: "invalid"}
- testCtx, cancelCtx := testhelper.Context()
- defer cancelCtx()
+ t.Run("invalid remote name", func(t *testing.T) {
+ request := &gitalypb.FindRemoteRootRefRequest{Repository: repo, Remote: "invalid"}
+ ctx, cancel := testhelper.Context()
+ defer cancel()
+
+ _, err := client.FindRemoteRootRef(ctx, request)
+ testhelper.RequireGrpcError(t, err, codes.Internal)
+ })
+
+ t.Run("invalid remote URL", func(t *testing.T) {
+ fakeRepoDir := testhelper.TempDir(t)
+
+ // We're using a nonexistent filepath remote URL so we avoid hitting the internet.
+ request := &gitalypb.FindRemoteRootRefRequest{
+ Repository: repo, RemoteUrl: "file://" + fakeRepoDir,
+ }
+
+ ctx, cancel := testhelper.Context()
+ defer cancel()
- _, err := client.FindRemoteRootRef(testCtx, request)
- testhelper.RequireGrpcError(t, err, codes.Internal)
+ _, err := client.FindRemoteRootRef(ctx, request)
+ testhelper.RequireGrpcError(t, err, codes.Internal)
+ })
}
diff --git a/proto/go/gitalypb/remote.pb.go b/proto/go/gitalypb/remote.pb.go
index fc5e43ff9..23ae90fe1 100644
--- a/proto/go/gitalypb/remote.pb.go
+++ b/proto/go/gitalypb/remote.pb.go
@@ -514,12 +514,25 @@ func (m *FindRemoteRepositoryResponse) GetExists() bool {
return false
}
+// FindRemoteRootRefRequest represents a request for the FindRemoteRootRef RPC.
type FindRemoteRootRefRequest struct {
- Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"`
- Remote string `protobuf:"bytes,2,opt,name=remote,proto3" json:"remote,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
+ // Repository is the repository in which the request shall be executed in. If
+ // a remote name is given, then this is the repository in which the remote
+ // will be looked up.
+ Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"`
+ // Remote is the name of the remote of which the root reference shall be
+ // looked up. The remote must have been created before this call. This
+ // parameter is deprecated in favor of `RemoteUrl`, see
+ // https://gitlab.com/gitlab-org/gitaly/-/issues/1773.
+ Remote string `protobuf:"bytes,2,opt,name=remote,proto3" json:"remote,omitempty"` // Deprecated: Do not use.
+ // RemoteUrl specifies the remote repository URL which should be fetched from.
+ RemoteUrl string `protobuf:"bytes,3,opt,name=remote_url,json=remoteUrl,proto3" json:"remote_url,omitempty"`
+ // HttpAuthorizationHeader is the HTTP header which should be added to the
+ // request in order to authenticate against the repository.
+ HttpAuthorizationHeader string `protobuf:"bytes,4,opt,name=http_authorization_header,json=httpAuthorizationHeader,proto3" json:"http_authorization_header,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
}
func (m *FindRemoteRootRefRequest) Reset() { *m = FindRemoteRootRefRequest{} }
@@ -554,6 +567,7 @@ func (m *FindRemoteRootRefRequest) GetRepository() *Repository {
return nil
}
+// Deprecated: Do not use.
func (m *FindRemoteRootRefRequest) GetRemote() string {
if m != nil {
return m.Remote
@@ -561,7 +575,24 @@ func (m *FindRemoteRootRefRequest) GetRemote() string {
return ""
}
+func (m *FindRemoteRootRefRequest) GetRemoteUrl() string {
+ if m != nil {
+ return m.RemoteUrl
+ }
+ return ""
+}
+
+func (m *FindRemoteRootRefRequest) GetHttpAuthorizationHeader() string {
+ if m != nil {
+ return m.HttpAuthorizationHeader
+ }
+ return ""
+}
+
+// FindRemoteRootRefResponse represents the response for the FindRemoteRootRef
+// request.
type FindRemoteRootRefResponse struct {
+ // Ref is the name of the remote root reference.
Ref string `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -754,56 +785,59 @@ func init() {
func init() { proto.RegisterFile("remote.proto", fileDescriptor_eefc82927d57d89b) }
var fileDescriptor_eefc82927d57d89b = []byte{
- // 779 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6f, 0xd3, 0x4c,
- 0x10, 0x96, 0x1d, 0x37, 0x1f, 0x93, 0xb4, 0x4a, 0x36, 0x55, 0x5f, 0xc7, 0xa9, 0xf4, 0xa6, 0x86,
- 0x8a, 0x1c, 0x68, 0x82, 0xca, 0x87, 0x38, 0x20, 0x21, 0x02, 0xaa, 0xca, 0x47, 0x2b, 0x61, 0xe8,
- 0x85, 0x03, 0xc6, 0x49, 0x36, 0x89, 0x15, 0xc7, 0x6b, 0x76, 0x9d, 0x42, 0x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, 0xfa, 0x50, 0xb8, 0x8f, 0xca,
+ 0xc1, 0x3d, 0x4a, 0x0c, 0xe8, 0xf6, 0x63, 0x47, 0x8f, 0x37, 0x67, 0x0f, 0x8e, 0x46, 0xd7, 0x3b,
+ 0xe6, 0xb2, 0x13, 0xc4, 0xec, 0x1b, 0x68, 0x01, 0x67, 0x65, 0xcf, 0x15, 0x6d, 0xcb, 0x3f, 0x3c,
+ 0x2c, 0xdc, 0x37, 0x8f, 0x3b, 0xe9, 0x60, 0xf6, 0xcd, 0x75, 0xdf, 0xb2, 0xcd, 0xa6, 0x89, 0x7e,
+ 0x80, 0xd6, 0xad, 0x57, 0x81, 0x7a, 0x25, 0x24, 0x3b, 0xaf, 0xdf, 0x7d, 0x7c, 0xc4, 0x63, 0xb7,
+ 0xa0, 0xd1, 0x3b, 0xdf, 0x09, 0xdf, 0x24, 0x1c, 0x0f, 0x26, 0x64, 0x39, 0x54, 0xcb, 0xa7, 0x84,
+ 0xce, 0x87, 0x8a, 0x61, 0x28, 0xff, 0x43, 0x86, 0x73, 0xa2, 0xf7, 0xd9, 0x78, 0x5c, 0x95, 0xa6,
+ 0x77, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xbe, 0xfc, 0x7f, 0x70, 0xcc, 0x08, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -828,6 +862,11 @@ type RemoteServiceClient interface {
// the patterns specified in the requests.
UpdateRemoteMirror(ctx context.Context, opts ...grpc.CallOption) (RemoteService_UpdateRemoteMirrorClient, error)
FindRemoteRepository(ctx context.Context, in *FindRemoteRepositoryRequest, opts ...grpc.CallOption) (*FindRemoteRepositoryResponse, error)
+ // FindRemoteRootRef tries to find the root reference of a remote
+ // repository. The root reference is the default branch as pointed to by
+ // the remotes HEAD reference. Returns an InvalidArgument error if the
+ // specified remote does not exist and a NotFound error in case no HEAD
+ // branch was found.
FindRemoteRootRef(ctx context.Context, in *FindRemoteRootRefRequest, opts ...grpc.CallOption) (*FindRemoteRootRefResponse, error)
}
@@ -930,6 +969,11 @@ type RemoteServiceServer interface {
// the patterns specified in the requests.
UpdateRemoteMirror(RemoteService_UpdateRemoteMirrorServer) error
FindRemoteRepository(context.Context, *FindRemoteRepositoryRequest) (*FindRemoteRepositoryResponse, error)
+ // FindRemoteRootRef tries to find the root reference of a remote
+ // repository. The root reference is the default branch as pointed to by
+ // the remotes HEAD reference. Returns an InvalidArgument error if the
+ // specified remote does not exist and a NotFound error in case no HEAD
+ // branch was found.
FindRemoteRootRef(context.Context, *FindRemoteRootRefRequest) (*FindRemoteRootRefResponse, error)
}
diff --git a/proto/remote.proto b/proto/remote.proto
index c228e3880..d427accef 100644
--- a/proto/remote.proto
+++ b/proto/remote.proto
@@ -40,6 +40,12 @@ service RemoteService {
scope_level: STORAGE
};
}
+
+ // FindRemoteRootRef tries to find the root reference of a remote
+ // repository. The root reference is the default branch as pointed to by
+ // the remotes HEAD reference. Returns an InvalidArgument error if the
+ // specified remote does not exist and a NotFound error in case no HEAD
+ // branch was found.
rpc FindRemoteRootRef(FindRemoteRootRefRequest) returns (FindRemoteRootRefResponse) {
option (op_type) = {
op: ACCESSOR
@@ -119,12 +125,28 @@ message FindRemoteRepositoryResponse {
bool exists = 1;
}
+// FindRemoteRootRefRequest represents a request for the FindRemoteRootRef RPC.
message FindRemoteRootRefRequest {
+ // Repository is the repository in which the request shall be executed in. If
+ // a remote name is given, then this is the repository in which the remote
+ // will be looked up.
Repository repository = 1 [(target_repository)=true];
- string remote = 2;
+ // Remote is the name of the remote of which the root reference shall be
+ // looked up. The remote must have been created before this call. This
+ // parameter is deprecated in favor of `RemoteUrl`, see
+ // https://gitlab.com/gitlab-org/gitaly/-/issues/1773.
+ string remote = 2 [deprecated=true];
+ // RemoteUrl specifies the remote repository URL which should be fetched from.
+ string remote_url = 3;
+ // HttpAuthorizationHeader is the HTTP header which should be added to the
+ // request in order to authenticate against the repository.
+ string http_authorization_header = 4;
}
+// FindRemoteRootRefResponse represents the response for the FindRemoteRootRef
+// request.
message FindRemoteRootRefResponse {
+ // Ref is the name of the remote root reference.
string ref = 1;
}
diff --git a/ruby/proto/gitaly/remote_pb.rb b/ruby/proto/gitaly/remote_pb.rb
index bd5859965..722b34b0c 100644
--- a/ruby/proto/gitaly/remote_pb.rb
+++ b/ruby/proto/gitaly/remote_pb.rb
@@ -50,6 +50,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "gitaly.FindRemoteRootRefRequest" do
optional :repository, :message, 1, "gitaly.Repository"
optional :remote, :string, 2
+ optional :remote_url, :string, 3
+ optional :http_authorization_header, :string, 4
end
add_message "gitaly.FindRemoteRootRefResponse" do
optional :ref, :string, 1
diff --git a/ruby/proto/gitaly/remote_services_pb.rb b/ruby/proto/gitaly/remote_services_pb.rb
index 93959d0db..90c4abc25 100644
--- a/ruby/proto/gitaly/remote_services_pb.rb
+++ b/ruby/proto/gitaly/remote_services_pb.rb
@@ -24,6 +24,11 @@ module Gitaly
# the patterns specified in the requests.
rpc :UpdateRemoteMirror, stream(Gitaly::UpdateRemoteMirrorRequest), Gitaly::UpdateRemoteMirrorResponse
rpc :FindRemoteRepository, Gitaly::FindRemoteRepositoryRequest, Gitaly::FindRemoteRepositoryResponse
+ # FindRemoteRootRef tries to find the root reference of a remote
+ # repository. The root reference is the default branch as pointed to by
+ # the remotes HEAD reference. Returns an InvalidArgument error if the
+ # specified remote does not exist and a NotFound error in case no HEAD
+ # branch was found.
rpc :FindRemoteRootRef, Gitaly::FindRemoteRootRefRequest, Gitaly::FindRemoteRootRefResponse
end