diff options
author | Paul Okstad <pokstad@gitlab.com> | 2020-10-16 00:08:02 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2020-10-16 00:08:02 +0300 |
commit | bc64599cc1d21f382b9f6ed6c00d072d00073226 (patch) | |
tree | e3838095eac053733233ef0b86488bee59cf9264 | |
parent | f69d41ee5bdf9df48dd8a6cbd682544c8d42391f (diff) | |
parent | ff2e7c3e9c877080d434ea4d202ba84d5b73daaf (diff) |
Merge branch 'ps-gitaly-ssh-upload-pack' into 'master'
Doubled invocation of gitaly-ssh on upload pack cmd.
Closes #3047
See merge request gitlab-org/gitaly!2645
-rw-r--r-- | changelogs/unreleased/ps-gitaly-ssh-upload-pack.yml | 5 | ||||
-rw-r--r-- | internal/gitaly/service/remote/fetch_internal_remote_test.go | 13 | ||||
-rw-r--r-- | internal/gitalyssh/gitalyssh.go | 2 | ||||
-rw-r--r-- | internal/gitalyssh/gitalyssh_test.go | 1 |
4 files changed, 19 insertions, 2 deletions
diff --git a/changelogs/unreleased/ps-gitaly-ssh-upload-pack.yml b/changelogs/unreleased/ps-gitaly-ssh-upload-pack.yml new file mode 100644 index 000000000..24ae44f6c --- /dev/null +++ b/changelogs/unreleased/ps-gitaly-ssh-upload-pack.yml @@ -0,0 +1,5 @@ +--- +title: Doubled invocation of gitaly-ssh on upload pack cmd. +merge_request: 2645 +author: +type: fixed diff --git a/internal/gitaly/service/remote/fetch_internal_remote_test.go b/internal/gitaly/service/remote/fetch_internal_remote_test.go index 534bd694a..4247af94e 100644 --- a/internal/gitaly/service/remote/fetch_internal_remote_test.go +++ b/internal/gitaly/service/remote/fetch_internal_remote_test.go @@ -89,8 +89,17 @@ func TestSuccessfulFetchInternalRemote(t *testing.T) { ) gitalySSHInvocationParams := getGitalySSHInvocationParams() - // TODO: This should be fixed in scope of https://gitlab.com/gitlab-org/gitaly/-/issues/3047 - only single invocation should be done. - require.Len(t, gitalySSHInvocationParams, 2, "expected 2 calls of gitaly-ssh binary") + require.Len(t, gitalySSHInvocationParams, 1) + require.Equal(t, []string{"upload-pack", "gitaly", "git-upload-pack", "'/internal.git'\n"}, gitalySSHInvocationParams[0].Args) + require.Subset(t, + gitalySSHInvocationParams[0].EnvVars, + []string{ + "GIT_TERMINAL_PROMPT=0", + "GIT_SSH_VARIANT=simple", + "LANG=en_US.UTF-8", + "GITALY_ADDRESS=unix://" + gitaly0Server.Socket(), + }, + ) } func TestFailedFetchInternalRemote(t *testing.T) { diff --git a/internal/gitalyssh/gitalyssh.go b/internal/gitalyssh/gitalyssh.go index 249c8ed9a..bc533f52e 100644 --- a/internal/gitalyssh/gitalyssh.go +++ b/internal/gitalyssh/gitalyssh.go @@ -65,6 +65,8 @@ func commandEnv(ctx context.Context, storageName, command string, message proto. fmt.Sprintf("GITALY_TOKEN=%s", storageInfo.Token), fmt.Sprintf("GITALY_FEATUREFLAGS=%s", strings.Join(featureFlagPairs, ",")), fmt.Sprintf("CORRELATION_ID=%s", getCorrelationID(ctx)), + // please see https://github.com/git/git/commit/0da0e49ba12225684b75e86a4c9344ad121652cb for mote details + "GIT_SSH_VARIANT=simple", // Pass through the SSL_CERT_* variables that indicate which // system certs to trust fmt.Sprintf("%s=%s", gitaly_x509.SSLCertDir, os.Getenv(gitaly_x509.SSLCertDir)), diff --git a/internal/gitalyssh/gitalyssh_test.go b/internal/gitalyssh/gitalyssh_test.go index f6e3bf045..22753ec2f 100644 --- a/internal/gitalyssh/gitalyssh_test.go +++ b/internal/gitalyssh/gitalyssh_test.go @@ -42,6 +42,7 @@ func TestUploadPackEnv(t *testing.T) { fmt.Sprintf("GIT_SSH_COMMAND=%s upload-pack", filepath.Join(config.Config.BinDir, "gitaly-ssh")), fmt.Sprintf("GITALY_PAYLOAD=%s", expectedPayload), "CORRELATION_ID=correlation-id-1", + "GIT_SSH_VARIANT=simple", }) } |