diff options
Diffstat (limited to 'workhorse')
120 files changed, 749 insertions, 2207 deletions
diff --git a/workhorse/.gitlab-ci.yml b/workhorse/.gitlab-ci.yml deleted file mode 100644 index 60d51b868b7..00000000000 --- a/workhorse/.gitlab-ci.yml +++ /dev/null @@ -1,83 +0,0 @@ -workflow: - rules: &workflow_rules - # For merge requests, create a pipeline. - - if: '$CI_MERGE_REQUEST_IID' - # For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.). - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - # For tags, create a pipeline. - - if: '$CI_COMMIT_TAG' - # For stable branches, create a pipeline. - - if: '$CI_COMMIT_BRANCH =~ /^[\d-]+-stable$/' - -default: - image: golang:1.16 - tags: - - gitlab-org - -# Disable DIND for SAST because we need to execute a before_script in the gosec-sast job -variables: - SAST_DISABLE_DIND: "true" - -verify: - script: - - make verify - -changelog: - script: - - _support/check_changelog.sh - rules: - - if: '$CI_MERGE_REQUEST_IID' - -.test: - services: - - name: registry.gitlab.com/gitlab-org/build/cng/gitaly:latest - # Disable the hooks so we don't have to stub the GitLab API - command: ["/usr/bin/env", "GITALY_TESTING_NO_GIT_HOOKS=1", "/scripts/process-wrapper"] - alias: gitaly - variables: - GITALY_ADDRESS: "tcp://gitaly:8075" - script: - - go version - - apt-get update && apt-get -y install libimage-exiftool-perl - - make test - -test using go 1.15: - extends: .test - image: golang:1.15 - -test using go 1.16: - extends: .test - image: golang:1.16 - -test:release: - rules: - - if: '$CI_COMMIT_TAG' - script: - - git describe --exact-match - -include: - - template: Security/SAST.gitlab-ci.yml - - template: Security/Dependency-Scanning.gitlab-ci.yml - - template: Security/Secret-Detection.gitlab-ci.yml - -gosec-sast: - before_script: - - apk add make - - make install - rules: *workflow_rules - -gemnasium-dependency_scanning: - rules: *workflow_rules - -secret_detection: - rules: *workflow_rules - -code_navigation: - image: golang:latest - allow_failure: true - script: - - go get github.com/sourcegraph/lsif-go/cmd/lsif-go - - lsif-go - artifacts: - reports: - lsif: dump.lsif diff --git a/workhorse/.gitlab/CODEOWNERS b/workhorse/.gitlab/CODEOWNERS deleted file mode 100644 index 93ee023ee4a..00000000000 --- a/workhorse/.gitlab/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @jacobvosmaer-gitlab @nick.thomas @nolith @patrickbajao diff --git a/workhorse/CHANGELOG b/workhorse/CHANGELOG deleted file mode 100644 index b742affae07..00000000000 --- a/workhorse/CHANGELOG +++ /dev/null @@ -1,1137 +0,0 @@ -# Changelog for gitlab-workhorse - -## v8.65.0 - -### Fixed -- Fix long polling to default to 50 s instead of 50 ns - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/687 - -### Security -- Use URL.EscapePath() in upstream router - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -## v8.64.0 - -### Other -- Revert "Migrate to labkit error tracking" - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/685 - -## v8.63.0 - -### Added -- Accept more paths as Git HTTP - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/684 - -### Other -- Migrate error tracking from raven to labkit - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/671 - -## v8.62.0 - -### Added -- Add RubyGems registry upload route - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/680 - -### Fixed -- Cleanup Connection headers - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/678 - -## v8.61.0 - -### Fixed -- Revert "Support Git HTTP on toplevel repositories" - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/681 - -## v8.60.0 - -### Added -- Support Git HTTP on toplevel repositories - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/670 -- Update GoCloud to v0.21.1+ - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/675 - -### Changed -- Allow blank S3 regions to be used - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/677 - -## v8.59.0 - -### Fixed -- Image scaling: strip out iCCP chunks in PNG files - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/673 - -### Other -- Extract logging concerns into a separate module - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -### Security -- Reject unknown http methods - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -## v8.58.0 - -### Added -- Support alternate document root directory - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/626 - -### Fixed -- Fix uploader not returning 413 when artifact too large - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/663 -- Auto-register Prometheus metrics - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/660 - -### Other -- Do not resize when image is less than 8 bytes - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/666 - -## v8.57.0 - -### Added -- Add direct upload acceleration for requirements import - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -## v8.56.0 - -### Fixed -- Return 413 HTTP status for S3 uploads if max upload limit is reached - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/655 -- Fix EXIF cleaning for S3 compatible Object Storage - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -### Other -- Improve logging for image scaler - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/652 -- Update LabKit to v1.0.0 - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/659 - -## v8.55.0 - -### Added -- Add direct upload acceleration for metric images - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/653 - -### Fixed -- Image scaler: add success-client-cache status label - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/656 - -## v8.54.0 - -### Changed -- Don't reject image scaling requests based on file extension/format mismatch - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/651 - -### Other -- Rework image scaler test suite - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ -- Adjust image scaling latency buckets - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/643 -- Update raven-go and gocertifi packages - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/644 -- jaeger: limit operation cardinality by using route regex - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/648 - -### Performance -- Add support for conditional GETs for rescaled images - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/647 - -## v8.53.0 - -### Added -- Add route for Debian package uploads - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/610 - Contributed by Mathieu Parent - -### Fixed -- Don't log image scaler fail-overs as successes - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/636 - -### Other -- Exclude dot-files from "make fmt" target - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/641 -- Add max_processes Prometheus metric for image scaling - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/640 -- Simplify config handling in main() - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/634 -- Default MaxScalerProcs to num_cores / 2 - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/635 -- Add a total requests metric for image scaling - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/638 - -## v8.52.0 - -### Fixed -- Only generate CI artifact metadata for ZIP files - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/627 -- Fix typo in redis URL scheme - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/631 -- Restructure error handling in main() - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/633 - -### Other -- Include route regex identifier in structured logs - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/624 - -## v8.51.0 - -### Changed -- Allow configure image resizing params - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/615 - -### Fixed -- Fix processing lsif dump with repeating lines with inVs - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/621 - Contributed by Pavel Kuznetsov - -### Other -- Add CODEOWNERS with listed maintainers - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/623 - -## v8.50.0 - -### Added -- Update Gitaly module dependency - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/619 - -## v8.49.0 - -### Fixed -- Fix gitlab-resize-image bin installation - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/618 - -### Other -- Add image scaler duration histogram - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/614 -- Pass CORRELATION_ID env variable to resize image subprocesses - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/612 -- Simplify s3 session management code - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/616 -- Bump labkit dependency to get mutex profiling - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -## v8.48.0 - -### Changed -- Switch image scaler to a Go-only solution - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/603 - -### Other -- Push uploader control flow into objectstore package - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/608 - -## v8.47.0 - -### Added -- Add logging for local LSIF ZIP caching - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/579 -- Add project level route for Generic Packages uploads - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/596 - -### Changed -- Further simplify remote/local upload code - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/602 -- Experimental: Use strict content checks when resizing images - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/564 - -### Fixed -- Increase LSIF scanner buffer - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/609 -- Fix correlation IDs not being propagated in preauth check - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/607 - -### Other -- Reflect the actual duration of bootstrapping GitLab - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/605 - Contributed by Takuya Noguchi - -## v8.46.0 - -### Added -- Support Azure custom storage domains - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/593 - -## v8.45.0 - -### Added -- Reject upload when filesize exceeds MaximumSize returned by authorize endpoint - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -### Other -- Eliminate unnecessary code in GoCloud test stubs - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/590 -- Drop tests that check for log messages - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/591 - -## v8.44.0 - -### Fixed -- Fix objectstore.uploader.uploadError race - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/583 -- Silence errors when Azure objects have aleady been deleted - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/585 -- Fix race condition in httprs test - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/584 - -### Performance -- Remove an in-memory buffer for LSIF transformation - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/586 - -## v8.43.0 - -### Changed -- Remove ProcessReferences flag - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/543 - -### Fixed -- Fix nil pointer exception when no object storage config is defined - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/565 - -## v8.42.0 - -### Added -- Resize images on-demand with `gm convert` - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/546 - -## v8.41.0 - -### Added -- Add Azure blob store support - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/555 - -## v8.40.0 - -### Added -- Add project level route for conan package uploads - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/558 - -### Other -- Refactor uploaders to use different upload strategies - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/553 - -## v8.39.0 - -### Fixed -- Fix HTTP Range Requests not working on some S3 providers - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/549 - -### Other -- Vendor httprs module - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/550 - -### Performance -- Cache references in file - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/544 - -## v8.38.0 - -### Added -- Added configuration option PropagateCorrelationID - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/529 - Contributed by Mahmoud Rahbar Azad -- Add support for AWS S3 Server Side Encryption (SSE-KMS) - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/537 - -### Changed -- Drop Go v1.12 support - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/532 - -## v8.37.0 - -- No changes. -## v8.36.0 - -- No changes. -## v8.35.0 - -### Fixed -- Fix Content-Length set prior to SendUrl injection - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/496 - Contributed by Georges-Etienne Legendre - -## v8.34.0 - -### Added -- Support Workhorse directly uploading files to S3 - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/466 - -### Fixed -- Disable compression for open archive - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/508 - Contributed by Georges-Etienne Legendre - -### Other -- Add configuration to support an S3 client inside Workhorse - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/516 -- Refactor Preparer and SaveFileOpts handling - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/515 - -## v8.33.0 - -### Added -- Add routes for Group import via the UI - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/493 - -### Fixed -- Gather gitlab-zip-cat/metadata stderr and log output in the current context - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/498 - Contributed by Georges-Etienne Legendre - -## v8.32.1 - -### Security -- Limit memory footprint of a command that generates ZIP artifacts metadata - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -## v8.32.0 - -### Added -- Process LSIF document before sending it to GitLab - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/492 -- Delay PostUploadPack response until request is fully read - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/494 - -## v8.31.1 - -### Security -- Limit memory footprint of a command that generates ZIP artifacts metadata - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -## v8.31.0 - -### Added -- Add a signed field on upload requests containing all the workhorse parameters - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/490 - -### Other -- Add automatic changelog generation - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/484 - -## v8.30.2 - -### Security -- Limit memory footprint of a command that generates ZIP artifacts metadata - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -v 8.30.1 - -- Sign artifact multipart fields in Workhorse - -v 8.30.0 - -- Proxy ActionCable websocket connection !454 - -v 8.29.0 - -- Bump Labkit version to support Profiler sample versioning !479 - -v 8.28.0 - -- Reject parameters that override upload fields -- PyPi - Object storage upload route for package files !474 - -v 8.27.0 - -- Remove Set-Cookie header from archive and raw blob responses !475 - -v 8.26.0 - -- Add route for project imports direct upload via UI !470 - -## v8.25.3 - -### Security -- Limit memory footprint of a command that generates ZIP artifacts metadata - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/ - -### Other -- Add automatic changelog generation - https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/484 - -v 8.25.2 - -- Sign artifact multipart fields in Workhorse - -v 8.25.1 - -- Reject parameters that override upload fields - -v 8.25.0 - -- Add route for project imports direct upload !459 - -v 8.24.0 - -- Support Stackdriver Profiler through Labkit !461 - -v 8.23.0 - -- Don't set Cache-Control header for git archives !462 - -v 8.22.0 - -- Bump the version of golang.org/x/sys !456 -- Add friendly development error page for 502 !453 - -v 8.21.2 - -- Sign artifact multipart fields in Workhorse - -v 8.21.1 - -- Reject parameters that override upload fields - -v 8.21.0 - -- Add route for group imports direct upload !455 - -v 8.20.2 - -- Sign artifact multipart fields in Workhorse - -v 8.20.1 - -- Reject parameters that override upload fields - -v 8.20.0 - -- Sign file upload requests modified by workhorse - -v 8.19.0 - -- Use multipart uploads for nuget packages !451 - -v 8.18.0 - -- Allow inline content disposition for pdf files !446 -- Update environment websocket route !449 - -v 8.17.0 - -- Add labkit monitoring for build metrics !440 -- Log duration_ms when Workhorse hits a bad gateway !445 - -v 8.16.0 - -- Ignore CompleteMultipartUpload ETag !438 -- Add NuGet route for package uploads !441 -- Upgrade Gitaly client to v1.74.0 !443 -- Set a time limit on git upload-pack requests - -v 8.15.0 - -- Object store case insensitive ETag comparison !434 -- Upgrade gitaly to 1.68.0 !435 - -v 8.14.1 - -- Set a time limit on git upload-pack requests - -v 8.14.0 - -- Keep HTTP 1.0 cache headers from sendurl proxies !431 - -v 8.13.0 - -- Preserve original HTTP cache headers when proxying with sendurl !428 - -v8.12.0 - -- Fix health checks routes incorrectly intercepting errors !424 -- Simplify badgateway RoundTripper !425 - -v8.11.0 - -- Accelerate GraphQL uploads !403 -- Add route for handling Conan package uploads !412 -- Accelerate wiki attachments !422 - -v8.10.1 - -- Set a time limit on git upload-pack requests - -v8.10.0 - -- Use accelerated uploads for users/personal snippets -- Fix typo in keywatcher prometheus metrics !420 - -v8.9.0 - -- Update Gitaly library code to v1.57.0 !407 -- Replace govendor with go mod !411 -- Support gzip compression for Git info/refs !404 -- Add prometheus counter for Gitaly connection stubs !414 -- Support passing on Gitaly feature flags !410 - -v8.8.1 - -- Use accelerated uploads for users/personal snippets - -v8.8.0 - -- Filter title, description, text, and body from logs !402 -- Remove redirections from Terminal to Channel !397 -- Add option to set Sentry environment !396 - -v8.7.1 - -- Use accelerated uploads for users/personal snippets - -v8.7.0 - -- Don't log http.ErrAbortHandler panics in sentry !392 - -v8.6.0 - -- Add new endpoint to add support to proxy websocket requests to build's services !370 - -v8.5.2 - -- Don't log http.ErrAbortHandler panics in sentry !392 - -v8.5.1 - -- Remove duplicate X-Request-Id response header !384 - -v8.5.0 - -- Replace terminal terminology to channel !382 - -v8.4.0 - -- Adds X-Request-Id response header for Workhorse !363 -- Change content type detection header size to 4k !366 -- Allow unknown fields in jsonpb gitaly-proto messages !367 -- Filter `sharedSecret` param from Jira !369 -- Get git-archive with GetArchiveRequest !375 - -v8.3.3 - -- Preserve orientation when removing EXIF - -v8.3.2 - -- Remove EXIF from JPEG/TIFF images - -v 8.3.1 - -- Update gitaly-proto to 1.10.0 !363 - -v 8.3.0 - -- Count ^/-/ requests separately in prometheus !355 -- Statically link jaeger into Workhorse by default !359 -- Support encoded Content-Disposition fields !360 - -v 8.2.0 - -- Sign LFS upload requests that have been handled by workhorse -- Fixed svg recognition to get the proper content type !353 - -v 8.1.1 - -- Sign LFS upload requests that have been handled by workhorse - -v 8.1.0 - -- Upgrade the gitaly client to v1.13.0 (includes TLS support) !351 -- Update gitaly-proto to 0.124.0 !331 -- Add distributed tracing with LabKit !325 - -v 8.0.4 - -- Preserve orientation when removing EXIF - -v 8.0.3 - -- Remove EXIF from JPEG/TIFF images - -v 8.0.2 - -- Fixed svg recognition to get the proper content type !353 - -v 8.0.1 - -- Sign LFS upload requests that have been handled by workhorse - -v 8.0.0 - -- Remove local git archive support !304 -- Remove local git diff handling !345 -- Remove local git format-patch handling !346 -- Remove RepoPath from the API response - -v 7.6.1 - -- Sign LFS upload requests that have been handled by workhorse - -v 7.6.0 - -- Rename correlation-id structured logging field to correlation_id !343 -- Remove local git receive-pack implementation !326 -- Remove curl from sendfile_test.go !344 -- Update README.md usage example !342 - -v 7.5.1 - -- Rename correlation-id structured logging field to correlation_id !343 - -v 7.5.0 - -- Add proxy layer to calculate content type and disposition headers !335 - -v 7.4.0 - -- Strip port and include remote IP in access logs !337 - -v 7.3.0 - -- Redact sensitive url params as in Rails - -v 7.2.1 - -- Extract correlation code out to the LabKit project !323 -- Log X-Forwarded-For IPs when UNIX domain sockets are in use !324 - -v 7.2.0 - -- Update CI matrix to go1.10 + go1.11 and fix ResponseWriter bugs !309 -- Add support for Redis URLs (redis:// and rediss://) in Workhorse !321 - -v 7.1.4 - -- Sign LFS upload requests that have been handled by workhorse - -v 7.1.3 - -- Redact sensitive url params as in Rails - -v 7.1.1 - -Bad release, use 7.2.0 instead. - -v 7.1.0 - -- Add structured logFormat for text based logging !275 -- Run make fmt on master !306 -- Allow to configure `BUILD_DIR` and `TARGET_DIR` !308 -- Resolve "Rework test suite to allow dead code to be removed" !307 -- Update Prometheus vendoring !305 -- General vendoring cleanup !310 -- Remove Go 1.8 support !314 -- Remove unused 'body' argument !315 -- Refactor badgateway to use standardlib interfaces !316 -- Pass Correlation-Ids down to backend systems !311 -- Don't fail if /home/git/repositories already exists in Gitaly container !317 - -v 7.0.1 - -- Redact sensitive url params as in Rails - -v 7.0.0 - -- Use the new Gitaly auth scheme (v2) !298 - -v 6.1.2 - -- Redact sensitive url params as in Rails - -v 6.1.1 - -- Allow custom error messages to pass through to Rails !300 - -v 6.1.0 - -- Support adding PUT headers for object storage from Rails !297 - -v 6.0.0 - -- Accelerate Maven artifact repository uploads !283 - -v 5.2.0 - -- Populate Git Protocol !276 -- Add support for GitConfigOptions required for git-receive-pack command !281 - - -v 5.1.0 - -- Log using correlation-id bound to the incoming request !258 -- Prevent uploading two files as artifacts in single request !273 -- Prometheus instrumentation !279 - -v 5.0.0 - -- Update httprs for broken range implementations !266 -- Direct Upload for User Uploads !265 - -v 4.3.1 - -- Objectstorage ETag checking !263 - -v 4.3.0 - -- Multipart upload support !257 -- Make external commands extend the environment !261 - -v 4.2.1 - -- Fix objectstore error shadowing !259 - -v 4.2.0 - -- Guess RemoteAddr from X-Forwarded-For !254 - -v 4.1.0 - -- Add websocket route for web terminal access to CI jobs !234 -- Remove RepoPath check on Git HTTP !244 -- Artifacts and Uploads must allow Objects Storage only requests !247 -- Bridge between Gitaly and GitLab for a new repository snapshot endpoint !248 -- Update gitaly proto !249 - -v 4.0.0 - -- Handle Object Store upload in upload.HandleFileUploads !238 -- More consistent API naming. ObjectStore -> RemoteObject !240 - -v3.8.0 - -- Add structured logging !236 - -v3.7.0 - -- Add option to send file uploads straight to object storage !227 -- Allow sending Git archives with file names other than 'archive' !232 -- Unify uploads handling under filestore package !230 - -v3.6.0 - -- Introduce a `send-url:` method that allows to serve remote HTTP/GET file, like S3-based file !228 - -v3.5.1 - -- Use grpc-go 1.9.1 (!225) -- Update gitaly stream and dial library functions (!224) - -v3.5.0 - -- Add option to disable Git archive caching !222 - -v3.4.0 - -- Track Gitaly Connections in Prometheus !211 -- Run test suite on Go 1.9 !213 -- Remove repo disk check !218 - -v3.3.1 - -- Fix "net/http: request canceled" errors in gitlab-zip-cat !208 - -v3.3.0 - -- Ban context.Background !201 -- Respect the ShowAllRefs flag in git upload-pack and info-refs !203 -- Upgrade grpc to v1.7.1, protobuf to latest !207 - -v3.2.0 - -- Implement Gitaly call for archive requests !199 -- Re-use client.Dial from gitaly !194 -- Respect GL_USERNAME !192 -- Update BurntSushi/toml !195 -- Add Redis error counters !197 -- Migrate Send{Diff,Patch} to Gitaly !200 - -v3.1.0 - -- Add histograms to routes !184 -- Gitaly deprecations and replacements !186, !187, !189 -- Enable CI long polling by default !188 -- Refactor Git archive creation !190 - -v3.0.0 - -- Use GetBlob RPC instead of TreeEntry RPC for serving blobs !182 - -v2.3.0 -- Improve gitaly info refs error message !172 -- Migrate GetBlob to Gitaly !174 -- Drop support for Go <1.8 !176 -- Add some tests for gzipped assets !177 -- Use reader/writer from gitaly streamio !178 -- Use http.Request contexts for Gitaly calls !179 -- Allow to access remote archive !180 - -v2.2.0 -- Add support for token authentication on Gitaly requests -- Update gitaly-proto library to 0.9.0 - -v2.1.1 -- Bug fix and counters for static error pages - -v2.1.0 -- Remove chatty ErrorPage log message -- Filter query-string secrets out of logged URLs -- Suggest better default for prometheus port -- Add internal upload to external storage -- Prometheus metrics for senddata and git archive cache - -v2.0.1 -- Support GL_REPOSITORY from API and pass it to Gitaly on ReceivePack - -v2.0.0 - -- Fix gRPC stream resource leak !158, !160 -- Don't append error messages to Git HTTP responses !157 -- Drop support for old Gitaly fields in Git API response !152 - -v1.4.3 - -- Support forwarding Git HTTP POST data to Gitaly !143 -- Pass more Gitaly 'Repository' fields on from gitlab-rails !147 -- Support insecure TCP connections to Gitaly !150 - -v1.4.2 - -- Return 500 from GET /info/refs if possible !145 - -v1.4.1 - -- Fix several Redis integration bugs !137, !140 -- Fix race conditions in Redis tests !136 -- Don't follow HTTP redirects on internal API !134 -- Support /api/v4 for CI !133 -- Don't spam logs with CI queueing messages (Marcin Biegała) !127 - -v1.4.0 - -- Integrate with Gitaly via gRPC !119 -- Buffer git receive-pack responses in tempfiles !123 -- Use stdlib to copy stdin/stdout of git subprocesses !118 -- Terminal session timeouts !107 -- Redis integration EXPERIMENTAL !112 -- CI notifications via Redis EXPERIMENTAL !128 -- More CI queue metrics !122 - -v1.3.0 - -- Fix stalled HTTP fetches with large payloads. !110 -- Correctly parse content types in HTTP requests and responses !114 -- Catch _all_ multipart NextPart() errors. !108 -- Replace 'gitlab_workhorse_artifacts_upload_*' with labeled version of - 'gitlab_workhorse_multipart_upload_*'. !106 -- Allow GET /info/refs to be proxied to Gitaly. !105 -- Set correct value of X-Forwarded-For header in PreAuthorize request. !104 -- Allow nested namespaces in git URLs. !80 - -v1.2.1 - -- More Prometheus metrics -- Hide 502 internal errors from text-mode clients -- Buffer internal API responses up to a 32kB hard limit - -v1.2.0 - -- Add terminal websocket proxy endpoint -- Rewrite all incoming multipart requests: write 'file' parts to tempfiles - -v1.1.1 - -- Restrict effect of API rate limiting to /ci/api/v1/builds/register.json - -v1.1.0 - -- Prometheus metrics listener via `-prometheusListenAddr` option -- Tell NGINX to not buffer Git HTTP responses etc. with X-Accel-Buffering -- Fix double content type bug on archive downloads - -v1.0.0 - -- Workhorse is now v1.0.0, according to Semantic Versioning. No breaking - changes were made. -- Add support for logging to file, and logfile rotation with SIGHUP. -- Improve error messages. - -v0.8.5 - -Simplify revspec for 'git format-patch'. - -v0.8.4 - -Fix Go 1.5 compatibility broken in 0.8.3. Update CI configuration so -that tests run on Go 1.5, 1.6 and 1.7 (was only 1.6 before). - -v0.8.3 - -Add rate-limiting feature for /api requests (disabled by default). -Suppress non-zero exit code error from git-upload-pack during shallow -Git clone (only affects logging and Sentry). Don't treat EEXIST as an -error during git archive finalization. - -v0.8.2 - -Recognize more archive formats in git.SendArchive. Make 502 errors -(failed proxy requests to Unicorn) easier to recognize in Sentry. - -v0.8.1 - -Add Sentry (raven-go) for remote error tracking. - -v0.8.0 - -Add JWT signed communication between gitlab-workhorse and gitlab-rails. - -v0.7.11 - -Fix 'nil dereference' crash on Go 1.7 when parsing authBackend -parameter. Fix 'hard-wire backend host' crashes. - -v0.7.10 - -Fix typo in metrics header name. - -v0.7.9 - -Hard-wire backend host when using TCP. - -v0.7.8 - -Send artifact zip file entries via the 'senddata' mechanism. - -v0.7.7 - -Add the protocol used (HTTP) to each gitCommand call in order to check -for restricted protocol access on GitLab's side. - -v0.7.6 - -Add the capability to inject `git format-patch` output. - -v0.7.5 - -Add the capability to inject `git diff` output as HTTP response bodies -(@zj). - -v0.7.4 - -Pass a timestamp when forwarding requests to Rails. Hopefully this -will give us insight into Unicorn queueing behavior. - -v0.7.3 - -Revert 'buffer Git HTTP responses'. Set default listen socket -permissions to world read/writeable. - -v0.7.2 DO NOT USE - -Integrate with GOPATH during development (remove relative imports -etc.). Buffer Git HTTP responses so that we may return an error if the -local command fails early. - -Update: the 'buffer Git HTTP responses' change in 0.7.2 is BAD, it -breaks shallow Git clone. Don't use 0.7.2! - -v0.7.1 - -Set Content-Length (retrieved from Git) on raw blob data responses. - -v0.7.0 - -Start using a 'v' prefix on the version string. - -0.6.5 - -Inject 'git archive' data the same way as Git blob data. - -0.6.4 - -Increase default ProxyHeadersTimeout to 5 minutes. Fix injecting raw -blobs for /api/v3 requetsts. - -0.6.3 - -Add support for sending Git raw git blobs via gitlab-workhorse. - -0.6.2 - -We now fill in missing directory entries in archize zip metadata -files; also some other minor changes. - -0.6.1 - -Add support for generating zip artifacts metadata and serving single -files from zip archives. - -Gitlab-workhorse now consists of multiple executables. We also fixed a -routing bug introduced by the 0.6.0 refactor that broke relative URL -support. - -0.6.0 - -Overhauled the source code organization; no user-facing changes -(intended). The application code is now split into Go 'packages' -(modules). As of 0.6.0 gitlab-workhorse requires Go 1.5 or newer. - -0.5.4 - -Fix /api/v3/projects routing bug introduced in 0.5.2-0.5.3. - -0.5.3 - -Fixes merge error in 0.5.2. - -0.5.2 (broken!) - -- Always check with upstream if files in /uploads/ may be served -- Fix project%2Fnamespace API project ID's -- Prevent archive zombies when using gzip or bzip2 -- Don't show pretty error pages in development mode - -0.5.1 - -Deprecate -relativeURLRoot option, use -authBackend instead. - -0.5.0 - -Send ALL GitLab requests through gitlab-workhorse. - -0.4.2 - -Return response to client when uploading Git LFS object. - -0.4.1 - -Add support for Build Artifacts and Git LFS. The GitLab-Workhorse -offloads file uploading and downloading by providing support for -rewriting multipart form data and X-Sendfile. - -Other changes: -- add header Gitlab-Workhorse to all requests to indicate from where - they originated - -0.4.0 - -Rename the project to gitlab-workhorse. The old name had become too -specific. - -Other changes: - -- pass LD_LIBRARY_PATH to Git commands -- accomodate broken HTTP clients by spelling 'Www-Authenticate' as - 'WWW-Authenticate' - -0.3.1 - -Add support for Unix domain socket connections to the authBackend. - -0.3.0 - -In 0.3.0 we also handle 'git archive' downloads for GitLab 8.1+. -This has lead to some breaking API changes, making 0.3.0 incompatible -with GitLab 8.0. We now expect the 'auth backend' (GitLab) to -provide us with much more information about each request, such as -the path on disk to the Git repository the client is requesting. -This makes the REPO_ROOT command line argument obsolete. - -0.2.14 - -This is the last version that works with GitLab 8.0. diff --git a/workhorse/CONTRIBUTING.md b/workhorse/CONTRIBUTING.md deleted file mode 100644 index ef9785b9b6c..00000000000 --- a/workhorse/CONTRIBUTING.md +++ /dev/null @@ -1,46 +0,0 @@ -## Contributing - -Thank you for your interest in contributing to this GitLab project! We welcome -all contributions. By participating in this project, you agree to abide by the -[code of conduct](#code-of-conduct). - -## Contributor license agreement - -By submitting code as an individual you agree to the [individual contributor -license agreement][individual-agreement]. - -By submitting code as an entity you agree to the [corporate contributor license -agreement][corporate-agreement]. - -## Code of conduct - -As contributors and maintainers of this project, we pledge to respect all people -who contribute through reporting issues, posting feature requests, updating -documentation, submitting pull requests or patches, and other activities. - -We are committed to making participation in this project a harassment-free -experience for everyone, regardless of level of experience, gender, gender -identity and expression, sexual orientation, disability, personal appearance, -body size, race, ethnicity, age, or religion. - -Examples of unacceptable behavior by participants include the use of sexual -language or imagery, derogatory comments or personal attacks, trolling, public -or private harassment, insults, or other unprofessional conduct. - -Project maintainers have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct. Project maintainers who do not follow the -Code of Conduct may be removed from the project team. - -This code of conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior can be -reported by emailing contact@gitlab.com. - -This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant], version 1.1.0, -available at [http://contributor-covenant.org/version/1/1/0/](http://contributor-covenant.org/version/1/1/0/). - -[contributor-covenant]: http://contributor-covenant.org -[individual-agreement]: https://docs.gitlab.com/ee/legal/individual_contributor_license_agreement.html -[corporate-agreement]: https://docs.gitlab.com/ee/legal/corporate_contributor_license_agreement.html diff --git a/workhorse/LICENSE b/workhorse/LICENSE deleted file mode 100644 index 76a44f8bb70..00000000000 --- a/workhorse/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-2017 GitLab B.V. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/workhorse/Makefile b/workhorse/Makefile index 5661468149b..2bfaf5913c6 100644 --- a/workhorse/Makefile +++ b/workhorse/Makefile @@ -1,10 +1,7 @@ PREFIX=/usr/local -PKG := gitlab.com/gitlab-org/gitlab-workhorse +PKG := gitlab.com/gitlab-org/gitlab/workhorse BUILD_DIR ?= $(CURDIR) TARGET_DIR ?= $(BUILD_DIR)/_build -TARGET_SETUP := $(TARGET_DIR)/.ok -BIN_BUILD_DIR := $(TARGET_DIR)/bin -COVERAGE_DIR := $(TARGET_DIR)/cover VERSION_STRING := $(shell git describe) ifeq ($(strip $(VERSION_STRING)),) VERSION_STRING := v$(shell cat VERSION) @@ -32,53 +29,40 @@ endef .PHONY: all all: clean-build $(EXE_ALL) -$(TARGET_SETUP): - $(call message,"Setting up target directory") - rm -rf "$(TARGET_DIR)" - mkdir -p "$(TARGET_DIR)" - touch "$(TARGET_SETUP)" - .PHONY: gitlab-resize-image -gitlab-resize-image: $(TARGET_SETUP) +gitlab-resize-image: $(call message,Building $@) $(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@ .PHONY: gitlab-zip-cat -gitlab-zip-cat: $(TARGET_SETUP) +gitlab-zip-cat: $(call message,Building $@) $(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@ .PHONY: gitlab-zip-metadata -gitlab-zip-metadata: $(TARGET_SETUP) +gitlab-zip-metadata: $(call message,Building $@) $(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG)/cmd/$@ .PHONY: gitlab-workhorse -gitlab-workhorse: $(TARGET_SETUP) +gitlab-workhorse: $(call message,Building $@) $(GOBUILD) -tags "$(BUILD_TAGS)" -o $(BUILD_DIR)/$@ $(PKG) .PHONY: install -install: $(EXE_ALL) +install: $(EXE_ALL) $(call message,$@) mkdir -p $(DESTDIR)$(PREFIX)/bin/ cd $(BUILD_DIR) && $(INSTALL) $(EXE_ALL) $(DESTDIR)$(PREFIX)/bin/ .PHONY: test -test: $(TARGET_SETUP) prepare-tests +test: prepare-tests $(call message,$@) @go test -tags "$(BUILD_TAGS)" ./... @echo SUCCESS -.PHONY: coverage -coverage: $(TARGET_SETUP) prepare-tests - $(call message,$@) - @go test -tags "$(BUILD_TAGS)" -cover -coverprofile=test.coverage ./... - go tool cover -html=test.coverage -o coverage.html - rm -f test.coverage - .PHONY: clean -clean: clean-workhorse clean-build +clean: clean-workhorse clean-build $(call message,$@) rm -rf testdata/data testdata/scratch @@ -87,20 +71,6 @@ clean-workhorse: $(call message,$@) rm -f $(EXE_ALL) -.PHONY: check-version -check-version: - @test -n "$(VERSION)" || (echo "VERSION not set." ; exit 1) - -.PHONY: tag -tag: check-version - $(call message,$@) - sh _support/tag.sh "$(VERSION)" - -.PHONY: signed_tag -signed_tag: check-version - $(call message,$@) - TAG_OPTS=-s sh _support/tag.sh "$(VERSION)" - .PHONY: clean-build clean-build: $(call message,$@) @@ -121,18 +91,18 @@ testdata/scratch: verify: lint vet detect-context detect-assert check-formatting staticcheck deps-check .PHONY: lint -lint: $(TARGET_SETUP) +lint: $(call message,Verify: $@) go install golang.org/x/lint/golint @_support/lint.sh ./... .PHONY: vet -vet: $(TARGET_SETUP) +vet: $(call message,Verify: $@) @go vet ./... .PHONY: detect-context -detect-context: $(TARGET_SETUP) +detect-context: $(call message,Verify: $@) _support/detect-context.sh @@ -142,7 +112,7 @@ detect-assert: _support/detect-assert.sh .PHONY: check-formatting -check-formatting: $(TARGET_SETUP) install-goimports +check-formatting: install-goimports $(call message,Verify: $@) @_support/fmt.sh check @@ -150,7 +120,7 @@ check-formatting: $(TARGET_SETUP) install-goimports # Additionally, megacheck will not return failure exit codes unless explicitly told to via the # `-simple.exit-non-zero` `-unused.exit-non-zero` and `-staticcheck.exit-non-zero` flags .PHONY: staticcheck -staticcheck: $(TARGET_SETUP) +staticcheck: $(call message,Verify: $@) go install honnef.co/go/tools/cmd/staticcheck @ $(GOBIN)/staticcheck -go $(MINIMUM_SUPPORTED_GO_VERSION) ./... @@ -158,12 +128,12 @@ staticcheck: $(TARGET_SETUP) # In addition to fixing imports, goimports also formats your code in the same style as gofmt # so it can be used as a replacement. .PHONY: fmt -fmt: $(TARGET_SETUP) install-goimports +fmt: install-goimports $(call message,$@) @_support/fmt.sh .PHONY: goimports -install-goimports: $(TARGET_SETUP) +install-goimports: $(call message,$@) go install golang.org/x/tools/cmd/goimports diff --git a/workhorse/PROCESS.md b/workhorse/PROCESS.md index cf29b23b2c0..1231ab3968c 100644 --- a/workhorse/PROCESS.md +++ b/workhorse/PROCESS.md @@ -4,154 +4,14 @@ GitLab-Workhorse has the following maintainers: +- Patrick Bajao `@patrickbajao` +- Alessio Caiazza `@nolith` - Nick Thomas `@nick.thomas` - Jacob Vosmaer `@jacobvosmaer-gitlab` -- Alessio Caiazza `@nolith` - -This list is defined at https://about.gitlab.com/team/. - -## Changelog -GitLab-Workhorse keeps a changelog which is generated when a new release -is created. The changelog is generated from entries that are included on each -merge request. To generate an entry on your branch run: -`_support/changelog "Change descriptions"`. - -After the merge request is created, the ID of the merge request needs to be set -in the generated file. If you already know the merge request ID, run: -`_support/changelog -m <ID> "Change descriptions"`. - -Any new merge request must contain either a new entry or a justification in the -merge request description why no changelog entry is needed. +This authoritative source for this list is https://about.gitlab.com/team/. ## Merging and reviewing contributions Contributions must be reviewed by at least one Workhorse maintainer. The final merge must be performed by a maintainer. - -## Releases - -> Below we describe the legacy release process, from when Workhorse -> had its own repository. These instructions are still useful for -> security backports. - -New versions of Workhorse can be released by one of the Workhorse -maintainers. The release process is: - -- pick a release branch. For x.y.0, use `master`. For all other - versions (x.y.1, x.y.2 etc.) , use `x-y-stable`. Also see [below](#versioning) -- run `make tag VERSION=x.y.z"` or `make signed_tag VERSION=x.y.z` on the release branch. This will - compile the changelog, bump the VERSION file, and make a tag matching it. -- push the branch and the tag to gitlab.com -- the new version will only be deployed to `gitlab.com` if [`GITLAB_WORKHORSE_VERSION`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/GITLAB_WORKHORSE_VERSION) is updated accordingly; - if applicable, please remind the person who originally asked for a new release to make this change - (the MR should include a link back to the [version tag](https://gitlab.com/gitlab-org/gitlab-workhorse/-/tags) and a copy of the changelog) -- the person who updates GITLAB_WORKHORSE_VERSION should also run `scripts/update-workhorse` after commiting the new GITLAB_WORKHORSE_VERSION. If they forget they will be reminded by CI. - -## Security releases - -Workhorse is included in the packages we create for GitLab, and each version of -GitLab specifies the version of Workhorse it uses in the `GITLAB_WORKHORSE_VERSION` -file, so security fixes in Workhorse are tightly coupled to the [general security release](https://about.gitlab.com/handbook/engineering/workflow/#security-issues) -workflow, with some elaborations to account for the changes happening across two -repositories. In particular, the Workhorse maintainer takes responsibility for -creating new patch versions of Workhorse that can be used in the security -release. - -As security fixes are backported three releases in addition to master, and -changes need to happen across two repositories, up to eight merge requests, and -four Workhorse releases, can be required to fix a security issue in Workhorse. -This is a lot of overhead, so in general, it is better to fix security issues -without changing Workhorse. Where changes **are** necessary, this section -documents the necessary steps. - -If you're working on a security fix in Workhorse, you need two sets of merge -requests: - -* The fix itself, in the `gitlab-org/security/gitlab-workhorse` repository -* A merge request to change the version of workhorse included in the GitLab - security release, in the `gitlab-org/security/gitlab` repository. - -If the Workhorse maintainer isn't also a GitLab maintainer, reviews will need to -be split across several people. If changes to GitLab **code** are required in -addition to the change of Workhorse version, they both happen in the same merge -request. - -Start by creating a single merge request targeting `master` in Workhorse. Ensure -you include a changelog! If code changes are needed in GitLab as well, create a -GitLab merge request targeting `master` at this point, but don't worry about the -`GITLAB_WORKHORSE_VERSION` file yet. - -Once the changes have passed review, the Workhorse maintainer will determine the -new versions of Workhorse that will be needed, and communicate that to the -author. To do this, examine the `GITLAB_WORKHORSE_VERSION` file on each GitLab -stable branch; for instance, if the security release consisted of GitLab -versions `12.10.1`, `12.9.2`, `12.8.3`, and `12.7.4`, we would see the following: - -``` -gitlab$ git fetch security master 12-10-stable-ee 12-9-stable-ee 12-8-stable-ee 12-7-stable-ee` -gitlab$ git show refs/remotes/security/master:GITLAB_WORKHORSE_VERSION -8.30.1 -gitlab$ git show refs/remotes/security/12-10-stable-ee:GITLAB_WORKHORSE_VERSION -8.30.1 -gitlab$ git show refs/remotes/security/12-9-stable-ee:GITLAB_WORKHORSE_VERSION -8.25.2 -gitlab$ git show refs/remotes/security/12-8-stable-ee:GITLAB_WORKHORSE_VERSION -8.21.2 -gitlab$ git show refs/remotes/security/12-7-stable-ee:GITLAB_WORKHORSE_VERSION -8.21.2 -``` - -In this example, there are three distinct Workhorse stable branches to be -concerned with, plus Workhorse master: `8-30-stable`, `8-25-stable`, and -`8-21-stable`, and we can predict that we are going to need to create Workhorse -releases `8.30.2`, `8.25.3`, and `8.21.3`. - -The author needs to create a merge request targeting each Workhorse stable -branch, and verify that the fix works once backported. They also need to create -(or update, if they already exist) GitLab merge requests, setting the -`GITLAB_WORKHORSE_VERSION` file to the predicted workhorse version, and assign -all the MRs back to the appropriate maintainer(s). The pipeline for the GitLab -MRs will fail until the Workhorse releases have been tagged; you can use the -`=workhorse_branch_name` syntax in the `GITLAB_WORKHORSE_VERSION` file to verify -that the MRs interact as expected, if necessary. - -Once all involved maintainers are happy with the overall change, the Workhorse -maintainer will merge each of the Workhorse MRs and generate new Workhorse -releases from the stable branches. The tags will be present on the `security` -mirror and `dev.gitlab.org` **only** at this point. - -Once the Workhorse tags exist, the GitLab maintainer ensures that all the GitLab -MRs are green and assigns those MRs on to the release bot. - -The release managers merge the GitLab MRs, tag GitLab releases that reference -the new Workhorse tags, and release them in the usual way. - -Once the security release is done, the Workhorse maintainer is responsible for -syncing the changes to the `gitlab-org/gitlab-workhorse` repository. Push the -changes to `master`, the new tags, and all the changes to the stable branches. - -This process is quite involved, very manual, and extremely error-prone; work is -ongoing on automating it. - -## Versioning - -Workhorse uses a variation of SemVer. We don't use "normal" SemVer -because we have to be able to integrate into GitLab stable branches. - -A version has the format MAJOR.MINOR.PATCH. - -- Major and minor releases are tagged on the `master` branch -- If the change is backwards compatible, increment the MINOR counter -- If the change breaks compatibility, increment MAJOR and set MINOR to `0` -- Patch release tags must be made on stable branches -- Only make a patch release when targeting a GitLab stable branch - -This means that tags that end in `.0` (e.g. `8.5.0`) must always be on -the master branch, and tags that end in anthing other than `.0` (e.g. -`8.5.2`) must always be on a stable branch. - -> The reason we do this is that SemVer suggests something like a -> refactoring constitutes a "patch release", while the GitLab stable -> branch quality standards do not allow for back-porting refactorings -> into a stable branch. diff --git a/workhorse/_support/changelog b/workhorse/_support/changelog deleted file mode 100755 index 3b9efc21fcc..00000000000 --- a/workhorse/_support/changelog +++ /dev/null @@ -1,243 +0,0 @@ -#!/usr/bin/env ruby -# -# Generate a changelog entry file in the correct location. -# -# Automatically stages the file and amends the previous commit if the `--amend` -# argument is used. -# -# Stolen from gitlab-org/gitaly, lifted from gitlab-org/gitlab-ce - -require 'optparse' -require 'yaml' - -Options = Struct.new( - :amend, - :author, - :dry_run, - :force, - :merge_request, - :title, - :type -) -INVALID_TYPE = -1 - -class ChangelogOptionParser - Type = Struct.new(:name, :description) - TYPES = [ - Type.new('added', 'New feature'), - Type.new('fixed', 'Bug fix'), - Type.new('changed', 'Feature change'), - Type.new('deprecated', 'New deprecation'), - Type.new('removed', 'Feature removal'), - Type.new('security', 'Security fix'), - Type.new('performance', 'Performance improvement'), - Type.new('other', 'Other') - ].freeze - TYPES_OFFSET = 1 - - class << self - def parse(argv) - options = Options.new - - parser = OptionParser.new do |opts| - opts.banner = "Usage: #{__FILE__} [options] [title]\n\n" - - # Note: We do not provide a shorthand for this in order to match the `git - # commit` interface - opts.on('--amend', 'Amend the previous commit') do |value| - options.amend = value - end - - opts.on('-f', '--force', 'Overwrite an existing entry') do |value| - options.force = value - end - - opts.on('-m', '--merge-request [integer]', Integer, 'Merge request ID') do |value| - options.merge_request = value - end - - opts.on('-n', '--dry-run', "Don't actually write anything, just print") do |value| - options.dry_run = value - end - - opts.on('-u', '--git-username', 'Use Git user.name configuration as the author') do |value| - options.author = git_user_name if value - end - - opts.on('-t', '--type [string]', String, "The category of the change, valid options are: #{TYPES.map(&:name).join(', ')}") do |value| - options.type = parse_type(value) - end - - opts.on('-h', '--help', 'Print help message') do - $stdout.puts opts - exit - end - end - - parser.parse!(argv) - - # Title is everything that remains, but let's clean it up a bit - options.title = argv.join(' ').strip.squeeze(' ').tr("\r\n", '') - - options - end - - def read_type - read_type_message - - type = TYPES[$stdin.getc.to_i - TYPES_OFFSET] - assert_valid_type!(type) - - type.name - end - - private - - def parse_type(name) - type_found = TYPES.find do |type| - type.name == name - end - type_found ? type_found.name : INVALID_TYPE - end - - def read_type_message - $stdout.puts "\n>> Please specify the index for the category of your change:" - TYPES.each_with_index do |type, index| - $stdout.puts "#{index + TYPES_OFFSET}. #{type.description}" - end - $stdout.print "\n?> " - end - - def assert_valid_type!(type) - unless type - $stderr.puts "Invalid category index, please select an index between 1 and #{TYPES.length}" - exit 1 - end - end - - def git_user_name - %x{git config user.name}.strip - end - end -end - -class ChangelogEntry - attr_reader :options - - def initialize(options) - @options = options - - assert_feature_branch! - assert_title! - assert_new_file! - - # Read type from $stdin unless is already set - options.type ||= ChangelogOptionParser.read_type - assert_valid_type! - - $stdout.puts "\e[32mcreate\e[0m #{file_path}" - $stdout.puts contents - - unless options.dry_run - write - amend_commit if options.amend - end - end - - private - - def contents - yaml_content = YAML.dump( - 'title' => title, - 'merge_request' => options.merge_request, - 'author' => options.author, - 'type' => options.type - ) - remove_trailing_whitespace(yaml_content) - end - - def write - File.write(file_path, contents) - end - - def amend_commit - %x{git add #{file_path}} - exec("git commit --amend") - end - - def fail_with(message) - $stderr.puts "\e[31merror\e[0m #{message}" - exit 1 - end - - def assert_feature_branch! - return unless branch_name == 'master' - - fail_with "Create a branch first!" - end - - def assert_new_file! - return unless File.exist?(file_path) - return if options.force - - fail_with "#{file_path} already exists! Use `--force` to overwrite." - end - - def assert_title! - return if options.title.length > 0 || options.amend - - fail_with "Provide a title for the changelog entry or use `--amend`" \ - " to use the title from the previous commit." - end - - def assert_valid_type! - return unless options.type && options.type == INVALID_TYPE - - fail_with 'Invalid category given!' - end - - def title - if options.title.empty? - last_commit_subject - else - options.title - end - end - - def last_commit_subject - %x{git log --format="%s" -1}.strip - end - - def file_path - File.join( - unreleased_path, - branch_name.gsub(/[^\w-]/, '-') << '.yml' - ) - end - - def unreleased_path - path = File.join('changelogs', 'unreleased') - path = File.join('ee', path) if ee? - - path - end - - def ee? - @ee ||= File.exist?(File.expand_path('../CHANGELOG-EE.md', __dir__)) - end - - def branch_name - @branch_name ||= %x{git symbolic-ref --short HEAD}.strip - end - - def remove_trailing_whitespace(yaml_content) - yaml_content.gsub(/ +$/, '') - end -end - -if $0 == __FILE__ - options = ChangelogOptionParser.parse(ARGV) - ChangelogEntry.new(options) -end - -# vim: ft=ruby diff --git a/workhorse/_support/check_changelog.sh b/workhorse/_support/check_changelog.sh deleted file mode 100755 index 2f9850f09fd..00000000000 --- a/workhorse/_support/check_changelog.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -set -e - -# we skip the changelog check if the merge requet title ends with "NO CHANGELOG" -if echo "$CI_MERGE_REQUEST_TITLE" | grep -q ' NO CHANGELOG$'; then - echo "Changelog not needed" - - exit 0 -fi - -target=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-master} - -if git diff --name-only "origin/$target" | grep -q '^changelogs/' ; then - echo "Changelog included" -else - echo "Please add a changelog running '_support/changelog'" - echo "or disable this check adding 'NO CHANGELOG' at the end of the merge request title" - echo "/title $CI_MERGE_REQUEST_TITLE NO CHANGELOG" - - exit 1 -fi diff --git a/workhorse/_support/fmt.sh b/workhorse/_support/fmt.sh index b319ac7e328..45886211b5d 100755 --- a/workhorse/_support/fmt.sh +++ b/workhorse/_support/fmt.sh @@ -6,7 +6,7 @@ if [ "x$1" = xcheck ]; then fi IMPORT_RESULT=$( - goimports $FLAG -local "gitlab.com/gitlab-org/gitlab-workhorse" -l $( + goimports $FLAG -local "gitlab.com/gitlab-org/gitlab/workhorse" -l $( find . -type f -name '*.go' | grep -v -e /_ -e /testdata/ -e '^\./\.' ) ) diff --git a/workhorse/_support/generate_changelog b/workhorse/_support/generate_changelog deleted file mode 100755 index a9a8bae5a25..00000000000 --- a/workhorse/_support/generate_changelog +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env ruby -# Generates the changelog from the yaml entries in changelogs/unreleased -# -# Lifted form gitlab-org/gitaly - -require 'yaml' -require 'fileutils' - -class ChangelogEntry - attr_reader :title, :merge_request, :type, :author - - def initialize(file_path) - yaml = YAML.safe_load(File.read(file_path)) - - @title = yaml['title'] - @merge_request = yaml['merge_request'] - @type = yaml['type'] - @author = yaml['author'] - end - - def to_s - str = "" - str << "- #{title}\n" - str << " https://gitlab.com/gitlab-org/gitlab-workhorse/-/merge_requests/#{merge_request}\n" - str << " Contributed by #{author}\n" if author - - str - end -end - -ROOT_DIR = File.expand_path('../..', __FILE__) -UNRELEASED_ENTRIES = File.join(ROOT_DIR, 'changelogs', 'unreleased') -CHANGELOG_FILE = File.join(ROOT_DIR, 'CHANGELOG') - -def main(version) - entries = [] - Dir["#{UNRELEASED_ENTRIES}/*.yml"].each do |yml| - entries << ChangelogEntry.new(yml) - FileUtils.rm(yml) - end - - sections = [] - types = entries.map(&:type).uniq.sort - types.each do |type| - text = '' - text << "### #{type.capitalize}\n" - - entries.each do |e| - next unless e.type == type - - text << e.to_s - end - - sections << text - end - - sections << '- No changes.' if sections.empty? - - new_version_entry = ["## v#{version}\n\n", sections.join("\n"), "\n"].join - - current_changelog = File.read(CHANGELOG_FILE).lines - header = current_changelog.shift(2) - - new_changelog = [header, new_version_entry, current_changelog.join] - - File.write(CHANGELOG_FILE, new_changelog.join) -end - -unless ARGV.count == 1 - warn "Usage: #{$0} VERSION" - warn "Specify version as x.y.z" - abort -end - -main(ARGV.first) diff --git a/workhorse/_support/tag.sh b/workhorse/_support/tag.sh deleted file mode 100644 index 639fd141dad..00000000000 --- a/workhorse/_support/tag.sh +++ /dev/null @@ -1,45 +0,0 @@ -set -e - -main() { - version=$1 - set_version - - changelog - - git commit VERSION -m "Update VERSION to $version" - - tag_name="v${version}" - git tag $TAG_OPTS -m "Version ${version}" -a ${tag_name} - git show ${tag_name} - cat <<'EOF' - - Remember to now push your tag, either to gitlab.com (for a - normal release) or dev.gitlab.org (for a security release). -EOF -} - -set_version() { - if ! echo "${version}" | grep -q '^[0-9]\+\.[0-9]\+\.[0-9]\+$' ; then - echo "Invalid VERSION: ${version}" - exit 1 - fi - - if git tag --list | grep -q "^v${version}$" ; then - echo "Tag already exists for ${version}" - exit 1 - fi - - echo "$version" > VERSION -} - -changelog() { - _support/generate_changelog "$version" - - git commit CHANGELOG changelogs/unreleased --file - <<EOF -Update CHANGELOG for ${version} - -[ci skip] -EOF -} - -main "$@" diff --git a/workhorse/authorization_test.go b/workhorse/authorization_test.go index 8be1fdcf73a..f0a03779d5d 100644 --- a/workhorse/authorization_test.go +++ b/workhorse/authorization_test.go @@ -13,11 +13,11 @@ import ( "github.com/dgrijalva/jwt-go" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream/roundtripper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upstream/roundtripper" ) func okHandler(w http.ResponseWriter, _ *http.Request, _ *api.Response) { diff --git a/workhorse/cable_test.go b/workhorse/cable_test.go index 7320837541a..43d9b2c02c7 100644 --- a/workhorse/cable_test.go +++ b/workhorse/cable_test.go @@ -10,9 +10,9 @@ import ( "github.com/gorilla/websocket" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) const cablePath = "/-/cable" diff --git a/workhorse/channel_test.go b/workhorse/channel_test.go index cd8957ed829..dc00ddb37f3 100644 --- a/workhorse/channel_test.go +++ b/workhorse/channel_test.go @@ -17,7 +17,7 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" ) var ( diff --git a/workhorse/cmd/gitlab-resize-image/main.go b/workhorse/cmd/gitlab-resize-image/main.go index 81288c645eb..5b8ba95cd29 100644 --- a/workhorse/cmd/gitlab-resize-image/main.go +++ b/workhorse/cmd/gitlab-resize-image/main.go @@ -8,7 +8,7 @@ import ( "github.com/disintegration/imaging" - "gitlab.com/gitlab-org/gitlab-workhorse/cmd/gitlab-resize-image/png" + "gitlab.com/gitlab-org/gitlab/workhorse/cmd/gitlab-resize-image/png" ) func main() { diff --git a/workhorse/cmd/gitlab-zip-cat/main.go b/workhorse/cmd/gitlab-zip-cat/main.go index a0778a55ad2..12a4187bad1 100644 --- a/workhorse/cmd/gitlab-zip-cat/main.go +++ b/workhorse/cmd/gitlab-zip-cat/main.go @@ -11,7 +11,7 @@ import ( "gitlab.com/gitlab-org/labkit/mask" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts" ) const progName = "gitlab-zip-cat" diff --git a/workhorse/cmd/gitlab-zip-metadata/main.go b/workhorse/cmd/gitlab-zip-metadata/main.go index faa85ab5366..14fa2066997 100644 --- a/workhorse/cmd/gitlab-zip-metadata/main.go +++ b/workhorse/cmd/gitlab-zip-metadata/main.go @@ -7,8 +7,8 @@ import ( "io" "os" - "gitlab.com/gitlab-org/gitlab-workhorse/cmd/gitlab-zip-metadata/limit" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts" + "gitlab.com/gitlab-org/gitlab/workhorse/cmd/gitlab-zip-metadata/limit" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts" ) const progName = "gitlab-zip-metadata" diff --git a/workhorse/config.toml.example b/workhorse/config.toml.example index cb29508a90b..27dc29ee078 100644 --- a/workhorse/config.toml.example +++ b/workhorse/config.toml.example @@ -1,5 +1,7 @@ # alt_document_root = '/home/git/public/assets' # shutdown_timeout = "60s" +# trusted_cidrs_for_x_forwarded_for = [] +# trusted_cidrs_for_propagation = [] [redis] URL = "unix:/home/git/gitlab/redis/redis.socket" diff --git a/workhorse/config_test.go b/workhorse/config_test.go index 5a2743f375a..658a352a333 100644 --- a/workhorse/config_test.go +++ b/workhorse/config_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/queueing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/queueing" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upstream" ) func TestDefaultConfig(t *testing.T) { @@ -30,6 +30,9 @@ func TestConfigFile(t *testing.T) { data := ` shutdown_timeout = "60s" +trusted_cidrs_for_x_forwarded_for = ["127.0.0.1/8", "192.168.0.1/8"] +trusted_cidrs_for_propagation = ["10.0.0.1/8"] + [redis] password = "redis password" [object_storage] @@ -51,6 +54,8 @@ max_scaler_procs = 123 require.Equal(t, "redis password", cfg.Redis.Password) require.Equal(t, "test provider", cfg.ObjectStorageCredentials.Provider) require.Equal(t, uint32(123), cfg.ImageResizerConfig.MaxScalerProcs, "image resizer max_scaler_procs") + require.Equal(t, []string{"127.0.0.1/8", "192.168.0.1/8"}, cfg.TrustedCIDRsForXForwardedFor) + require.Equal(t, []string{"10.0.0.1/8"}, cfg.TrustedCIDRsForPropagation) require.Equal(t, 60*time.Second, cfg.ShutdownTimeout.Duration) } diff --git a/workhorse/doc/development/new_features.md b/workhorse/doc/development/new_features.md index 410e608be3b..e8bbd345a40 100644 --- a/workhorse/doc/development/new_features.md +++ b/workhorse/doc/development/new_features.md @@ -4,7 +4,7 @@ GitLab Workhorse is a smart reverse proxy for GitLab. It handles "long" HTTP requests such as file downloads, file uploads, Git push/pull and Git archive downloads. -Workhorse itself is not a feature, but there are [several features in GitLab](https://gitlab.com/gitlab-org/gitlab-workhorse/-/blob/master/doc/architecture/gitlab_features.md) that would not work efficiently without Workhorse. +Workhorse itself is not a feature, but there are [several features in GitLab](https://gitlab.com/gitlab-org/gitlab/-/blob/master/workhorse/doc/architecture/gitlab_features.md) that would not work efficiently without Workhorse. At a first glance, it may look like Workhorse is just a pipeline for processing HTTP streams so that you can reduce the amount of logic in your Ruby on Rails controller, but there are good reasons to avoid treating it like that. diff --git a/workhorse/gitaly_integration_test.go b/workhorse/gitaly_integration_test.go index e1b26bf39a7..9bf53af523e 100644 --- a/workhorse/gitaly_integration_test.go +++ b/workhorse/gitaly_integration_test.go @@ -19,9 +19,9 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) var ( diff --git a/workhorse/gitaly_test.go b/workhorse/gitaly_test.go index 753bc912a19..42aaad6e02d 100644 --- a/workhorse/gitaly_test.go +++ b/workhorse/gitaly_test.go @@ -18,18 +18,18 @@ import ( "testing" "time" - "github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/274 - "github.com/golang/protobuf/proto" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/274 + "github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab/-/issues/324868 + "github.com/golang/protobuf/proto" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab/-/issues/324868 "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/codes" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/git" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/git" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) func TestFailedCloneNoGitaly(t *testing.T) { diff --git a/workhorse/go.mod b/workhorse/go.mod index cd51f4e9f7b..3ce279f2ccc 100644 --- a/workhorse/go.mod +++ b/workhorse/go.mod @@ -1,4 +1,4 @@ -module gitlab.com/gitlab-org/gitlab-workhorse +module gitlab.com/gitlab-org/gitlab/workhorse go 1.15 @@ -7,7 +7,7 @@ require ( github.com/BurntSushi/toml v0.3.1 github.com/FZambia/sentinel v1.0.0 github.com/alecthomas/chroma v0.7.3 - github.com/aws/aws-sdk-go v1.36.1 + github.com/aws/aws-sdk-go v1.37.0 github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/disintegration/imaging v1.6.2 @@ -29,7 +29,7 @@ require ( github.com/smartystreets/goconvey v1.6.4 github.com/stretchr/testify v1.7.0 gitlab.com/gitlab-org/gitaly/v14 v14.0.0-rc1 - gitlab.com/gitlab-org/labkit v1.4.0 + gitlab.com/gitlab-org/labkit v1.6.0 gocloud.dev v0.21.1-0.20201223184910-5094f54ed8bb golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 // indirect golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 @@ -37,5 +37,6 @@ require ( golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 golang.org/x/tools v0.1.0 google.golang.org/grpc v1.37.0 + gopkg.in/DataDog/dd-trace-go.v1 v1.31.0 // indirect honnef.co/go/tools v0.1.3 ) diff --git a/workhorse/go.sum b/workhorse/go.sum index 3f9b36b5b49..bb7f4f70fc4 100644 --- a/workhorse/go.sum +++ b/workhorse/go.sum @@ -19,6 +19,7 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.66.0/go.mod h1:dgqGAjKCDxyhGTtC9dAREQGUJpkceNm1yt590Qno0Ko= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0 h1:at8Tk2zUz63cLPR0JPWm5vp77pEZmzxEQBEfRKn1VV8= @@ -46,6 +47,8 @@ cloud.google.com/go/storage v1.12.0 h1:4y3gHptW1EHVtcPAVE0eBBlFuGqEejTTG3KdIE0lU cloud.google.com/go/storage v1.12.0/go.mod h1:fFLk2dp2oAhDz8QFKwqrjdJvxSp/W2g7nillojlL5Ho= contrib.go.opencensus.io/exporter/aws v0.0.0-20200617204711-c478e41e60e9/go.mod h1:uu1P0UCM/6RbsMrgPa98ll8ZcHM858i/AD06a9aLRCA= contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= +contrib.go.opencensus.io/exporter/stackdriver v0.13.8 h1:lIFYmQsqejvlq+GobFUbC5F0prD5gvhP6r0gWLZRDq4= +contrib.go.opencensus.io/exporter/stackdriver v0.13.8/go.mod h1:huNtlWx75MwO7qMs0KrMxPZXzNNWebav1Sq/pm02JdQ= contrib.go.opencensus.io/integrations/ocsql v0.1.7/go.mod h1:8DsSdjz3F+APR+0z0WkU1aRorQCFfRxvqjUUPMbF3fE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= @@ -145,8 +148,9 @@ github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZo github.com/aws/aws-sdk-go v1.17.4/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.36.1 h1:rDgSL20giXXu48Ycx6Qa4vWaNTVTltUl6vA73ObCSVk= github.com/aws/aws-sdk-go v1.36.1/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.37.0 h1:GzFnhOIsrGyQ69s7VgqtrG2BG8v7X7vwB3Xpbd/DBBk= +github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -158,6 +162,7 @@ github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx2 github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.3.0 h1:t/LhUZLVitR1Ow2YOnduCsavhwFUklBMoGVYUCqmCqk= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20180905225744-ee1a9a0726d2/go.mod h1:GJKEexRPVJrBSOjoqN5VNOIKJ5Q3RViH6eu3puDRwx4= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 h1:uH66TXeswKn5PW5zdZ39xEwfS9an067BirqA+P4QaLI= @@ -309,8 +314,9 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -379,6 +385,7 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200905233945-acf8798be1f7/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210125172800-10e9aeb4a998/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5 h1:zIaiqGYDQwa4HVx5wGRTXbx38Pqxjemn4BP98wpzpXo= @@ -783,8 +790,8 @@ gitlab.com/gitlab-org/gitlab-shell v1.9.8-0.20201117050822-3f9890ef73dc/go.mod h gitlab.com/gitlab-org/labkit v0.0.0-20190221122536-0c3fc7cdd57c/go.mod h1:rYhLgfrbEcyfinG+R3EvKu6bZSsmwQqcXzLfHWSfUKM= gitlab.com/gitlab-org/labkit v0.0.0-20200908084045-45895e129029/go.mod h1:SNfxkfUwVNECgtmluVayv0GWFgEjjBs5AzgsowPQuo0= gitlab.com/gitlab-org/labkit v1.0.0/go.mod h1:nohrYTSLDnZix0ebXZrbZJjymRar8HeV2roWL5/jw2U= -gitlab.com/gitlab-org/labkit v1.4.0 h1:KZTEylusrFmqLXSzE5bHfBf7/xI2NLnsyoRgB7I7Oh8= -gitlab.com/gitlab-org/labkit v1.4.0/go.mod h1:4YbseTLUD7g4pPSylV57Hpyf7N3hbbxdx8K81//U/XM= +gitlab.com/gitlab-org/labkit v1.6.0 h1:Qgk+W+N0cujGBmZSjMqvM+4qIEjl7VgIK4nxlQO0RlA= +gitlab.com/gitlab-org/labkit v1.6.0/go.mod h1:1ZuVZpjSpCKUgjLx8P6jzkkQFxJI1thUKr6yKV3p0vY= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= @@ -796,6 +803,7 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.22.6/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -921,6 +929,7 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E= @@ -934,6 +943,7 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201203001011-0b49973bad19/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210126194326-f9ce19ea3013/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= @@ -949,6 +959,7 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1103,6 +1114,7 @@ golang.org/x/tools v0.0.0-20201203202102-a1a1cbeaa516/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1139,6 +1151,7 @@ google.golang.org/api v0.31.0/go.mod h1:CL+9IBCa2WWU6gRuBWaKqGWLFFwbEUXkfeMkHLQW google.golang.org/api v0.32.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.37.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= @@ -1196,6 +1209,8 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201203001206-6486ece9c497/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1245,6 +1260,7 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/DataDog/dd-trace-go.v1 v1.7.0/go.mod h1:DVp8HmDh8PuTu2Z0fVVlBsyWaC++fzwVCaGWylTe3tg= +gopkg.in/DataDog/dd-trace-go.v1 v1.30.0/go.mod h1:SnKViq44dv/0gjl9RpkP0Y2G3BJSRkp6eYdCSu39iI8= gopkg.in/DataDog/dd-trace-go.v1 v1.31.0 h1:ouY+DNlRTckk63TNh468tPWBC21qBZPniVQXQs0iq10= gopkg.in/DataDog/dd-trace-go.v1 v1.31.0/go.mod h1:SnKViq44dv/0gjl9RpkP0Y2G3BJSRkp6eYdCSu39iI8= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/workhorse/internal/api/api.go b/workhorse/internal/api/api.go index db1c4cbbc27..417ee71dbdc 100644 --- a/workhorse/internal/api/api.go +++ b/workhorse/internal/api/api.go @@ -3,7 +3,6 @@ package api import ( "bytes" "encoding/json" - "errors" "fmt" "io" "net/http" @@ -17,12 +16,12 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" ) const ( @@ -40,8 +39,6 @@ type API struct { Version string } -var ErrNotGeoSecondary = errors.New("this is not a Geo secondary site") - var ( requestsCounter = promauto.NewCounterVec( prometheus.CounterOpts{ @@ -399,7 +396,6 @@ func validResponseContentType(resp *http.Response) bool { return helper.IsContentType(ResponseContentType, resp.Header.Get("Content-Type")) } -// TODO: Cache the result of the API requests https://gitlab.com/gitlab-org/gitlab/-/issues/329671 func (api *API) GetGeoProxyURL() (*url.URL, error) { geoProxyApiUrl := *api.URL geoProxyApiUrl.Path, geoProxyApiUrl.RawPath = joinURLPath(api.URL, geoProxyEndpointPath) @@ -424,10 +420,6 @@ func (api *API) GetGeoProxyURL() (*url.URL, error) { return nil, fmt.Errorf("GetGeoProxyURL: decode response: %v", err) } - if response.GeoProxyURL == "" { - return nil, ErrNotGeoSecondary - } - geoProxyURL, err := url.Parse(response.GeoProxyURL) if err != nil { return nil, fmt.Errorf("GetGeoProxyURL: Could not parse Geo proxy URL: %v, err: %v", response.GeoProxyURL, err) diff --git a/workhorse/internal/api/api_test.go b/workhorse/internal/api/api_test.go index 5ab677c4233..43e3604cc9c 100644 --- a/workhorse/internal/api/api_test.go +++ b/workhorse/internal/api/api_test.go @@ -9,28 +9,27 @@ import ( "testing" "github.com/stretchr/testify/require" + "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream/roundtripper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upstream/roundtripper" ) func TestGetGeoProxyURLWhenGeoSecondary(t *testing.T) { geoProxyURL, err := getGeoProxyURLGivenResponse(t, `{"geo_proxy_url":"http://primary"}`) require.NoError(t, err) - require.NotNil(t, geoProxyURL) require.Equal(t, "http://primary", geoProxyURL.String()) } func TestGetGeoProxyURLWhenGeoPrimaryOrNonGeo(t *testing.T) { geoProxyURL, err := getGeoProxyURLGivenResponse(t, "{}") - require.Error(t, err) - require.Equal(t, ErrNotGeoSecondary, err) - require.Nil(t, geoProxyURL) + require.NoError(t, err) + require.Equal(t, "", geoProxyURL.String()) } func getGeoProxyURLGivenResponse(t *testing.T, givenInternalApiResponse string) (*url.URL, error) { diff --git a/workhorse/internal/api/block.go b/workhorse/internal/api/block.go index 92322906c03..43763fc2b13 100644 --- a/workhorse/internal/api/block.go +++ b/workhorse/internal/api/block.go @@ -4,7 +4,7 @@ import ( "fmt" "net/http" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) // Prevent internal API responses intended for gitlab-workhorse from diff --git a/workhorse/internal/api/channel_settings.go b/workhorse/internal/api/channel_settings.go index bf3094c9c91..91798334a03 100644 --- a/workhorse/internal/api/channel_settings.go +++ b/workhorse/internal/api/channel_settings.go @@ -9,7 +9,7 @@ import ( "github.com/gorilla/websocket" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) type ChannelSettings struct { diff --git a/workhorse/internal/artifacts/artifacts_store_test.go b/workhorse/internal/artifacts/artifacts_store_test.go index bd56d9ea725..67a7793e853 100644 --- a/workhorse/internal/artifacts/artifacts_store_test.go +++ b/workhorse/internal/artifacts/artifacts_store_test.go @@ -16,9 +16,9 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore/test" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore/test" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) func createTestZipArchive(t *testing.T) (data []byte, md5Hash string) { diff --git a/workhorse/internal/artifacts/artifacts_test.go b/workhorse/internal/artifacts/artifacts_test.go index b9a42cc60c1..928ecd46120 100644 --- a/workhorse/internal/artifacts/artifacts_test.go +++ b/workhorse/internal/artifacts/artifacts_test.go @@ -6,7 +6,7 @@ import ( "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) func TestMain(m *testing.M) { diff --git a/workhorse/internal/artifacts/artifacts_upload.go b/workhorse/internal/artifacts/artifacts_upload.go index 3d4b8bf0931..ef289fbb93b 100644 --- a/workhorse/internal/artifacts/artifacts_upload.go +++ b/workhorse/internal/artifacts/artifacts_upload.go @@ -15,11 +15,11 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts" ) // Sent by the runner: https://gitlab.com/gitlab-org/gitlab-runner/blob/c24da19ecce8808d9d2950896f70c94f5ea1cc2e/network/gitlab.go#L580 diff --git a/workhorse/internal/artifacts/artifacts_upload_test.go b/workhorse/internal/artifacts/artifacts_upload_test.go index c82ae791239..ce078c78559 100644 --- a/workhorse/internal/artifacts/artifacts_upload_test.go +++ b/workhorse/internal/artifacts/artifacts_upload_test.go @@ -16,14 +16,14 @@ import ( "github.com/dgrijalva/jwt-go" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream/roundtripper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/proxy" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upstream/roundtripper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts" "github.com/stretchr/testify/require" ) diff --git a/workhorse/internal/artifacts/entry.go b/workhorse/internal/artifacts/entry.go index 0c697d40020..91a0843f1ee 100644 --- a/workhorse/internal/artifacts/entry.go +++ b/workhorse/internal/artifacts/entry.go @@ -15,9 +15,9 @@ import ( "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts" ) type entry struct{ senddata.Prefix } diff --git a/workhorse/internal/artifacts/entry_test.go b/workhorse/internal/artifacts/entry_test.go index 6f1e9d360aa..800125eec91 100644 --- a/workhorse/internal/artifacts/entry_test.go +++ b/workhorse/internal/artifacts/entry_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) func testEntryServer(t *testing.T, archive string, entry string) *httptest.ResponseRecorder { diff --git a/workhorse/internal/badgateway/roundtripper.go b/workhorse/internal/badgateway/roundtripper.go index 71bee12ead7..86337e80f28 100644 --- a/workhorse/internal/badgateway/roundtripper.go +++ b/workhorse/internal/badgateway/roundtripper.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" ) // Error is a custom error for pretty Sentry 'issues' diff --git a/workhorse/internal/builds/register.go b/workhorse/internal/builds/register.go index 77685889cfd..f28ad75e1d8 100644 --- a/workhorse/internal/builds/register.go +++ b/workhorse/internal/builds/register.go @@ -9,8 +9,8 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/redis" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/redis" ) const ( diff --git a/workhorse/internal/builds/register_test.go b/workhorse/internal/builds/register_test.go index a72d82dc2b7..3c975f61003 100644 --- a/workhorse/internal/builds/register_test.go +++ b/workhorse/internal/builds/register_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/redis" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/redis" ) const upstreamResponseCode = 999 diff --git a/workhorse/internal/channel/auth_checker.go b/workhorse/internal/channel/auth_checker.go index f44850e0861..f2c43905571 100644 --- a/workhorse/internal/channel/auth_checker.go +++ b/workhorse/internal/channel/auth_checker.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" ) type AuthCheckerFunc func() *api.ChannelSettings diff --git a/workhorse/internal/channel/auth_checker_test.go b/workhorse/internal/channel/auth_checker_test.go index 18beb45cf3a..b522cf5da1f 100644 --- a/workhorse/internal/channel/auth_checker_test.go +++ b/workhorse/internal/channel/auth_checker_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" ) func checkerSeries(values ...*api.ChannelSettings) AuthCheckerFunc { diff --git a/workhorse/internal/channel/channel.go b/workhorse/internal/channel/channel.go index 381ce95df82..e740015d54a 100644 --- a/workhorse/internal/channel/channel.go +++ b/workhorse/internal/channel/channel.go @@ -9,8 +9,8 @@ import ( "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) var ( diff --git a/workhorse/internal/config/config.go b/workhorse/internal/config/config.go index 9f214385f81..60cfd567f5d 100644 --- a/workhorse/internal/config/config.go +++ b/workhorse/internal/config/config.go @@ -85,25 +85,27 @@ type ImageResizerConfig struct { } type Config struct { - Redis *RedisConfig `toml:"redis"` - Backend *url.URL `toml:"-"` - CableBackend *url.URL `toml:"-"` - Version string `toml:"-"` - DocumentRoot string `toml:"-"` - DevelopmentMode bool `toml:"-"` - Socket string `toml:"-"` - CableSocket string `toml:"-"` - ProxyHeadersTimeout time.Duration `toml:"-"` - APILimit uint `toml:"-"` - APIQueueLimit uint `toml:"-"` - APIQueueTimeout time.Duration `toml:"-"` - APICILongPollingDuration time.Duration `toml:"-"` - ObjectStorageConfig ObjectStorageConfig `toml:"-"` - ObjectStorageCredentials ObjectStorageCredentials `toml:"object_storage"` - PropagateCorrelationID bool `toml:"-"` - ImageResizerConfig ImageResizerConfig `toml:"image_resizer"` - AltDocumentRoot string `toml:"alt_document_root"` - ShutdownTimeout TomlDuration `toml:"shutdown_timeout"` + Redis *RedisConfig `toml:"redis"` + Backend *url.URL `toml:"-"` + CableBackend *url.URL `toml:"-"` + Version string `toml:"-"` + DocumentRoot string `toml:"-"` + DevelopmentMode bool `toml:"-"` + Socket string `toml:"-"` + CableSocket string `toml:"-"` + ProxyHeadersTimeout time.Duration `toml:"-"` + APILimit uint `toml:"-"` + APIQueueLimit uint `toml:"-"` + APIQueueTimeout time.Duration `toml:"-"` + APICILongPollingDuration time.Duration `toml:"-"` + ObjectStorageConfig ObjectStorageConfig `toml:"-"` + ObjectStorageCredentials ObjectStorageCredentials `toml:"object_storage"` + PropagateCorrelationID bool `toml:"-"` + ImageResizerConfig ImageResizerConfig `toml:"image_resizer"` + AltDocumentRoot string `toml:"alt_document_root"` + ShutdownTimeout TomlDuration `toml:"shutdown_timeout"` + TrustedCIDRsForXForwardedFor []string `toml:"trusted_cidrs_for_x_forwarded_for"` + TrustedCIDRsForPropagation []string `toml:"trusted_cidrs_for_propagation"` } var DefaultImageResizerConfig = ImageResizerConfig{ diff --git a/workhorse/internal/filestore/file_handler.go b/workhorse/internal/filestore/file_handler.go index 19764e9a5cf..06948941c04 100644 --- a/workhorse/internal/filestore/file_handler.go +++ b/workhorse/internal/filestore/file_handler.go @@ -14,8 +14,8 @@ import ( "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" ) type SizeError error @@ -62,7 +62,7 @@ func (fh *FileHandler) MD5() string { // GitLabFinalizeFields returns a map with all the fields GitLab Rails needs in order to finalize the upload. func (fh *FileHandler) GitLabFinalizeFields(prefix string) (map[string]string, error) { - // TODO: remove `data` these once rails fully and exclusively support `signedData` (https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/263) + // TODO: remove `data` these once rails fully and exclusively support `signedData` (https://gitlab.com/gitlab-org/gitlab/-/issues/324873) data := make(map[string]string) signedData := make(map[string]string) key := func(field string) string { diff --git a/workhorse/internal/filestore/file_handler_test.go b/workhorse/internal/filestore/file_handler_test.go index e79e9d0f292..b1d4e64b666 100644 --- a/workhorse/internal/filestore/file_handler_test.go +++ b/workhorse/internal/filestore/file_handler_test.go @@ -16,10 +16,10 @@ import ( "github.com/stretchr/testify/require" "gocloud.dev/blob" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore/test" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore/test" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) func testDeadline() time.Time { diff --git a/workhorse/internal/filestore/save_file_opts.go b/workhorse/internal/filestore/save_file_opts.go index d0b2c6ec809..544101d693a 100644 --- a/workhorse/internal/filestore/save_file_opts.go +++ b/workhorse/internal/filestore/save_file_opts.go @@ -7,8 +7,8 @@ import ( "gocloud.dev/blob" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" ) // DefaultObjectStoreTimeout is the timeout for ObjectStore upload operation diff --git a/workhorse/internal/filestore/save_file_opts_test.go b/workhorse/internal/filestore/save_file_opts_test.go index 060618a904b..ead5ba86889 100644 --- a/workhorse/internal/filestore/save_file_opts_test.go +++ b/workhorse/internal/filestore/save_file_opts_test.go @@ -6,10 +6,10 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore/test" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore/test" ) func TestSaveFileOptsLocalAndRemote(t *testing.T) { diff --git a/workhorse/internal/git/archive.go b/workhorse/internal/git/archive.go index 856076010e8..bb35f2eb269 100644 --- a/workhorse/internal/git/archive.go +++ b/workhorse/internal/git/archive.go @@ -15,17 +15,17 @@ import ( "regexp" "time" - "github.com/golang/protobuf/proto" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/274 + "github.com/golang/protobuf/proto" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab/-/issues/324868 "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" ) type archive struct{ senddata.Prefix } diff --git a/workhorse/internal/git/archive_test.go b/workhorse/internal/git/archive_test.go index 2981121dfd6..b96d5fdec85 100644 --- a/workhorse/internal/git/archive_test.go +++ b/workhorse/internal/git/archive_test.go @@ -7,7 +7,7 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" "github.com/stretchr/testify/require" ) diff --git a/workhorse/internal/git/blob.go b/workhorse/internal/git/blob.go index 68d342862fd..3ea065766d0 100644 --- a/workhorse/internal/git/blob.go +++ b/workhorse/internal/git/blob.go @@ -6,9 +6,9 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" ) type blob struct{ senddata.Prefix } diff --git a/workhorse/internal/git/diff.go b/workhorse/internal/git/diff.go index 49d979d0df4..4877eea045a 100644 --- a/workhorse/internal/git/diff.go +++ b/workhorse/internal/git/diff.go @@ -6,10 +6,10 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" ) type diff struct{ senddata.Prefix } diff --git a/workhorse/internal/git/format-patch.go b/workhorse/internal/git/format-patch.go index 62519e5cc2f..2e52fdf6c33 100644 --- a/workhorse/internal/git/format-patch.go +++ b/workhorse/internal/git/format-patch.go @@ -6,10 +6,10 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" ) type patch struct{ senddata.Prefix } diff --git a/workhorse/internal/git/git-http.go b/workhorse/internal/git/git-http.go index 8115d833bb1..7f5c1b6c584 100644 --- a/workhorse/internal/git/git-http.go +++ b/workhorse/internal/git/git-http.go @@ -11,8 +11,8 @@ import ( "path/filepath" "sync" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" ) const ( diff --git a/workhorse/internal/git/info-refs.go b/workhorse/internal/git/info-refs.go index e5491a7b733..0d8edbeff06 100644 --- a/workhorse/internal/git/info-refs.go +++ b/workhorse/internal/git/info-refs.go @@ -11,9 +11,9 @@ import ( "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) func GetInfoRefsHandler(a *api.API) http.Handler { diff --git a/workhorse/internal/git/receive-pack.go b/workhorse/internal/git/receive-pack.go index e72d8be5174..ccde9331b83 100644 --- a/workhorse/internal/git/receive-pack.go +++ b/workhorse/internal/git/receive-pack.go @@ -4,9 +4,9 @@ import ( "fmt" "net/http" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) // Will not return a non-nil error after the response body has been diff --git a/workhorse/internal/git/responsewriter.go b/workhorse/internal/git/responsewriter.go index c4d4ac252d4..bdf123414b2 100644 --- a/workhorse/internal/git/responsewriter.go +++ b/workhorse/internal/git/responsewriter.go @@ -7,7 +7,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) const ( diff --git a/workhorse/internal/git/snapshot.go b/workhorse/internal/git/snapshot.go index 553af7f4c38..152b2fc2b93 100644 --- a/workhorse/internal/git/snapshot.go +++ b/workhorse/internal/git/snapshot.go @@ -7,10 +7,10 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" ) type snapshot struct { diff --git a/workhorse/internal/git/upload-pack.go b/workhorse/internal/git/upload-pack.go index a3dbf2f2e02..acf03284343 100644 --- a/workhorse/internal/git/upload-pack.go +++ b/workhorse/internal/git/upload-pack.go @@ -7,9 +7,9 @@ import ( "net/http" "time" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) var ( diff --git a/workhorse/internal/git/upload-pack_test.go b/workhorse/internal/git/upload-pack_test.go index 9ee199a5402..ebefe360122 100644 --- a/workhorse/internal/git/upload-pack_test.go +++ b/workhorse/internal/git/upload-pack_test.go @@ -15,8 +15,8 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" ) var ( diff --git a/workhorse/internal/gitaly/gitaly.go b/workhorse/internal/gitaly/gitaly.go index 0aa35325555..6ea99962056 100644 --- a/workhorse/internal/gitaly/gitaly.go +++ b/workhorse/internal/gitaly/gitaly.go @@ -5,17 +5,18 @@ import ( "strings" "sync" - "github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/274 - "github.com/golang/protobuf/proto" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/274 + "github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab/-/issues/324868 + "github.com/golang/protobuf/proto" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab/-/issues/324868 grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + gitalyauth "gitlab.com/gitlab-org/gitaly/v14/auth" gitalyclient "gitlab.com/gitlab-org/gitaly/v14/client" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "google.golang.org/grpc" - "google.golang.org/grpc/metadata" grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc" grpctracing "gitlab.com/gitlab-org/labkit/tracing/grpc" diff --git a/workhorse/internal/headers/content_headers.go b/workhorse/internal/headers/content_headers.go index e43f10745d4..9c33ddb8c8a 100644 --- a/workhorse/internal/headers/content_headers.go +++ b/workhorse/internal/headers/content_headers.go @@ -4,7 +4,7 @@ import ( "net/http" "regexp" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/utils/svg" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/utils/svg" ) var ( diff --git a/workhorse/internal/headers/headers.go b/workhorse/internal/headers/headers.go index 63b39a6aa41..2ba92959c51 100644 --- a/workhorse/internal/headers/headers.go +++ b/workhorse/internal/headers/headers.go @@ -6,7 +6,7 @@ import ( ) // Max number of bytes that http.DetectContentType needs to get the content type -// Fixme: Go back to 512 bytes once https://gitlab.com/gitlab-org/gitlab-workhorse/issues/208 +// Fixme: Go back to 512 bytes once https://gitlab.com/gitlab-org/gitlab/-/issues/325074 // has been merged const MaxDetectSize = 4096 diff --git a/workhorse/internal/imageresizer/image_resizer.go b/workhorse/internal/imageresizer/image_resizer.go index 69e9496aec2..a21d2838acb 100644 --- a/workhorse/internal/imageresizer/image_resizer.go +++ b/workhorse/internal/imageresizer/image_resizer.go @@ -21,10 +21,10 @@ import ( "gitlab.com/gitlab-org/labkit/correlation" "gitlab.com/gitlab-org/labkit/tracing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" ) type Resizer struct { diff --git a/workhorse/internal/imageresizer/image_resizer_test.go b/workhorse/internal/imageresizer/image_resizer_test.go index bacc97738b8..8f5c8b2a6eb 100644 --- a/workhorse/internal/imageresizer/image_resizer_test.go +++ b/workhorse/internal/imageresizer/image_resizer_test.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/require" "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" _ "image/jpeg" // need this for image.Decode with JPEG ) diff --git a/workhorse/internal/lfs/lfs.go b/workhorse/internal/lfs/lfs.go index ec48dc05ef9..363e2113422 100644 --- a/workhorse/internal/lfs/lfs.go +++ b/workhorse/internal/lfs/lfs.go @@ -8,10 +8,10 @@ import ( "fmt" "net/http" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload" ) type object struct { diff --git a/workhorse/internal/lfs/lfs_test.go b/workhorse/internal/lfs/lfs_test.go index 828ed1bfe90..63b2628343e 100644 --- a/workhorse/internal/lfs/lfs_test.go +++ b/workhorse/internal/lfs/lfs_test.go @@ -3,10 +3,10 @@ package lfs_test import ( "testing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/lfs" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/lfs" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload" "github.com/stretchr/testify/require" ) diff --git a/workhorse/internal/log/logging.go b/workhorse/internal/log/logging.go index c65ec07743a..ae7164db920 100644 --- a/workhorse/internal/log/logging.go +++ b/workhorse/internal/log/logging.go @@ -8,7 +8,7 @@ import ( "gitlab.com/gitlab-org/labkit/mask" "golang.org/x/net/context" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) type Fields = log.Fields @@ -67,6 +67,14 @@ func (b *Builder) WithError(err error) *Builder { return b } +func Debug(args ...interface{}) { + NewBuilder().Debug(args...) +} + +func (b *Builder) Debug(args ...interface{}) { + b.entry.Debug(args...) +} + func Info(args ...interface{}) { NewBuilder().Info(args...) } diff --git a/workhorse/internal/log/logging_test.go b/workhorse/internal/log/logging_test.go index 1cb6438532e..9daf282daf4 100644 --- a/workhorse/internal/log/logging_test.go +++ b/workhorse/internal/log/logging_test.go @@ -7,6 +7,7 @@ import ( "net/http/httptest" "testing" + "github.com/sirupsen/logrus" "github.com/stretchr/testify/require" ) @@ -14,6 +15,7 @@ func captureLogs(b *Builder, testFn func()) string { buf := &bytes.Buffer{} logger := b.entry.Logger + logger.SetLevel(logrus.DebugLevel) oldOut := logger.Out logger.Out = buf defer func() { @@ -25,6 +27,15 @@ func captureLogs(b *Builder, testFn func()) string { return buf.String() } +func TestLogDebug(t *testing.T) { + b := NewBuilder() + logLine := captureLogs(b, func() { + b.Debug("an observation") + }) + + require.Regexp(t, `level=debug msg="an observation"`, logLine) +} + func TestLogInfo(t *testing.T) { b := NewBuilder() logLine := captureLogs(b, func() { diff --git a/workhorse/internal/objectstore/gocloud_object_test.go b/workhorse/internal/objectstore/gocloud_object_test.go index 4dc9d2d75cc..f320a65dbfb 100644 --- a/workhorse/internal/objectstore/gocloud_object_test.go +++ b/workhorse/internal/objectstore/gocloud_object_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore/test" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore/test" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) func TestGoCloudObjectUpload(t *testing.T) { diff --git a/workhorse/internal/objectstore/multipart_test.go b/workhorse/internal/objectstore/multipart_test.go index 00d6efc0982..42ab5b4e535 100644 --- a/workhorse/internal/objectstore/multipart_test.go +++ b/workhorse/internal/objectstore/multipart_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore/test" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore/test" ) func TestMultipartUploadWithUpcaseETags(t *testing.T) { diff --git a/workhorse/internal/objectstore/object_test.go b/workhorse/internal/objectstore/object_test.go index 2ec45520e97..c15248edf78 100644 --- a/workhorse/internal/objectstore/object_test.go +++ b/workhorse/internal/objectstore/object_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore/test" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore/test" ) const testTimeout = 10 * time.Second diff --git a/workhorse/internal/objectstore/s3_object.go b/workhorse/internal/objectstore/s3_object.go index 1f79f88224f..ce0cccc7eb1 100644 --- a/workhorse/internal/objectstore/s3_object.go +++ b/workhorse/internal/objectstore/s3_object.go @@ -11,7 +11,7 @@ import ( "github.com/aws/aws-sdk-go/service/s3/s3manager" "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" ) type S3Object struct { diff --git a/workhorse/internal/objectstore/s3_object_test.go b/workhorse/internal/objectstore/s3_object_test.go index d9ebbd7f979..c7426e3843b 100644 --- a/workhorse/internal/objectstore/s3_object_test.go +++ b/workhorse/internal/objectstore/s3_object_test.go @@ -17,10 +17,10 @@ import ( "github.com/aws/aws-sdk-go/service/s3" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore/test" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore/test" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) type failedReader struct { diff --git a/workhorse/internal/objectstore/s3_session.go b/workhorse/internal/objectstore/s3_session.go index ebc8daf534c..a0c1f099145 100644 --- a/workhorse/internal/objectstore/s3_session.go +++ b/workhorse/internal/objectstore/s3_session.go @@ -8,7 +8,7 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" ) type s3Session struct { diff --git a/workhorse/internal/objectstore/s3_session_test.go b/workhorse/internal/objectstore/s3_session_test.go index 8601f305917..5d57b4f9af8 100644 --- a/workhorse/internal/objectstore/s3_session_test.go +++ b/workhorse/internal/objectstore/s3_session_test.go @@ -7,7 +7,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" ) func TestS3SessionSetup(t *testing.T) { diff --git a/workhorse/internal/objectstore/test/objectstore_stub.go b/workhorse/internal/objectstore/test/objectstore_stub.go index 31ef4913305..ec5e271b759 100644 --- a/workhorse/internal/objectstore/test/objectstore_stub.go +++ b/workhorse/internal/objectstore/test/objectstore_stub.go @@ -13,7 +13,7 @@ import ( "strings" "sync" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore" ) type partsEtagMap map[int]string diff --git a/workhorse/internal/objectstore/test/s3_stub.go b/workhorse/internal/objectstore/test/s3_stub.go index 36514b3b887..6b83426b852 100644 --- a/workhorse/internal/objectstore/test/s3_stub.go +++ b/workhorse/internal/objectstore/test/s3_stub.go @@ -12,7 +12,7 @@ import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3manager" diff --git a/workhorse/internal/proxy/proxy.go b/workhorse/internal/proxy/proxy.go index 1bc417a841f..40be0fa96f6 100644 --- a/workhorse/internal/proxy/proxy.go +++ b/workhorse/internal/proxy/proxy.go @@ -7,7 +7,7 @@ import ( "net/url" "time" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) var ( diff --git a/workhorse/internal/queueing/requests.go b/workhorse/internal/queueing/requests.go index 409a7656fa4..3a22cb367ce 100644 --- a/workhorse/internal/queueing/requests.go +++ b/workhorse/internal/queueing/requests.go @@ -4,7 +4,7 @@ import ( "net/http" "time" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) const ( diff --git a/workhorse/internal/redis/keywatcher.go b/workhorse/internal/redis/keywatcher.go index 10d80d13d22..13e9fc3f051 100644 --- a/workhorse/internal/redis/keywatcher.go +++ b/workhorse/internal/redis/keywatcher.go @@ -11,7 +11,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" ) var ( diff --git a/workhorse/internal/redis/redis.go b/workhorse/internal/redis/redis.go index b11a8184bca..588fba6e242 100644 --- a/workhorse/internal/redis/redis.go +++ b/workhorse/internal/redis/redis.go @@ -13,8 +13,8 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) var ( diff --git a/workhorse/internal/redis/redis_test.go b/workhorse/internal/redis/redis_test.go index eee2f99bbbf..c3e4ded8878 100644 --- a/workhorse/internal/redis/redis_test.go +++ b/workhorse/internal/redis/redis_test.go @@ -9,8 +9,8 @@ import ( "github.com/rafaeljusto/redigomock" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) func mockRedisServer(t *testing.T, connectReceived *bool) string { diff --git a/workhorse/internal/senddata/contentprocessor/contentprocessor.go b/workhorse/internal/senddata/contentprocessor/contentprocessor.go index a5cc0fee013..1c97bd923aa 100644 --- a/workhorse/internal/senddata/contentprocessor/contentprocessor.go +++ b/workhorse/internal/senddata/contentprocessor/contentprocessor.go @@ -5,7 +5,7 @@ import ( "io" "net/http" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/headers" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/headers" ) type contentDisposition struct { diff --git a/workhorse/internal/senddata/contentprocessor/contentprocessor_test.go b/workhorse/internal/senddata/contentprocessor/contentprocessor_test.go index 5e3a74f04f9..2396bb0f952 100644 --- a/workhorse/internal/senddata/contentprocessor/contentprocessor_test.go +++ b/workhorse/internal/senddata/contentprocessor/contentprocessor_test.go @@ -7,8 +7,8 @@ import ( "net/http/httptest" "testing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/headers" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/headers" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" "github.com/stretchr/testify/require" ) diff --git a/workhorse/internal/senddata/senddata.go b/workhorse/internal/senddata/senddata.go index c287d2574fa..190a37c1a15 100644 --- a/workhorse/internal/senddata/senddata.go +++ b/workhorse/internal/senddata/senddata.go @@ -3,9 +3,9 @@ package senddata import ( "net/http" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/headers" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata/contentprocessor" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/headers" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata/contentprocessor" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" diff --git a/workhorse/internal/senddata/writer_test.go b/workhorse/internal/senddata/writer_test.go index 1262acd5472..fd6f7df5e64 100644 --- a/workhorse/internal/senddata/writer_test.go +++ b/workhorse/internal/senddata/writer_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/headers" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/headers" ) func TestWriter(t *testing.T) { diff --git a/workhorse/internal/sendfile/sendfile.go b/workhorse/internal/sendfile/sendfile.go index d009f216eb9..75e497f0564 100644 --- a/workhorse/internal/sendfile/sendfile.go +++ b/workhorse/internal/sendfile/sendfile.go @@ -19,8 +19,8 @@ import ( "gitlab.com/gitlab-org/labkit/log" "gitlab.com/gitlab-org/labkit/mask" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/headers" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/headers" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) var ( diff --git a/workhorse/internal/sendfile/sendfile_test.go b/workhorse/internal/sendfile/sendfile_test.go index d424814b5e5..f01bee0b799 100644 --- a/workhorse/internal/sendfile/sendfile_test.go +++ b/workhorse/internal/sendfile/sendfile_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/headers" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/headers" ) func TestResponseWriter(t *testing.T) { diff --git a/workhorse/internal/sendurl/sendurl.go b/workhorse/internal/sendurl/sendurl.go index 8eef6f76ff1..ac2e66f95ab 100644 --- a/workhorse/internal/sendurl/sendurl.go +++ b/workhorse/internal/sendurl/sendurl.go @@ -14,9 +14,9 @@ import ( "gitlab.com/gitlab-org/labkit/mask" "gitlab.com/gitlab-org/labkit/tracing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" ) type entry struct{ senddata.Prefix } diff --git a/workhorse/internal/sendurl/sendurl_test.go b/workhorse/internal/sendurl/sendurl_test.go index 41e1dbb8e0f..cc77fff0bfd 100644 --- a/workhorse/internal/sendurl/sendurl_test.go +++ b/workhorse/internal/sendurl/sendurl_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) const testData = `123456789012345678901234567890` diff --git a/workhorse/internal/staticpages/deploy_page.go b/workhorse/internal/staticpages/deploy_page.go index d08ed449ae6..35ebafa66e1 100644 --- a/workhorse/internal/staticpages/deploy_page.go +++ b/workhorse/internal/staticpages/deploy_page.go @@ -5,7 +5,7 @@ import ( "net/http" "path/filepath" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) func (s *Static) DeployPage(handler http.Handler) http.Handler { diff --git a/workhorse/internal/staticpages/deploy_page_test.go b/workhorse/internal/staticpages/deploy_page_test.go index 9bc0a082144..bc413880184 100644 --- a/workhorse/internal/staticpages/deploy_page_test.go +++ b/workhorse/internal/staticpages/deploy_page_test.go @@ -8,7 +8,7 @@ import ( "path/filepath" "testing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" "github.com/stretchr/testify/require" ) diff --git a/workhorse/internal/staticpages/error_pages.go b/workhorse/internal/staticpages/error_pages.go index 3cc89d9f811..6b86e21940b 100644 --- a/workhorse/internal/staticpages/error_pages.go +++ b/workhorse/internal/staticpages/error_pages.go @@ -10,7 +10,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) var ( diff --git a/workhorse/internal/staticpages/error_pages_test.go b/workhorse/internal/staticpages/error_pages_test.go index ab29e187c8e..c9927668fcc 100644 --- a/workhorse/internal/staticpages/error_pages_test.go +++ b/workhorse/internal/staticpages/error_pages_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) func TestIfErrorPageIsPresented(t *testing.T) { diff --git a/workhorse/internal/staticpages/servefile.go b/workhorse/internal/staticpages/servefile.go index 7e39f919fa6..be314f181b7 100644 --- a/workhorse/internal/staticpages/servefile.go +++ b/workhorse/internal/staticpages/servefile.go @@ -11,9 +11,9 @@ import ( "gitlab.com/gitlab-org/labkit/mask" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/urlprefix" ) type CacheMode int diff --git a/workhorse/internal/staticpages/servefile_test.go b/workhorse/internal/staticpages/servefile_test.go index 314547b8a57..f27bd0ccaeb 100644 --- a/workhorse/internal/staticpages/servefile_test.go +++ b/workhorse/internal/staticpages/servefile_test.go @@ -10,7 +10,7 @@ import ( "path/filepath" "testing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" "github.com/stretchr/testify/require" ) diff --git a/workhorse/internal/testhelper/gitaly.go b/workhorse/internal/testhelper/gitaly.go index 020a5863e2d..13e71c570a7 100644 --- a/workhorse/internal/testhelper/gitaly.go +++ b/workhorse/internal/testhelper/gitaly.go @@ -8,14 +8,15 @@ import ( "strings" "sync" - "github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/274 - "github.com/golang/protobuf/proto" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/274 - "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" - "gitlab.com/gitlab-org/labkit/log" + "github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab/-/issues/324868 + "github.com/golang/protobuf/proto" //lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab/-/issues/324868 "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + + "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" + "gitlab.com/gitlab-org/labkit/log" ) type GitalyTestServer struct { diff --git a/workhorse/internal/testhelper/testhelper.go b/workhorse/internal/testhelper/testhelper.go index 40097bd453a..d94341cd2b6 100644 --- a/workhorse/internal/testhelper/testhelper.go +++ b/workhorse/internal/testhelper/testhelper.go @@ -19,7 +19,7 @@ import ( "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" ) func ConfigureSecret() { diff --git a/workhorse/internal/upload/accelerate.go b/workhorse/internal/upload/accelerate.go index 7d8ea51b14d..08a84c6f670 100644 --- a/workhorse/internal/upload/accelerate.go +++ b/workhorse/internal/upload/accelerate.go @@ -6,8 +6,8 @@ import ( "github.com/dgrijalva/jwt-go" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) const RewrittenFieldsHeader = "Gitlab-Workhorse-Multipart-Fields" diff --git a/workhorse/internal/upload/body_uploader.go b/workhorse/internal/upload/body_uploader.go index 2cee90195fb..4849d9bae75 100644 --- a/workhorse/internal/upload/body_uploader.go +++ b/workhorse/internal/upload/body_uploader.go @@ -7,9 +7,9 @@ import ( "net/url" "strings" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) type PreAuthorizer interface { diff --git a/workhorse/internal/upload/body_uploader_test.go b/workhorse/internal/upload/body_uploader_test.go index 451d7c97fab..35509cb86c4 100644 --- a/workhorse/internal/upload/body_uploader_test.go +++ b/workhorse/internal/upload/body_uploader_test.go @@ -14,9 +14,9 @@ import ( "github.com/dgrijalva/jwt-go" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) const ( diff --git a/workhorse/internal/upload/object_storage_preparer.go b/workhorse/internal/upload/object_storage_preparer.go index 7a113fae80a..241cfc2d9d2 100644 --- a/workhorse/internal/upload/object_storage_preparer.go +++ b/workhorse/internal/upload/object_storage_preparer.go @@ -1,9 +1,9 @@ package upload import ( - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" ) type ObjectStoragePreparer struct { diff --git a/workhorse/internal/upload/object_storage_preparer_test.go b/workhorse/internal/upload/object_storage_preparer_test.go index 613b6071275..5856a1bcc92 100644 --- a/workhorse/internal/upload/object_storage_preparer_test.go +++ b/workhorse/internal/upload/object_storage_preparer_test.go @@ -5,9 +5,9 @@ import ( "gocloud.dev/blob" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload" "github.com/stretchr/testify/require" ) diff --git a/workhorse/internal/upload/rewrite.go b/workhorse/internal/upload/rewrite.go index f6a0bbae3f1..7945fa1f34d 100644 --- a/workhorse/internal/upload/rewrite.go +++ b/workhorse/internal/upload/rewrite.go @@ -18,10 +18,10 @@ import ( "golang.org/x/image/tiff" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/lsif_transformer/parser" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload/exif" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/lsif_transformer/parser" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload/exif" ) // ErrInjectedClientParam means that the client sent a parameter that overrides one of our own fields diff --git a/workhorse/internal/upload/saved_file_tracker.go b/workhorse/internal/upload/saved_file_tracker.go index 7b6cade4faa..cd41e661b7d 100644 --- a/workhorse/internal/upload/saved_file_tracker.go +++ b/workhorse/internal/upload/saved_file_tracker.go @@ -6,8 +6,8 @@ import ( "mime/multipart" "net/http" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" ) type SavedFileTracker struct { diff --git a/workhorse/internal/upload/saved_file_tracker_test.go b/workhorse/internal/upload/saved_file_tracker_test.go index e5a5e8f23a7..b294d04b216 100644 --- a/workhorse/internal/upload/saved_file_tracker_test.go +++ b/workhorse/internal/upload/saved_file_tracker_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) func TestSavedFileTracking(t *testing.T) { diff --git a/workhorse/internal/upload/skip_rails_authorizer.go b/workhorse/internal/upload/skip_rails_authorizer.go index 716467b8841..c8055a673eb 100644 --- a/workhorse/internal/upload/skip_rails_authorizer.go +++ b/workhorse/internal/upload/skip_rails_authorizer.go @@ -3,7 +3,7 @@ package upload import ( "net/http" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" ) // SkipRailsAuthorizer implements a fake PreAuthorizer that do not calls rails API and diff --git a/workhorse/internal/upload/uploads.go b/workhorse/internal/upload/uploads.go index 3be39f9518f..7a93fa4a9d8 100644 --- a/workhorse/internal/upload/uploads.go +++ b/workhorse/internal/upload/uploads.go @@ -8,11 +8,11 @@ import ( "mime/multipart" "net/http" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload/exif" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload/exif" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts" ) // These methods are allowed to have thread-unsafe implementations. diff --git a/workhorse/internal/upload/uploads_test.go b/workhorse/internal/upload/uploads_test.go index 44ddfaef9eb..5fae5cf7bcb 100644 --- a/workhorse/internal/upload/uploads_test.go +++ b/workhorse/internal/upload/uploads_test.go @@ -17,13 +17,13 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/objectstore/test" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream/roundtripper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/filestore" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/objectstore/test" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/proxy" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upstream/roundtripper" ) var nilHandler = http.HandlerFunc(func(http.ResponseWriter, *http.Request) {}) diff --git a/workhorse/internal/upstream/handlers.go b/workhorse/internal/upstream/handlers.go index a6aa148a4ae..5974170e172 100644 --- a/workhorse/internal/upstream/handlers.go +++ b/workhorse/internal/upstream/handlers.go @@ -6,7 +6,7 @@ import ( "io" "net/http" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) func contentEncodingHandler(h http.Handler) http.Handler { diff --git a/workhorse/internal/upstream/roundtripper/roundtripper.go b/workhorse/internal/upstream/roundtripper/roundtripper.go index 84f1983b471..947b80ddcf6 100644 --- a/workhorse/internal/upstream/roundtripper/roundtripper.go +++ b/workhorse/internal/upstream/roundtripper/roundtripper.go @@ -11,7 +11,7 @@ import ( "gitlab.com/gitlab-org/labkit/correlation" "gitlab.com/gitlab-org/labkit/tracing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/badgateway" ) func mustParseAddress(address, scheme string) string { diff --git a/workhorse/internal/upstream/routes.go b/workhorse/internal/upstream/routes.go index d46397e226e..a4b453f047d 100644 --- a/workhorse/internal/upstream/routes.go +++ b/workhorse/internal/upstream/routes.go @@ -11,24 +11,24 @@ import ( "gitlab.com/gitlab-org/labkit/log" "gitlab.com/gitlab-org/labkit/tracing" - apipkg "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/artifacts" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/builds" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/channel" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/git" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/imageresizer" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/lfs" - proxypkg "gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/queueing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/redis" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/sendfile" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/sendurl" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/staticpages" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload" + apipkg "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/artifacts" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/builds" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/channel" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/git" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/imageresizer" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/lfs" + proxypkg "gitlab.com/gitlab-org/gitlab/workhorse/internal/proxy" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/queueing" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/redis" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/sendfile" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/sendurl" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/staticpages" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload" ) type matcherFunc func(*http.Request) bool @@ -328,7 +328,7 @@ func configureRoutes(u *upstream) { // health checks don't intercept errors and go straight to rails // TODO: We should probably not return a HTML deploy page? - // https://gitlab.com/gitlab-org/gitlab-workhorse/issues/230 + // https://gitlab.com/gitlab-org/gitlab/-/issues/336326 u.route("", "^/-/(readiness|liveness)$", static.DeployPage(probeUpstream)), u.route("", "^/-/health$", static.DeployPage(healthUpstream)), @@ -337,6 +337,42 @@ func configureRoutes(u *upstream) { u.route("", "", defaultUpstream), } + + // Routes which should actually be served locally by a Geo Proxy. If none + // matches, then then proxy the request. + u.geoLocalRoutes = []routeEntry{ + // Git and LFS requests + // + // Note that Geo already redirects pushes, with special terminal output. + // Note that excessive secondary lag can cause unexpected behavior since + // pulls are performed against a different source of truth. Ideally, we'd + // proxy/redirect pulls as well, when the secondary is not up-to-date. + // + u.route("GET", gitProjectPattern+`info/refs\z`, git.GetInfoRefsHandler(api)), + u.route("POST", gitProjectPattern+`git-upload-pack\z`, contentEncodingHandler(git.UploadPack(api)), withMatcher(isContentType("application/x-git-upload-pack-request"))), + u.route("POST", gitProjectPattern+`git-receive-pack\z`, contentEncodingHandler(git.ReceivePack(api)), withMatcher(isContentType("application/x-git-receive-pack-request"))), + u.route("PUT", gitProjectPattern+`gitlab-lfs/objects/([0-9a-f]{64})/([0-9]+)\z`, lfs.PutStore(api, signingProxy, preparers.lfs), withMatcher(isContentType("application/octet-stream"))), + + // Serve health checks from this Geo secondary + u.route("", "^/-/(readiness|liveness)$", static.DeployPage(probeUpstream)), + u.route("", "^/-/health$", static.DeployPage(healthUpstream)), + u.route("", "^/-/metrics$", defaultUpstream), + + // Authentication routes + u.route("", "^/users/(sign_in|sign_out)$", defaultUpstream), + u.route("", "^/oauth/geo/(auth|callback|logout)$", defaultUpstream), + + // Admin Area > Geo routes + u.route("", "^/admin/geo$", defaultUpstream), + u.route("", "^/admin/geo/", defaultUpstream), + + // Geo API routes + u.route("", "^/api/v4/geo_nodes", defaultUpstream), + u.route("", "^/api/v4/geo_replication", defaultUpstream), + + // Don't define a catch-all route. If a route does not match, then we know + // the request should be proxied. + } } func createUploadPreparers(cfg config.Config) uploadPreparers { diff --git a/workhorse/internal/upstream/upstream.go b/workhorse/internal/upstream/upstream.go index c41eb98683b..d6e5e7766b5 100644 --- a/workhorse/internal/upstream/upstream.go +++ b/workhorse/internal/upstream/upstream.go @@ -9,21 +9,26 @@ package upstream import ( "fmt" "os" + "sync" + "time" "net/http" + "net/url" "strings" "github.com/sirupsen/logrus" + "gitlab.com/gitlab-org/labkit/correlation" - apipkg "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/rejectmethods" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream/roundtripper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix" + apipkg "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" + proxypkg "gitlab.com/gitlab-org/gitlab/workhorse/internal/proxy" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/rejectmethods" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upstream/roundtripper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/urlprefix" ) var ( @@ -31,6 +36,7 @@ var ( requestHeaderBlacklist = []string{ upload.RewrittenFieldsHeader, } + geoProxyApiPollingInterval = 10 * time.Second ) type upstream struct { @@ -40,8 +46,14 @@ type upstream struct { RoundTripper http.RoundTripper CableRoundTripper http.RoundTripper APIClient *apipkg.API + geoProxyBackend *url.URL + geoLocalRoutes []routeEntry + geoProxyCableRoute routeEntry + geoProxyRoute routeEntry + geoProxyTestChannel chan struct{} accessLogger *logrus.Logger enableGeoProxyFeature bool + mu sync.RWMutex } func NewUpstream(cfg config.Config, accessLogger *logrus.Logger) http.Handler { @@ -52,6 +64,9 @@ func newUpstream(cfg config.Config, accessLogger *logrus.Logger, routesCallback up := upstream{ Config: cfg, accessLogger: accessLogger, + // Kind of a feature flag. See https://gitlab.com/groups/gitlab-org/-/epics/5914#note_564974130 + enableGeoProxyFeature: os.Getenv("GEO_SECONDARY_PROXY") == "1", + geoProxyBackend: &url.URL{}, } if up.Backend == nil { up.Backend = DefaultBackend @@ -70,17 +85,26 @@ func newUpstream(cfg config.Config, accessLogger *logrus.Logger, routesCallback up.Version, up.RoundTripper, ) - // Kind of a feature flag. See https://gitlab.com/groups/gitlab-org/-/epics/5914#note_564974130 - up.enableGeoProxyFeature = os.Getenv("GEO_SECONDARY_PROXY") == "1" + routesCallback(&up) + if up.enableGeoProxyFeature { + go up.pollGeoProxyAPI() + } + var correlationOpts []correlation.InboundHandlerOption if cfg.PropagateCorrelationID { correlationOpts = append(correlationOpts, correlation.WithPropagation()) } + if cfg.TrustedCIDRsForPropagation != nil { + correlationOpts = append(correlationOpts, correlation.WithCIDRsTrustedForPropagation(cfg.TrustedCIDRsForPropagation)) + } + if cfg.TrustedCIDRsForXForwardedFor != nil { + correlationOpts = append(correlationOpts, correlation.WithCIDRsTrustedForXForwardedFor(cfg.TrustedCIDRsForXForwardedFor)) + } handler := correlation.InjectCorrelationID(&up, correlationOpts...) - // TODO: move to LabKit https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/339 + // TODO: move to LabKit https://gitlab.com/gitlab-org/gitlab/-/issues/324823 handler = rejectmethods.NewMiddleware(handler) return handler } @@ -118,25 +142,9 @@ func (u *upstream) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - // Look for a matching route - var route *routeEntry + cleanedPath := prefix.Strip(URIPath) - if u.enableGeoProxyFeature { - geoProxyURL, err := u.APIClient.GetGeoProxyURL() - - if err == nil { - log.WithRequest(r).WithFields(log.Fields{"geoProxyURL": geoProxyURL}).Info("Geo Proxy: Set route according to Geo Proxy logic") - } else if err != apipkg.ErrNotGeoSecondary { - log.WithRequest(r).WithError(err).Error("Geo Proxy: Unable to determine Geo Proxy URL. Falling back to normal routing") - } - } - - for _, ro := range u.Routes { - if ro.isMatch(prefix.Strip(URIPath), r) { - route = &ro - break - } - } + route := u.findRoute(cleanedPath, r) if route == nil { // The protocol spec in git/Documentation/technical/http-protocol.txt @@ -151,3 +159,83 @@ func (u *upstream) ServeHTTP(w http.ResponseWriter, r *http.Request) { route.handler.ServeHTTP(w, r) } + +func (u *upstream) findRoute(cleanedPath string, r *http.Request) *routeEntry { + if u.enableGeoProxyFeature { + if route := u.findGeoProxyRoute(cleanedPath, r); route != nil { + return route + } + } + + for _, ro := range u.Routes { + if ro.isMatch(cleanedPath, r) { + return &ro + } + } + + return nil +} + +func (u *upstream) findGeoProxyRoute(cleanedPath string, r *http.Request) *routeEntry { + u.mu.RLock() + defer u.mu.RUnlock() + + if u.geoProxyBackend.String() == "" { + log.WithRequest(r).Debug("Geo Proxy: Not a Geo proxy") + return nil + } + + // Some routes are safe to serve from this GitLab instance + for _, ro := range u.geoLocalRoutes { + if ro.isMatch(cleanedPath, r) { + log.WithRequest(r).Debug("Geo Proxy: Handle this request locally") + return &ro + } + } + + log.WithRequest(r).WithFields(log.Fields{"geoProxyBackend": u.geoProxyBackend}).Debug("Geo Proxy: Forward this request") + + if cleanedPath == "/-/cable" { + return &u.geoProxyCableRoute + } + + return &u.geoProxyRoute +} + +func (u *upstream) pollGeoProxyAPI() { + for { + u.callGeoProxyAPI() + + // Notify tests when callGeoProxyAPI() finishes + if u.geoProxyTestChannel != nil { + u.geoProxyTestChannel <- struct{}{} + } + + time.Sleep(geoProxyApiPollingInterval) + } +} + +// Calls /api/v4/geo/proxy and sets up routes +func (u *upstream) callGeoProxyAPI() { + geoProxyURL, err := u.APIClient.GetGeoProxyURL() + if err != nil { + log.WithError(err).WithFields(log.Fields{"geoProxyBackend": u.geoProxyBackend}).Error("Geo Proxy: Unable to determine Geo Proxy URL. Fallback on cached value.") + return + } + + if u.geoProxyBackend.String() != geoProxyURL.String() { + log.WithFields(log.Fields{"oldGeoProxyURL": u.geoProxyBackend, "newGeoProxyURL": geoProxyURL}).Info("Geo Proxy: URL changed") + u.updateGeoProxyFields(geoProxyURL) + } +} + +func (u *upstream) updateGeoProxyFields(geoProxyURL *url.URL) { + u.mu.Lock() + defer u.mu.Unlock() + + u.geoProxyBackend = geoProxyURL + geoProxyRoundTripper := roundtripper.NewBackendRoundTripper(u.geoProxyBackend, "", u.ProxyHeadersTimeout, u.DevelopmentMode) + geoProxyUpstream := proxypkg.NewProxy(u.geoProxyBackend, u.Version, geoProxyRoundTripper) + u.geoProxyCableRoute = u.wsRoute(`^/-/cable\z`, geoProxyUpstream) + u.geoProxyRoute = u.route("", "", geoProxyUpstream) +} diff --git a/workhorse/internal/upstream/upstream_test.go b/workhorse/internal/upstream/upstream_test.go index 3afc62a7384..c86c03920f0 100644 --- a/workhorse/internal/upstream/upstream_test.go +++ b/workhorse/internal/upstream/upstream_test.go @@ -1,6 +1,7 @@ package upstream import ( + "fmt" "io" "io/ioutil" "net/http" @@ -10,9 +11,22 @@ import ( "github.com/sirupsen/logrus" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" ) +const ( + geoProxyEndpoint = "/api/v4/geo/proxy" + testDocumentRoot = "testdata/public" +) + +type testCase struct { + desc string + path string + expectedResponse string +} + func TestRouting(t *testing.T) { handle := func(u *upstream, regex string) routeEntry { handler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { @@ -34,15 +48,10 @@ func TestRouting(t *testing.T) { handle(u, main), } }) - ts := httptest.NewServer(u) defer ts.Close() - testCases := []struct { - desc string - path string - route string - }{ + testCases := []testCase{ {"main route works", "/", main}, {"foobar route works", "/foobar", foobar}, {"quxbaz route works", "/quxbaz", quxbaz}, @@ -51,9 +60,109 @@ func TestRouting(t *testing.T) { {"double escaped path traversal does not match any route", "/foobar%252f%252e%252e%252fquxbaz", main}, } + runTestCases(t, ts, testCases) +} + +// This test can be removed when the environment variable `GEO_SECONDARY_PROXY` is removed +func TestGeoProxyFeatureDisabledOnGeoSecondarySite(t *testing.T) { + // We could just not set up the primary, but then we'd have to assert + // that the internal API call isn't made. This is easier. + remoteServer, rsDeferredClose := startRemoteServer("Geo primary") + defer rsDeferredClose() + + geoProxyEndpointResponseBody := fmt.Sprintf(`{"geo_proxy_url":"%v"}`, remoteServer.URL) + railsServer, deferredClose := startRailsServer("Local Rails server", geoProxyEndpointResponseBody) + defer deferredClose() + + ws, wsDeferredClose := startWorkhorseServer(railsServer.URL, false) + defer wsDeferredClose() + + testCases := []testCase{ + {"jobs request is served locally", "/api/v4/jobs/request", "Local Rails server received request to path /api/v4/jobs/request"}, + {"health check is served locally", "/-/health", "Local Rails server received request to path /-/health"}, + {"unknown route is served locally", "/anything", "Local Rails server received request to path /anything"}, + } + + runTestCases(t, ws, testCases) +} + +func TestGeoProxyFeatureEnabledOnGeoSecondarySite(t *testing.T) { + remoteServer, rsDeferredClose := startRemoteServer("Geo primary") + defer rsDeferredClose() + + geoProxyEndpointResponseBody := fmt.Sprintf(`{"geo_proxy_url":"%v"}`, remoteServer.URL) + railsServer, deferredClose := startRailsServer("Local Rails server", geoProxyEndpointResponseBody) + defer deferredClose() + + ws, wsDeferredClose := startWorkhorseServer(railsServer.URL, true) + defer wsDeferredClose() + + testCases := []testCase{ + {"jobs request is forwarded", "/api/v4/jobs/request", "Geo primary received request to path /api/v4/jobs/request"}, + {"health check is served locally", "/-/health", "Local Rails server received request to path /-/health"}, + {"unknown route is forwarded", "/anything", "Geo primary received request to path /anything"}, + } + + runTestCases(t, ws, testCases) +} + +// This test can be removed when the environment variable `GEO_SECONDARY_PROXY` is removed +func TestGeoProxyFeatureDisabledOnNonGeoSecondarySite(t *testing.T) { + geoProxyEndpointResponseBody := "{}" + railsServer, deferredClose := startRailsServer("Local Rails server", geoProxyEndpointResponseBody) + defer deferredClose() + + ws, wsDeferredClose := startWorkhorseServer(railsServer.URL, false) + defer wsDeferredClose() + + testCases := []testCase{ + {"jobs request is served locally", "/api/v4/jobs/request", "Local Rails server received request to path /api/v4/jobs/request"}, + {"health check is served locally", "/-/health", "Local Rails server received request to path /-/health"}, + {"unknown route is served locally", "/anything", "Local Rails server received request to path /anything"}, + } + + runTestCases(t, ws, testCases) +} + +func TestGeoProxyFeatureEnabledOnNonGeoSecondarySite(t *testing.T) { + geoProxyEndpointResponseBody := "{}" + railsServer, deferredClose := startRailsServer("Local Rails server", geoProxyEndpointResponseBody) + defer deferredClose() + + ws, wsDeferredClose := startWorkhorseServer(railsServer.URL, true) + defer wsDeferredClose() + + testCases := []testCase{ + {"jobs request is served locally", "/api/v4/jobs/request", "Local Rails server received request to path /api/v4/jobs/request"}, + {"health check is served locally", "/-/health", "Local Rails server received request to path /-/health"}, + {"unknown route is served locally", "/anything", "Local Rails server received request to path /anything"}, + } + + runTestCases(t, ws, testCases) +} + +func TestGeoProxyFeatureEnabledButWithAPIError(t *testing.T) { + geoProxyEndpointResponseBody := "Invalid response" + railsServer, deferredClose := startRailsServer("Local Rails server", geoProxyEndpointResponseBody) + defer deferredClose() + + ws, wsDeferredClose := startWorkhorseServer(railsServer.URL, true) + defer wsDeferredClose() + + testCases := []testCase{ + {"jobs request is served locally", "/api/v4/jobs/request", "Local Rails server received request to path /api/v4/jobs/request"}, + {"health check is served locally", "/-/health", "Local Rails server received request to path /-/health"}, + {"unknown route is served locally", "/anything", "Local Rails server received request to path /anything"}, + } + + runTestCases(t, ws, testCases) +} + +func runTestCases(t *testing.T, ws *httptest.Server, testCases []testCase) { + t.Helper() for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - resp, err := http.Get(ts.URL + tc.path) + resp, err := http.Get(ws.URL + tc.path) require.NoError(t, err) defer resp.Body.Close() @@ -61,7 +170,74 @@ func TestRouting(t *testing.T) { require.NoError(t, err) require.Equal(t, 200, resp.StatusCode, "response code") - require.Equal(t, tc.route, string(body)) + require.Equal(t, tc.expectedResponse, string(body)) }) } } + +func newUpstreamConfig(authBackend string) *config.Config { + return &config.Config{ + Version: "123", + DocumentRoot: testDocumentRoot, + Backend: helper.URLMustParse(authBackend), + ImageResizerConfig: config.DefaultImageResizerConfig, + } +} + +func startRemoteServer(serverName string) (*httptest.Server, func()) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + body := serverName + " received request to path " + r.URL.Path + + w.WriteHeader(200) + fmt.Fprint(w, body) + })) + + return ts, ts.Close +} + +func startRailsServer(railsServerName string, geoProxyEndpointResponseBody string) (*httptest.Server, func()) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var body string + + if r.URL.Path == geoProxyEndpoint { + w.Header().Set("Content-Type", "application/vnd.gitlab-workhorse+json") + body = geoProxyEndpointResponseBody + } else { + body = railsServerName + " received request to path " + r.URL.Path + } + + w.WriteHeader(200) + fmt.Fprint(w, body) + })) + + return ts, ts.Close +} + +func startWorkhorseServer(railsServerURL string, enableGeoProxyFeature bool) (*httptest.Server, func()) { + geoProxyTestChannel := make(chan struct{}) + + myConfigureRoutes := func(u *upstream) { + // Enable environment variable "feature flag" + u.enableGeoProxyFeature = enableGeoProxyFeature + + // An empty message will be sent to this channel after every callGeoProxyAPI() + u.geoProxyTestChannel = geoProxyTestChannel + + // call original + configureRoutes(u) + } + cfg := newUpstreamConfig(railsServerURL) + upstreamHandler := newUpstream(*cfg, logrus.StandardLogger(), myConfigureRoutes) + ws := httptest.NewServer(upstreamHandler) + testhelper.ConfigureSecret() + + if enableGeoProxyFeature { + // Wait for an empty message from callGeoProxyAPI(). This should be done on + // all tests where enableGeoProxyFeature is true, including the ones where + // we expect geoProxyURL to be nil or error, to ensure the tests do not pass + // by coincidence. + <-geoProxyTestChannel + } + + return ws, ws.Close +} diff --git a/workhorse/internal/zipartifacts/metadata_test.go b/workhorse/internal/zipartifacts/metadata_test.go index 0f130ab4c15..ffc5f58cb21 100644 --- a/workhorse/internal/zipartifacts/metadata_test.go +++ b/workhorse/internal/zipartifacts/metadata_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts" ) func generateTestArchive(w io.Writer) error { diff --git a/workhorse/internal/zipartifacts/open_archive.go b/workhorse/internal/zipartifacts/open_archive.go index 30b86b66c49..cf0e38e9ee0 100644 --- a/workhorse/internal/zipartifacts/open_archive.go +++ b/workhorse/internal/zipartifacts/open_archive.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/httprs" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/httprs" "gitlab.com/gitlab-org/labkit/correlation" "gitlab.com/gitlab-org/labkit/mask" diff --git a/workhorse/main.go b/workhorse/main.go index f5cb3f77746..6e7b80bc8c6 100644 --- a/workhorse/main.go +++ b/workhorse/main.go @@ -17,11 +17,11 @@ import ( "gitlab.com/gitlab-org/labkit/monitoring" "gitlab.com/gitlab-org/labkit/tracing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/queueing" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/redis" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/queueing" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/redis" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upstream" ) // Version is the current version of GitLab Workhorse @@ -152,6 +152,8 @@ func buildConfig(arg0 string, args []string) (*bootConfig, *config.Config, error cfg.ImageResizerConfig = cfgFromFile.ImageResizerConfig cfg.AltDocumentRoot = cfgFromFile.AltDocumentRoot cfg.ShutdownTimeout = cfgFromFile.ShutdownTimeout + cfg.TrustedCIDRsForXForwardedFor = cfgFromFile.TrustedCIDRsForXForwardedFor + cfg.TrustedCIDRsForPropagation = cfgFromFile.TrustedCIDRsForPropagation return boot, cfg, nil } diff --git a/workhorse/main_test.go b/workhorse/main_test.go index 1e59eea9cf1..6e61e2fc65a 100644 --- a/workhorse/main_test.go +++ b/workhorse/main_test.go @@ -26,13 +26,13 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" "gitlab.com/gitlab-org/labkit/log" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/config" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/gitaly" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/gitaly" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upstream" ) const scratchDir = "testdata/scratch" @@ -611,16 +611,53 @@ func TestPropagateCorrelationIdHeader(t *testing.T) { defer ts.Close() testCases := []struct { - desc string - propagateCorrelationID bool + desc string + propagateCorrelationID bool + xffHeader string + trustedCIDRsForPropagation []string + trustedCIDRsForXForwardedFor []string + propagationExpected bool }{ { desc: "propagateCorrelatedId is true", propagateCorrelationID: true, + propagationExpected: true, }, { desc: "propagateCorrelatedId is false", propagateCorrelationID: false, + propagationExpected: false, + }, + { + desc: "propagation with trusted propagation CIDR", + propagateCorrelationID: true, + // Assumes HTTP connection's RemoteAddr will be 127.0.0.1:x + trustedCIDRsForPropagation: []string{"127.0.0.1/8"}, + propagationExpected: true, + }, + { + desc: "propagation with trusted propagation and X-Forwarded-For CIDRs", + propagateCorrelationID: true, + // Assumes HTTP connection's RemoteAddr will be 127.0.0.1:x + xffHeader: "1.2.3.4, 127.0.0.1", + trustedCIDRsForPropagation: []string{"1.2.3.4/32"}, + trustedCIDRsForXForwardedFor: []string{"127.0.0.1/32", "192.168.0.1/32"}, + propagationExpected: true, + }, + { + desc: "propagation not active with invalid propagation CIDR", + propagateCorrelationID: true, + trustedCIDRsForPropagation: []string{"asdf"}, + propagationExpected: false, + }, + { + desc: "propagation with invalid X-Forwarded-For CIDR", + propagateCorrelationID: true, + // Assumes HTTP connection's RemoteAddr will be 127.0.0.1:x + xffHeader: "1.2.3.4, 127.0.0.1", + trustedCIDRsForPropagation: []string{"1.2.3.4/32"}, + trustedCIDRsForXForwardedFor: []string{"bad"}, + propagationExpected: false, }, } @@ -628,19 +665,27 @@ func TestPropagateCorrelationIdHeader(t *testing.T) { t.Run(tc.desc, func(t *testing.T) { upstreamConfig := newUpstreamConfig(ts.URL) upstreamConfig.PropagateCorrelationID = tc.propagateCorrelationID + upstreamConfig.TrustedCIDRsForPropagation = tc.trustedCIDRsForPropagation + upstreamConfig.TrustedCIDRsForXForwardedFor = tc.trustedCIDRsForXForwardedFor ws := startWorkhorseServerWithConfig(upstreamConfig) defer ws.Close() resource := "/api/v3/projects/123/repository/not/special" propagatedRequestId := "Propagated-RequestId-12345678" - resp, _ := httpGet(t, ws.URL+resource, map[string]string{"X-Request-Id": propagatedRequestId}) + headers := map[string]string{"X-Request-Id": propagatedRequestId} + + if tc.xffHeader != "" { + headers["X-Forwarded-For"] = tc.xffHeader + } + + resp, _ := httpGet(t, ws.URL+resource, headers) requestIds := resp.Header["X-Request-Id"] require.Equal(t, 200, resp.StatusCode, "GET %q: status code", resource) require.Equal(t, 1, len(requestIds), "GET %q: One X-Request-Id present", resource) - if tc.propagateCorrelationID { + if tc.propagationExpected { require.Contains(t, requestIds, propagatedRequestId, "GET %q: Has X-Request-Id %s present", resource, propagatedRequestId) } else { require.NotContains(t, requestIds, propagatedRequestId, "GET %q: X-Request-Id not propagated") diff --git a/workhorse/proxy_test.go b/workhorse/proxy_test.go index b5a7c9c6abf..48d7db428fd 100644 --- a/workhorse/proxy_test.go +++ b/workhorse/proxy_test.go @@ -11,11 +11,11 @@ import ( "testing" "time" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream/roundtripper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/badgateway" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/proxy" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upstream/roundtripper" "github.com/stretchr/testify/require" ) diff --git a/workhorse/raven.go b/workhorse/raven.go index f641203f142..2db24b0b3d4 100644 --- a/workhorse/raven.go +++ b/workhorse/raven.go @@ -6,7 +6,7 @@ import ( raven "github.com/getsentry/raven-go" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) func wrapRaven(h http.Handler) http.Handler { diff --git a/workhorse/upload_test.go b/workhorse/upload_test.go index cef0f3fe052..0c4ac2357a3 100644 --- a/workhorse/upload_test.go +++ b/workhorse/upload_test.go @@ -17,10 +17,10 @@ import ( "github.com/dgrijalva/jwt-go" "github.com/stretchr/testify/require" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/api" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/secret" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper" - "gitlab.com/gitlab-org/gitlab-workhorse/internal/upload" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/api" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/testhelper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/upload" ) type uploadArtifactsFunction func(url, contentType string, body io.Reader) (*http.Response, string, error) |