Skip to content

Commit ce01ba5

Browse files
Igor DrozdovPatrick Cyiza
Igor Drozdov
and
Patrick Cyiza
committed
Merge branch '656-implement-proxy-fetch-direct-primary-ff' into 'main'
Implement geo_proxy_direct_to_primary feature flag See merge request https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/834 Merged-by: Igor Drozdov <[email protected]> Approved-by: Igor Drozdov <[email protected]> Co-authored-by: Patrick Cyiza <[email protected]>
2 parents 2115f79 + 8e44c7f commit ce01ba5

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

internal/gitlabnet/accessverifier/client.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ type Gitaly struct {
4040
}
4141

4242
type CustomPayloadData struct {
43-
ApiEndpoints []string `json:"api_endpoints"`
44-
Username string `json:"gl_username"`
45-
PrimaryRepo string `json:"primary_repo"`
46-
UserId string `json:"gl_id,omitempty"`
47-
RequestHeaders map[string]string `json:"request_headers"`
48-
GeoProxyDirectToPrimary bool `json:"geo_proxy_direct_to_primary"`
43+
ApiEndpoints []string `json:"api_endpoints"`
44+
Username string `json:"gl_username"`
45+
PrimaryRepo string `json:"primary_repo"`
46+
UserId string `json:"gl_id,omitempty"`
47+
RequestHeaders map[string]string `json:"request_headers"`
48+
GeoProxyDirectToPrimary bool `json:"geo_proxy_direct_to_primary"`
49+
GeoProxyFetchDirectToPrimary bool `json:"geo_proxy_fetch_direct_to_primary"`
4950
}
5051

5152
type CustomPayload struct {

internal/gitlabnet/accessverifier/client_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,11 @@ func TestGeoPullGetCustomAction(t *testing.T) {
136136
response.Payload = CustomPayload{
137137
Action: "geo_proxy_to_primary",
138138
Data: CustomPayloadData{
139-
ApiEndpoints: []string{"geo/proxy_git_ssh/info_refs_upload_pack", "geo/proxy_git_ssh/upload_pack"},
140-
Username: "custom",
141-
PrimaryRepo: "https://repo/path",
139+
ApiEndpoints: []string{"geo/proxy_git_ssh/info_refs_upload_pack", "geo/proxy_git_ssh/upload_pack"},
140+
Username: "custom",
141+
GeoProxyFetchDirectToPrimary: true,
142+
PrimaryRepo: "https://repo/path",
143+
RequestHeaders: map[string]string{"Authorization": "Bearer token"},
142144
},
143145
}
144146
response.StatusCode = 300

internal/testhelper/testdata/testroot/responses/allowed_with_pull_payload.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"geo/proxy_git_ssh/upload_pack"
3030
],
3131
"gl_username": "custom",
32-
"primary_repo": "https://repo/path"
32+
"primary_repo": "https://repo/path",
33+
"geo_proxy_fetch_direct_to_primary": true,
34+
"request_headers": { "Authorization": "Bearer token" }
3335
}
3436
},
3537
"git_protocol": "protocol",

0 commit comments

Comments
 (0)