As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit c1eeb524 authored by Jacob Vosmaer's avatar Jacob Vosmaer Committed by Igor Drozdov
Browse files

Support parsing `use_sidechannel` API response field

This field will act as a feature flag that controls whether
gitlab-shell uses the old SSHUploadPack RPC or the new
SSHUploadPackWithSidechannel.
parent 2cf1af8e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -32,10 +32,11 @@ type Request struct {
}
type Gitaly struct {
Repo pb.Repository `json:"repository"`
Address string `json:"address"`
Token string `json:"token"`
Features map[string]string `json:"features"`
Repo pb.Repository `json:"repository"`
Address string `json:"address"`
Token string `json:"token"`
Features map[string]string `json:"features"`
UseSidechannel bool `json:"use_sidechannel"`
}
type CustomPayloadData struct {
Loading
Loading
Loading
Loading
@@ -86,6 +86,41 @@ func TestSuccessfulResponses(t *testing.T) {
}
}
func TestSidechannelFlag(t *testing.T) {
okResponse := testResponse{body: responseBody(t, "allowed_sidechannel.json"), status: http.StatusOK}
client := setup(t,
map[string]testResponse{"first": okResponse},
map[string]testResponse{"1": okResponse},
)
testCases := []struct {
desc string
args *commandargs.Shell
who string
}{
{
desc: "Provide key id within the request",
args: &commandargs.Shell{GitlabKeyId: "1"},
who: "key-1",
}, {
desc: "Provide username within the request",
args: &commandargs.Shell{GitlabUsername: "first"},
who: "user-1",
},
}
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
result, err := client.Verify(context.Background(), tc.args, uploadPackAction, repo)
require.NoError(t, err)
response := buildExpectedResponse(tc.who)
response.Gitaly.UseSidechannel = true
require.Equal(t, response, result)
})
}
}
func TestGeoPushGetCustomAction(t *testing.T) {
client := setup(t, map[string]testResponse{
"custom": {
Loading
Loading
{
"status": true,
"gl_repository": "project-26",
"gl_project_path": "group/private",
"gl_id": "user-1",
"gl_username": "root",
"git_config_options": ["option"],
"gitaly": {
"repository": {
"storage_name": "default",
"relative_path": "@hashed/5f/9c/5f9c4ab08cac7457e9111a30e4664920607ea2c115a1433d7be98e97e64244ca.git",
"git_object_directory": "path/to/git_object_directory",
"git_alternate_object_directories": ["path/to/git_alternate_object_directory"],
"gl_repository": "project-26",
"gl_project_path": "group/private"
},
"address": "unix:gitaly.socket",
"token": "token",
"use_sidechannel": true
},
"git_protocol": "protocol",
"gl_console_messages": ["console", "message"]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment