diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /workhorse | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'workhorse')
30 files changed, 185 insertions, 220 deletions
diff --git a/workhorse/.tool-versions b/workhorse/.tool-versions index c90984122a3..ee9584ceddc 100644 --- a/workhorse/.tool-versions +++ b/workhorse/.tool-versions @@ -1 +1 @@ -golang 1.17.9 +golang 1.18.7 diff --git a/workhorse/README.md b/workhorse/README.md index c57f90b4a49..3e1b2486426 100644 --- a/workhorse/README.md +++ b/workhorse/README.md @@ -1,7 +1,7 @@ --- stage: Create group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments --- # Workhorse documentation diff --git a/workhorse/doc/architecture/channel.md b/workhorse/doc/architecture/channel.md deleted file mode 100644 index 04bb0e7652f..00000000000 --- a/workhorse/doc/architecture/channel.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -stage: Create -group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments -redirect_to: '../../../doc/development/backend/create_source_code_be/workhorse/channel.md' -remove_date: '2022-07-01' ---- - -# Websocket channel support - -This document was moved to [another location](../../../doc/development/workhorse/channel.md). - -<!-- This redirect file can be deleted after <2022-07-01>. --> -<!-- Redirects that point to other docs in the same project expire in three months. --> -<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html --> diff --git a/workhorse/doc/architecture/gitlab_features.md b/workhorse/doc/architecture/gitlab_features.md deleted file mode 100644 index 42dd919690d..00000000000 --- a/workhorse/doc/architecture/gitlab_features.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -stage: Create -group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments ---- - -# Features that rely on Workhorse - -This document was moved to [another location](../../../doc/development/workhorse/gitlab_features.md). - -<!-- This redirect file can be deleted after <2022-07-01>. --> -<!-- Redirects that point to other docs in the same project expire in three months. --> -<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html --> diff --git a/workhorse/doc/channel.md b/workhorse/doc/channel.md deleted file mode 100644 index 86078321dff..00000000000 --- a/workhorse/doc/channel.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -stage: Create -group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments ---- - -# Websocket channel support - -This document was moved to [another location](../../doc/development/workhorse/channel.md). - -<!-- This redirect file can be deleted after <2022-07-01>. --> -<!-- Redirects that point to other docs in the same project expire in three months. --> -<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html --> diff --git a/workhorse/doc/development/new_features.md b/workhorse/doc/development/new_features.md deleted file mode 100644 index 60f0ad75539..00000000000 --- a/workhorse/doc/development/new_features.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -stage: Create -group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments ---- - -# Adding new features to Workhorse - -This document was moved to [another location](../../../doc/development/workhorse/new_features.md). - -<!-- This redirect file can be deleted after <2022-07-01>. --> -<!-- Redirects that point to other docs in the same project expire in three months. --> -<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html --> diff --git a/workhorse/doc/development/tests.md b/workhorse/doc/development/tests.md deleted file mode 100644 index a5eb7571cc0..00000000000 --- a/workhorse/doc/development/tests.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -stage: Create -group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments ---- - -# Testing your code - -This document was moved to [another location](../../../doc/development/workhorse/index.md). - -<!-- This redirect file can be deleted after <2022-07-01>. --> -<!-- Redirects that point to other docs in the same project expire in three months. --> -<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html --> diff --git a/workhorse/doc/operations/configuration.md b/workhorse/doc/operations/configuration.md deleted file mode 100644 index 62dc8369dfb..00000000000 --- a/workhorse/doc/operations/configuration.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -stage: Create -group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments ---- - -# Workhorse configuration - -This document was moved to [another location](../../../doc/development/workhorse/configuration.md). - -<!-- This redirect file can be deleted after <2022-07-01>. --> -<!-- Redirects that point to other docs in the same project expire in three months. --> -<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html --> diff --git a/workhorse/doc/operations/install.md b/workhorse/doc/operations/install.md deleted file mode 100644 index 9f0a8212783..00000000000 --- a/workhorse/doc/operations/install.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -stage: Create -group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments ---- - -# Installation - -This document was moved to [another location](../../../doc/development/workhorse/index.md). - -<!-- This redirect file can be deleted after <2022-07-01>. --> -<!-- Redirects that point to other docs in the same project expire in three months. --> -<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html --> diff --git a/workhorse/go.mod b/workhorse/go.mod index 500753bbf97..ec78a85e413 100644 --- a/workhorse/go.mod +++ b/workhorse/go.mod @@ -5,9 +5,9 @@ go 1.17 require ( github.com/Azure/azure-storage-blob-go v0.14.0 github.com/BurntSushi/toml v1.2.0 - github.com/FZambia/sentinel v1.1.0 - github.com/alecthomas/chroma/v2 v2.2.0 - github.com/aws/aws-sdk-go v1.43.31 + github.com/FZambia/sentinel v1.1.1 + github.com/alecthomas/chroma/v2 v2.3.0 + github.com/aws/aws-sdk-go v1.44.116 github.com/disintegration/imaging v1.6.2 github.com/getsentry/raven-go v0.2.0 github.com/golang-jwt/jwt/v4 v4.4.2 @@ -26,7 +26,7 @@ require ( github.com/sirupsen/logrus v1.9.0 github.com/smartystreets/goconvey v1.7.2 github.com/stretchr/testify v1.8.0 - gitlab.com/gitlab-org/gitaly/v15 v15.4.0-rc2 + gitlab.com/gitlab-org/gitaly/v15 v15.4.2 gitlab.com/gitlab-org/golang-archive-zip v0.1.1 gitlab.com/gitlab-org/labkit v1.16.0 gocloud.dev v0.26.0 @@ -34,7 +34,7 @@ require ( golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 golang.org/x/net v0.0.0-20220722155237-a158d28d115b golang.org/x/tools v0.1.12 - google.golang.org/grpc v1.49.0 + google.golang.org/grpc v1.50.1 google.golang.org/protobuf v1.28.1 honnef.co/go/tools v0.3.3 ) @@ -108,7 +108,7 @@ require ( golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/text v0.3.8 // indirect golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/api v0.74.0 // indirect diff --git a/workhorse/go.sum b/workhorse/go.sum index 30c7fec32d2..67392ede877 100644 --- a/workhorse/go.sum +++ b/workhorse/go.sum @@ -134,8 +134,8 @@ github.com/DataDog/datadog-go v4.4.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/gostackparse v0.5.0/go.mod h1:lTfqcJKqS9KnXQGnyQMCugq3u1FP6UZMfWR0aitKFMM= github.com/DataDog/sketches-go v1.0.0 h1:chm5KSXO7kO+ywGWJ0Zs6tdmWU8PBXSbywFVciL6BG4= github.com/DataDog/sketches-go v1.0.0/go.mod h1:O+XkJHWk9w4hDwY2ZUDU31ZC9sNYlYo8DiFsxjYeo1k= -github.com/FZambia/sentinel v1.1.0 h1:qrCBfxc8SvJihYNjBWgwUI93ZCvFe/PJIPTHKmlp8a8= -github.com/FZambia/sentinel v1.1.0/go.mod h1:ytL1Am/RLlAoAXG6Kj5LNuw/TRRQrv2rt2FT26vP5gI= +github.com/FZambia/sentinel v1.1.1 h1:0ovTimlR7Ldm+wR15GgO+8C2dt7kkn+tm3PQS+Qk3Ek= +github.com/FZambia/sentinel v1.1.1/go.mod h1:ytL1Am/RLlAoAXG6Kj5LNuw/TRRQrv2rt2FT26vP5gI= github.com/GoogleCloudPlatform/cloudsql-proxy v1.29.0/go.mod h1:spvB9eLJH9dutlbPSRmHvSXXHOwGRyeXh1jVdquA2G8= github.com/HdrHistogram/hdrhistogram-go v1.1.1 h1:cJXY5VLMHgejurPjZH6Fo9rIwRGLefBGdiaENZALqrg= github.com/HdrHistogram/hdrhistogram-go v1.1.1/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= @@ -149,17 +149,17 @@ github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugX github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXGjwU= github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/ProtonMail/go-crypto v0.0.0-20220810064516-de89276ce0f3/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= +github.com/ProtonMail/go-crypto v0.0.0-20220824120805-4b6e5c587895/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= -github.com/alecthomas/chroma/v2 v2.2.0 h1:Aten8jfQwUqEdadVFFjNyjx7HTexhKP0XuqBG67mRDY= -github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs= -github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae h1:zzGwJfFlFGD94CyyYwCJeSuD32Gj9GTaSi5y9hoVzdY= -github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= +github.com/alecthomas/chroma/v2 v2.3.0 h1:83xfxrnjv8eK+Cf8qZDzNo3PPF9IbTWHs7z28GY6D0U= +github.com/alecthomas/chroma/v2 v2.3.0/go.mod h1:mZxeWZlxP2Dy+/8cBob2PYd8O2DwNAzave5AY7A2eQw= +github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE= +github.com/alecthomas/repr v0.1.0/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -178,8 +178,9 @@ github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevB github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.17.4/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.43.31 h1:yJZIr8nMV1hXjAvvOLUFqZRJcHV7udPQBfhJqawDzI0= github.com/aws/aws-sdk-go v1.43.31/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go v1.44.116 h1:NpLIhcvLWXJZAEwvPj3TDHeqp7DleK6ZUVYyW01WNHY= +github.com/aws/aws-sdk-go v1.44.116/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go-v2 v1.16.2 h1:fqlCk6Iy3bnCumtrLz9r3mJ/2gUT0pJ0wLFVIdWh+JA= github.com/aws/aws-sdk-go-v2 v1.16.2/go.mod h1:ytwTPBG6fXTZLxxeeCCWj2/EMYp/xDUgX+OET6TLNNU= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.1 h1:SdK4Ppk5IzLs64ZMvr6MrSficMtjY2oS0WOORXTlxwU= @@ -604,11 +605,12 @@ github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9 github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= github.com/jackc/pgx/v4 v4.15.0/go.mod h1:D/zyOyXiaM1TmVWnOM18p0xdDtdakRBa0RsVGI3U3bw= -github.com/jackc/pgx/v4 v4.17.0/go.mod h1:Gd6RmOhtFLTu8cp/Fhq4kP195KrshxYJH3oW8AWJ1pw= +github.com/jackc/pgx/v4 v4.17.2/go.mod h1:lcxIZN44yMIrWI78a5CpucdD14hX0SBDbNRvjDBItsw= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= @@ -781,7 +783,7 @@ github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwp github.com/pelletier/go-toml v1.0.1-0.20170904195809-1d6b12b7cb29/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.3/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= +github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/philhofer/fwd v1.1.1 h1:GdGcTjf5RNAxwS4QLsiMzJYj5KEvPJD3Abr261yRQXQ= github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= @@ -947,8 +949,8 @@ github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= -gitlab.com/gitlab-org/gitaly/v15 v15.4.0-rc2 h1:ngV/NWEMz4TRlnJFzBpatdXkEIDMHsU3YUzGdZU63qY= -gitlab.com/gitlab-org/gitaly/v15 v15.4.0-rc2/go.mod h1:Rv/LoDU5I3cOP6KLUWFjC1eigcay2u8b8ZcsW86A0Xo= +gitlab.com/gitlab-org/gitaly/v15 v15.4.2 h1:evAILjEjT7M+pegcbP4QsViK4Hkt1I1IwJAr5AQjbdY= +gitlab.com/gitlab-org/gitaly/v15 v15.4.2/go.mod h1:anANn2UwrECvFOEvLx8DkXYYDQ6g3+jmv0kP2VDYm70= gitlab.com/gitlab-org/golang-archive-zip v0.1.1 h1:35k9giivbxwF03+8A05Cm8YoxoakU8FBCj5gysjCTCE= gitlab.com/gitlab-org/golang-archive-zip v0.1.1/go.mod h1:ZDtqpWPGPB9qBuZnZDrKQjIdJtkN7ZAoVwhT6H2o2kE= gitlab.com/gitlab-org/labkit v1.16.0 h1:Vm3NAMZ8RqAunXlvPWby3GJ2R35vsYGP6Uu0YjyMIlY= @@ -1278,8 +1280,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/time v0.0.0-20170424234030-8be79e1e0910/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1546,9 +1549,9 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/workhorse/internal/api/api.go b/workhorse/internal/api/api.go index aa6d7cf1bc7..6a6a51b27bb 100644 --- a/workhorse/internal/api/api.go +++ b/workhorse/internal/api/api.go @@ -19,7 +19,6 @@ import ( "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/secret" ) diff --git a/workhorse/internal/dependencyproxy/dependencyproxy.go b/workhorse/internal/dependencyproxy/dependencyproxy.go index 90f3042a342..6651b5aee84 100644 --- a/workhorse/internal/dependencyproxy/dependencyproxy.go +++ b/workhorse/internal/dependencyproxy/dependencyproxy.go @@ -9,12 +9,12 @@ import ( "gitlab.com/gitlab-org/labkit/log" "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper/httptransport" "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/transport" ) var httpClient = &http.Client{ - Transport: httptransport.New(), + Transport: transport.NewRestrictedTransport(), } type Injector struct { diff --git a/workhorse/internal/helper/httptransport/http_transport.go b/workhorse/internal/helper/httptransport/http_transport.go deleted file mode 100644 index c7c3c5283f5..00000000000 --- a/workhorse/internal/helper/httptransport/http_transport.go +++ /dev/null @@ -1,37 +0,0 @@ -package httptransport - -import ( - "net/http" - "time" - - "gitlab.com/gitlab-org/labkit/correlation" - "gitlab.com/gitlab-org/labkit/tracing" -) - -type Option func(*http.Transport) - -// Defines a http.Transport with values -// that are more restrictive than for http.DefaultTransport, -// they define shorter TLS Handshake, and more aggressive connection closing -// to prevent the connection hanging and reduce FD usage -func New(options ...Option) http.RoundTripper { - t := http.DefaultTransport.(*http.Transport).Clone() - - // To avoid keep around TCP connections to http servers we're done with - t.MaxIdleConns = 2 - - // A stricter timeout for fetching from external sources that can be slow - t.ResponseHeaderTimeout = 30 * time.Second - - for _, option := range options { - option(t) - } - - return tracing.NewRoundTripper(correlation.NewInstrumentedRoundTripper(t)) -} - -func WithDisabledCompression() Option { - return func(t *http.Transport) { - t.DisableCompression = true - } -} diff --git a/workhorse/internal/imageresizer/image_resizer.go b/workhorse/internal/imageresizer/image_resizer.go index 8c3271b6f11..092369cd2af 100644 --- a/workhorse/internal/imageresizer/image_resizer.go +++ b/workhorse/internal/imageresizer/image_resizer.go @@ -21,9 +21,9 @@ import ( "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" - "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper/httptransport" "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/transport" ) type Resizer struct { @@ -69,7 +69,7 @@ const ( var envInjector = tracing.NewEnvInjector() var httpClient = &http.Client{ - Transport: httptransport.New(), + Transport: transport.NewRestrictedTransport(), } const ( diff --git a/workhorse/internal/queueing/queue.go b/workhorse/internal/queueing/queue.go index db082cf19c6..c8d32280355 100644 --- a/workhorse/internal/queueing/queue.go +++ b/workhorse/internal/queueing/queue.go @@ -26,11 +26,10 @@ type queueMetrics struct { // newQueueMetrics prepares Prometheus metrics for queueing mechanism // name specifies name of the queue, used to label metrics with ConstLabel `queue_name` -// Don't call newQueueMetrics twice with the same name argument! // timeout specifies the timeout of storing a request in queue - queueMetrics // uses it to calculate histogram buckets for gitlab_workhorse_queueing_waiting_time // metric -func newQueueMetrics(name string, timeout time.Duration) *queueMetrics { +func newQueueMetrics(name string, timeout time.Duration, reg prometheus.Registerer) *queueMetrics { waitingTimeBuckets := []float64{ timeout.Seconds() * 0.01, timeout.Seconds() * 0.05, @@ -44,8 +43,9 @@ func newQueueMetrics(name string, timeout time.Duration) *queueMetrics { timeout.Seconds(), } + promFactory := promauto.With(reg) metrics := &queueMetrics{ - queueingLimit: promauto.NewGauge(prometheus.GaugeOpts{ + queueingLimit: promFactory.NewGauge(prometheus.GaugeOpts{ Name: "gitlab_workhorse_queueing_limit", Help: "Current limit set for the queueing mechanism", ConstLabels: prometheus.Labels{ @@ -53,7 +53,7 @@ func newQueueMetrics(name string, timeout time.Duration) *queueMetrics { }, }), - queueingQueueLimit: promauto.NewGauge(prometheus.GaugeOpts{ + queueingQueueLimit: promFactory.NewGauge(prometheus.GaugeOpts{ Name: "gitlab_workhorse_queueing_queue_limit", Help: "Current queueLimit set for the queueing mechanism", ConstLabels: prometheus.Labels{ @@ -61,7 +61,7 @@ func newQueueMetrics(name string, timeout time.Duration) *queueMetrics { }, }), - queueingQueueTimeout: promauto.NewGauge(prometheus.GaugeOpts{ + queueingQueueTimeout: promFactory.NewGauge(prometheus.GaugeOpts{ Name: "gitlab_workhorse_queueing_queue_timeout", Help: "Current queueTimeout set for the queueing mechanism", ConstLabels: prometheus.Labels{ @@ -69,7 +69,7 @@ func newQueueMetrics(name string, timeout time.Duration) *queueMetrics { }, }), - queueingBusy: promauto.NewGauge(prometheus.GaugeOpts{ + queueingBusy: promFactory.NewGauge(prometheus.GaugeOpts{ Name: "gitlab_workhorse_queueing_busy", Help: "How many queued requests are now processed", ConstLabels: prometheus.Labels{ @@ -77,7 +77,7 @@ func newQueueMetrics(name string, timeout time.Duration) *queueMetrics { }, }), - queueingWaiting: promauto.NewGauge(prometheus.GaugeOpts{ + queueingWaiting: promFactory.NewGauge(prometheus.GaugeOpts{ Name: "gitlab_workhorse_queueing_waiting", Help: "How many requests are now queued", ConstLabels: prometheus.Labels{ @@ -85,7 +85,7 @@ func newQueueMetrics(name string, timeout time.Duration) *queueMetrics { }, }), - queueingWaitingTime: promauto.NewHistogram(prometheus.HistogramOpts{ + queueingWaitingTime: promFactory.NewHistogram(prometheus.HistogramOpts{ Name: "gitlab_workhorse_queueing_waiting_time", Help: "How many time a request spent in queue", ConstLabels: prometheus.Labels{ @@ -94,7 +94,7 @@ func newQueueMetrics(name string, timeout time.Duration) *queueMetrics { Buckets: waitingTimeBuckets, }), - queueingErrors: promauto.NewCounterVec( + queueingErrors: promFactory.NewCounterVec( prometheus.CounterOpts{ Name: "gitlab_workhorse_queueing_errors", Help: "How many times the TooManyRequests or QueueintTimedout errors were returned while queueing, partitioned by error type", @@ -120,12 +120,11 @@ type Queue struct { // newQueue creates a new queue // name specifies name used to label queue metrics. -// Don't call newQueue twice with the same name argument! // limit specifies number of requests run concurrently // queueLimit specifies maximum number of requests that can be queued // timeout specifies the time limit of storing the request in the queue // if the number of requests is above the limit -func newQueue(name string, limit, queueLimit uint, timeout time.Duration) *Queue { +func newQueue(name string, limit, queueLimit uint, timeout time.Duration, reg prometheus.Registerer) *Queue { queue := &Queue{ name: name, busyCh: make(chan struct{}, limit), @@ -133,7 +132,7 @@ func newQueue(name string, limit, queueLimit uint, timeout time.Duration) *Queue timeout: timeout, } - queue.queueMetrics = newQueueMetrics(name, timeout) + queue.queueMetrics = newQueueMetrics(name, timeout, reg) queue.queueingLimit.Set(float64(limit)) queue.queueingQueueLimit.Set(float64(queueLimit)) queue.queueingQueueTimeout.Set(timeout.Seconds()) diff --git a/workhorse/internal/queueing/queue_test.go b/workhorse/internal/queueing/queue_test.go index 7f5ed9154f4..dee0df76c67 100644 --- a/workhorse/internal/queueing/queue_test.go +++ b/workhorse/internal/queueing/queue_test.go @@ -3,10 +3,12 @@ package queueing import ( "testing" "time" + + "github.com/prometheus/client_golang/prometheus" ) func TestNormalQueueing(t *testing.T) { - q := newQueue("queue 1", 2, 1, time.Microsecond) + q := newQueue("queue name", 2, 1, time.Microsecond, prometheus.NewRegistry()) err1 := q.Acquire() if err1 != nil { t.Fatal("we should acquire a new slot") @@ -31,7 +33,7 @@ func TestNormalQueueing(t *testing.T) { } func TestQueueLimit(t *testing.T) { - q := newQueue("queue 2", 1, 0, time.Microsecond) + q := newQueue("queue name", 1, 0, time.Microsecond, prometheus.NewRegistry()) err1 := q.Acquire() if err1 != nil { t.Fatal("we should acquire a new slot") @@ -44,7 +46,7 @@ func TestQueueLimit(t *testing.T) { } func TestQueueProcessing(t *testing.T) { - q := newQueue("queue 3", 1, 1, time.Second) + q := newQueue("queue name", 1, 1, time.Second, prometheus.NewRegistry()) err1 := q.Acquire() if err1 != nil { t.Fatal("we should acquire a new slot") diff --git a/workhorse/internal/queueing/requests.go b/workhorse/internal/queueing/requests.go index 3a22cb367ce..34d4c985f53 100644 --- a/workhorse/internal/queueing/requests.go +++ b/workhorse/internal/queueing/requests.go @@ -4,6 +4,8 @@ import ( "net/http" "time" + "github.com/prometheus/client_golang/prometheus" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" ) @@ -19,7 +21,7 @@ const ( // limit specifies number of requests run concurrently // queueLimit specifies maximum number of requests that can be queued // queueTimeout specifies the time limit of storing the request in the queue -func QueueRequests(name string, h http.Handler, limit, queueLimit uint, queueTimeout time.Duration) http.Handler { +func QueueRequests(name string, h http.Handler, limit, queueLimit uint, queueTimeout time.Duration, reg prometheus.Registerer) http.Handler { if limit == 0 { return h } @@ -27,7 +29,7 @@ func QueueRequests(name string, h http.Handler, limit, queueLimit uint, queueTim queueTimeout = DefaultTimeout } - queue := newQueue(name, limit, queueLimit, queueTimeout) + queue := newQueue(name, limit, queueLimit, queueTimeout, reg) return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { err := queue.Acquire() diff --git a/workhorse/internal/queueing/requests_test.go b/workhorse/internal/queueing/requests_test.go index f1c52e5c6f5..eb098a6242e 100644 --- a/workhorse/internal/queueing/requests_test.go +++ b/workhorse/internal/queueing/requests_test.go @@ -6,6 +6,8 @@ import ( "net/http/httptest" "testing" "time" + + "github.com/prometheus/client_golang/prometheus" ) var httpHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -21,7 +23,7 @@ func pausedHttpHandler(pauseCh chan struct{}) http.Handler { func TestNormalRequestProcessing(t *testing.T) { w := httptest.NewRecorder() - h := QueueRequests("Normal request processing", httpHandler, 1, 1, time.Second) + h := QueueRequests("Normal request processing", httpHandler, 1, 1, time.Second, prometheus.NewRegistry()) h.ServeHTTP(w, nil) if w.Code != 200 { t.Fatal("QueueRequests should process request") @@ -36,7 +38,7 @@ func testSlowRequestProcessing(name string, count int, limit, queueLimit uint, q pauseCh := make(chan struct{}) defer close(pauseCh) - handler := QueueRequests("Slow request processing: "+name, pausedHttpHandler(pauseCh), limit, queueLimit, queueTimeout) + handler := QueueRequests("Slow request processing: "+name, pausedHttpHandler(pauseCh), limit, queueLimit, queueTimeout, prometheus.NewRegistry()) respCh := make(chan *httptest.ResponseRecorder, count) diff --git a/workhorse/internal/redis/redis.go b/workhorse/internal/redis/redis.go index 588fba6e242..03118cfcef6 100644 --- a/workhorse/internal/redis/redis.go +++ b/workhorse/internal/redis/redis.go @@ -1,7 +1,6 @@ package redis import ( - "errors" "fmt" "net" "net/url" @@ -164,7 +163,15 @@ func sentinelDialer(dopts []redis.DialOption) redisDialerFunc { return nil, err } dopts = append(dopts, redis.DialNetDial(keepAliveDialer)) - return redisDial("tcp", address, dopts...) + conn, err := redisDial("tcp", address, dopts...) + if err != nil { + return nil, err + } + if !sentinel.TestRole(conn, "master") { + conn.Close() + return nil, fmt.Errorf("%s is not redis master", address) + } + return conn, nil } } @@ -247,14 +254,6 @@ func Configure(cfg *config.RedisConfig, dialFunc func(*config.RedisConfig, bool) Dial: poolDialFunc, Wait: true, } - if sntnl != nil { - pool.TestOnBorrow = func(c redis.Conn, t time.Time) error { - if !sentinel.TestRole(c, "master") { - return errors.New("role check failed") - } - return nil - } - } } // Get a connection for the Redis-pool diff --git a/workhorse/internal/sendurl/sendurl.go b/workhorse/internal/sendurl/sendurl.go index 205ec8a0e9f..8e679c6b475 100644 --- a/workhorse/internal/sendurl/sendurl.go +++ b/workhorse/internal/sendurl/sendurl.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/helper/httptransport" "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" "gitlab.com/gitlab-org/gitlab/workhorse/internal/senddata" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/transport" ) type entry struct{ senddata.Prefix } @@ -44,7 +44,7 @@ var preserveHeaderKeys = map[string]bool{ "Pragma": true, // Support for HTTP 1.0 proxies } -var httpTransport = httptransport.New() +var httpTransport = transport.NewRestrictedTransport() var httpClient = &http.Client{ Transport: httpTransport, diff --git a/workhorse/internal/transport/transport.go b/workhorse/internal/transport/transport.go new file mode 100644 index 00000000000..f19d332a28a --- /dev/null +++ b/workhorse/internal/transport/transport.go @@ -0,0 +1,58 @@ +package transport + +import ( + "net/http" + "time" + + "gitlab.com/gitlab-org/labkit/correlation" + "gitlab.com/gitlab-org/labkit/tracing" + + "gitlab.com/gitlab-org/gitlab/workhorse/internal/version" +) + +// Creates a new default transport that has Workhorse's User-Agent header set. +func NewDefaultTransport() http.RoundTripper { + return &DefaultTransport{Next: http.DefaultTransport} +} + +// Defines a http.Transport with values that are more restrictive than for +// http.DefaultTransport, they define shorter TLS Handshake, and more +// aggressive connection closing to prevent the connection hanging and reduce +// FD usage +func NewRestrictedTransport(options ...Option) http.RoundTripper { + return &DefaultTransport{Next: newRestrictedTransport(options...)} +} + +type DefaultTransport struct { + Next http.RoundTripper +} + +func (t DefaultTransport) RoundTrip(req *http.Request) (*http.Response, error) { + req.Header.Set("User-Agent", version.GetUserAgent()) + + return t.Next.RoundTrip(req) +} + +type Option func(*http.Transport) + +func WithDisabledCompression() Option { + return func(t *http.Transport) { + t.DisableCompression = true + } +} + +func newRestrictedTransport(options ...Option) http.RoundTripper { + t := http.DefaultTransport.(*http.Transport).Clone() + + // To avoid keep around TCP connections to http servers we're done with + t.MaxIdleConns = 2 + + // A stricter timeout for fetching from external sources that can be slow + t.ResponseHeaderTimeout = 30 * time.Second + + for _, option := range options { + option(t) + } + + return tracing.NewRoundTripper(correlation.NewInstrumentedRoundTripper(t)) +} diff --git a/workhorse/internal/upload/destination/objectstore/object.go b/workhorse/internal/upload/destination/objectstore/object.go index 36ffa0eb12e..1086332312c 100644 --- a/workhorse/internal/upload/destination/objectstore/object.go +++ b/workhorse/internal/upload/destination/objectstore/object.go @@ -8,11 +8,11 @@ import ( "gitlab.com/gitlab-org/labkit/mask" - "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper/httptransport" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/transport" ) var httpClient = &http.Client{ - Transport: httptransport.New(), + Transport: transport.NewRestrictedTransport(), } // Object represents an object on a S3 compatible Object Store service. diff --git a/workhorse/internal/upload/destination/objectstore/s3_session.go b/workhorse/internal/upload/destination/objectstore/s3_session.go index d71b38eb22e..e1fe6fbbdc9 100644 --- a/workhorse/internal/upload/destination/objectstore/s3_session.go +++ b/workhorse/internal/upload/destination/objectstore/s3_session.go @@ -37,17 +37,13 @@ func (s *s3Session) isExpired() bool { return time.Now().After(s.expiry) } -func newS3SessionCache() *s3SessionCache { - return &s3SessionCache{sessions: make(map[config.S3Config]*s3Session)} -} - var ( // By default, it looks like IAM instance profiles may last 6 hours // (via curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role_name>), // but this may be configurable from anywhere for 15 minutes to 12 // hours. To be safe, refresh AWS sessions every 10 minutes. sessionExpiration = time.Duration(10 * time.Minute) - sessionCache = newS3SessionCache() + sessionCache = &s3SessionCache{sessions: make(map[config.S3Config]*s3Session)} ) // SetupS3Session initializes a new AWS S3 session and refreshes one if @@ -105,10 +101,3 @@ func setupS3Session(s3Credentials config.S3Credentials, s3Config config.S3Config return sess, nil } - -func ResetS3Session(s3Config config.S3Config) { - sessionCache.Lock() - defer sessionCache.Unlock() - - delete(sessionCache.sessions, s3Config) -} diff --git a/workhorse/internal/upload/destination/objectstore/s3_session_test.go b/workhorse/internal/upload/destination/objectstore/s3_session_test.go index 4bbe38f90ec..b7bbee0ef69 100644 --- a/workhorse/internal/upload/destination/objectstore/s3_session_test.go +++ b/workhorse/internal/upload/destination/objectstore/s3_session_test.go @@ -12,6 +12,8 @@ import ( ) func TestS3SessionSetup(t *testing.T) { + resetS3Sessions() + credentials := config.S3Credentials{} cfg := config.S3Config{Region: "us-west-1", PathStyle: true} @@ -28,11 +30,11 @@ func TestS3SessionSetup(t *testing.T) { _, err = setupS3Session(credentials, anotherConfig) require.NoError(t, err) require.Equal(t, len(sessionCache.sessions), 1) - - ResetS3Session(cfg) } func TestS3SessionEndpointSetup(t *testing.T) { + resetS3Sessions() + credentials := config.S3Credentials{} const customS3Endpoint = "https://example.com" const region = "us-west-2" @@ -48,11 +50,11 @@ func TestS3SessionEndpointSetup(t *testing.T) { stsConfig := sess.ClientConfig(endpoints.StsServiceID) require.Equal(t, "https://sts.amazonaws.com", stsConfig.Endpoint, "STS should use default endpoint") - - ResetS3Session(cfg) } func TestS3SessionExpiry(t *testing.T) { + resetS3Sessions() + credentials := config.S3Credentials{} cfg := config.S3Config{Region: "us-west-1", PathStyle: true} @@ -75,6 +77,10 @@ func TestS3SessionExpiry(t *testing.T) { nextSession, ok := sessionCache.sessions[cfg] require.True(t, ok) require.False(t, nextSession.isExpired()) +} - ResetS3Session(cfg) +func resetS3Sessions() { + sessionCache.Lock() + defer sessionCache.Unlock() + sessionCache.sessions = make(map[config.S3Config]*s3Session) } diff --git a/workhorse/internal/upstream/routes.go b/workhorse/internal/upstream/routes.go index 40cd012a890..08e3ef8c9f1 100644 --- a/workhorse/internal/upstream/routes.go +++ b/workhorse/internal/upstream/routes.go @@ -6,6 +6,7 @@ import ( "regexp" "github.com/gorilla/websocket" + "github.com/prometheus/client_golang/prometheus" "gitlab.com/gitlab-org/labkit/log" "gitlab.com/gitlab-org/labkit/tracing" @@ -221,7 +222,7 @@ func configureRoutes(u *upstream) { mimeMultipartUploader := upload.Multipart(api, signingProxy, preparer) tempfileMultipartProxy := upload.FixedPreAuthMultipart(api, proxy, preparer) - ciAPIProxyQueue := queueing.QueueRequests("ci_api_job_requests", tempfileMultipartProxy, u.APILimit, u.APIQueueLimit, u.APIQueueTimeout) + ciAPIProxyQueue := queueing.QueueRequests("ci_api_job_requests", tempfileMultipartProxy, u.APILimit, u.APIQueueLimit, u.APIQueueTimeout, prometheus.DefaultRegisterer) ciAPILongPolling := builds.RegisterHandler(ciAPIProxyQueue, u.watchKeyHandler, u.APICILongPollingDuration) dependencyProxyInjector.SetUploadHandler(requestBodyUploader) diff --git a/workhorse/internal/version/version.go b/workhorse/internal/version/version.go new file mode 100644 index 00000000000..790edf8ffca --- /dev/null +++ b/workhorse/internal/version/version.go @@ -0,0 +1,20 @@ +package version + +import "fmt" + +var version = "unknown" +var build = "unknown" +var schema = "gitlab-workhorse (%s)-(%s)" + +func SetVersion(v, b string) { + version = v + build = b +} + +func GetUserAgent() string { + return GetApplicationVersion() +} + +func GetApplicationVersion() string { + return fmt.Sprintf(schema, version, build) +} diff --git a/workhorse/internal/version/version_test.go b/workhorse/internal/version/version_test.go new file mode 100644 index 00000000000..9d0581e093b --- /dev/null +++ b/workhorse/internal/version/version_test.go @@ -0,0 +1,19 @@ +package version + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestVersion(t *testing.T) { + require.Equal(t, GetApplicationVersion(), "gitlab-workhorse (unknown)-(unknown)") + + SetVersion("15.3", "123.123") + + require.Equal(t, GetApplicationVersion(), "gitlab-workhorse (15.3)-(123.123)") + + SetVersion("", "123.123") + + require.Equal(t, GetApplicationVersion(), "gitlab-workhorse ()-(123.123)") +} diff --git a/workhorse/internal/zipartifacts/open_archive.go b/workhorse/internal/zipartifacts/open_archive.go index 881ef915d75..d477725a39f 100644 --- a/workhorse/internal/zipartifacts/open_archive.go +++ b/workhorse/internal/zipartifacts/open_archive.go @@ -8,16 +8,16 @@ import ( "os" "strings" - "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper/httptransport" "gitlab.com/gitlab-org/gitlab/workhorse/internal/httprs" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/transport" zip "gitlab.com/gitlab-org/golang-archive-zip" "gitlab.com/gitlab-org/labkit/mask" ) var httpClient = &http.Client{ - Transport: httptransport.New( - httptransport.WithDisabledCompression(), // To avoid bugs when serving compressed files from object storage + Transport: transport.NewRestrictedTransport( + transport.WithDisabledCompression(), // To avoid bugs when serving compressed files from object storage ), } diff --git a/workhorse/main.go b/workhorse/main.go index b0f9760b0d5..ca9b86de528 100644 --- a/workhorse/main.go +++ b/workhorse/main.go @@ -23,6 +23,7 @@ import ( "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/version" ) // Version is the current version of GitLab Workhorse @@ -55,8 +56,10 @@ func main() { os.Exit(2) } + version.SetVersion(Version, BuildTime) + if boot.printVersion { - fmt.Printf("gitlab-workhorse %s-%s\n", Version, BuildTime) + fmt.Println(version.GetApplicationVersion()) os.Exit(0) } |