Skip to content

Commit 6dfa2cc

Browse files
committed
fix: ignore errors on duplicate SetHeader calls
Updating gRPC library to 1.47 version makes it more picky about the duplicate calls to `SetHeader`. Due to the nature of proxying, we might try to set it multiple times, so simply ignore the error (doing best effort to set it correctly, but with multiple upstreams setting headers from all upstreams is not possible). Signed-off-by: Andrey Smirnov <[email protected]>
1 parent b076302 commit 6dfa2cc

File tree

16 files changed

+290
-131
lines changed

16 files changed

+290
-131
lines changed

.codecov.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2021-03-25T21:15:43Z by kres 424ae88-dirty.
3+
# Generated on 2022-06-06T17:35:55Z by kres 65530e7.
44

55
codecov:
6-
require_ci_to_pass: false
6+
require_ci_to_pass: false
77

88
coverage:
9-
status:
10-
project:
11-
default:
12-
target: 50%
13-
threshold: 0.5%
14-
base: auto
15-
if_ci_failed: success
16-
patch: off
9+
status:
10+
project:
11+
default:
12+
target: 50%
13+
threshold: 0.5%
14+
base: auto
15+
if_ci_failed: success
16+
patch: off
1717

1818
comment: false

.conform.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2021-03-25T21:16:46Z by kres 424ae88-dirty.
3+
# Generated on 2022-06-06T17:35:55Z by kres 65530e7.
44

5+
---
56
policies:
67
- type: commit
78
spec:
89
dco: true
9-
gpg: false
10+
gpg:
11+
required: true
12+
identity:
13+
gitHubOrganization: siderolabs
1014
spellcheck:
1115
locale: US
1216
maximumOfOneCommit: true
@@ -19,4 +23,4 @@ policies:
1923
required: true
2024
conventional:
2125
types: ["chore","docs","perf","refactor","style","test","release"]
22-
scopes: ["*"]
26+
scopes: [".*"]

.drone.yml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
33
#
4-
# Generated on 2021-03-25T21:15:43Z by kres 424ae88-dirty.
4+
# Generated on 2022-06-06T17:35:55Z by kres 65530e7.
55

66
kind: pipeline
77
type: kubernetes
@@ -122,9 +122,59 @@ steps:
122122
depends_on:
123123
- base
124124

125+
- name: release-notes
126+
pull: always
127+
image: autonomy/build-container:latest
128+
commands:
129+
- make release-notes
130+
volumes:
131+
- name: outer-docker-socket
132+
path: /var/outer-run
133+
- name: docker-socket
134+
path: /var/run
135+
- name: buildx
136+
path: /root/.docker/buildx
137+
- name: ssh
138+
path: /root/.ssh
139+
when:
140+
event:
141+
- tag
142+
depends_on:
143+
- unit-tests
144+
- coverage
145+
- lint
146+
147+
- name: release
148+
pull: always
149+
image: plugins/github-release
150+
settings:
151+
api_key:
152+
from_secret: github_token
153+
checksum:
154+
- sha256
155+
- sha512
156+
draft: true
157+
files:
158+
- _out/*
159+
note: _out/RELEASE_NOTES.md
160+
volumes:
161+
- name: outer-docker-socket
162+
path: /var/outer-run
163+
- name: docker-socket
164+
path: /var/run
165+
- name: buildx
166+
path: /root/.docker/buildx
167+
- name: ssh
168+
path: /root/.ssh
169+
when:
170+
event:
171+
- tag
172+
depends_on:
173+
- release-notes
174+
125175
services:
126176
- name: docker
127-
image: docker:19.03-dind
177+
image: docker:20.10-dind
128178
entrypoint:
129179
- dockerd
130180
commands:

.golangci.yml

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2021-03-25T21:15:43Z by kres 424ae88-dirty.
4-
3+
# Generated on 2022-06-06T17:35:55Z by kres 65530e7.
54

65
# options for analysis running
76
run:
@@ -22,7 +21,6 @@ output:
2221
uniq-by-line: true
2322
path-prefix: ""
2423

25-
2624
# all available settings of specific linters
2725
linters-settings:
2826
dogsled:
@@ -41,6 +39,13 @@ linters-settings:
4139
local-prefixes: github.com/talos-systems/grpc-proxy
4240
gocognit:
4341
min-complexity: 30
42+
ireturn:
43+
allow:
44+
- anon
45+
- error
46+
- empty
47+
- stdlib
48+
- github.com\/talos-systems\/kres\/internal\/dag.Node
4449
nestif:
4550
min-complexity: 5
4651
goconst:
@@ -91,7 +96,7 @@ linters-settings:
9196
require-explanation: false
9297
require-specific: true
9398
rowserrcheck: {}
94-
testpackage:
99+
testpackage: {}
95100
unparam:
96101
check-exported: false
97102
unused:
@@ -116,23 +121,33 @@ linters-settings:
116121

117122
linters:
118123
enable-all: true
124+
disable-all: false
125+
fast: false
119126
disable:
127+
- exhaustruct
128+
- exhaustivestruct
129+
- forbidigo
130+
- funlen
120131
- gas
121-
- typecheck
122132
- gochecknoglobals
123133
- gochecknoinits
124-
- funlen
125134
- godox
126-
- gomnd
127135
- goerr113
136+
- gomnd
137+
- gomoddirectives
128138
- nestif
129-
- wrapcheck
130139
- paralleltest
131-
- exhaustivestruct
132-
- forbidigo
133-
disable-all: false
134-
fast: false
135-
140+
- promlinter
141+
- tagliatelle
142+
- thelper
143+
- typecheck
144+
- varnamelen
145+
- wrapcheck
146+
# abandoned linters for which golangci shows the warning that the repo is archived by the owner
147+
- interfacer
148+
- maligned
149+
- golint
150+
- scopelint
136151

137152
issues:
138153
exclude: []
@@ -141,10 +156,8 @@ issues:
141156
exclude-case-sensitive: false
142157
max-issues-per-linter: 10
143158
max-same-issues: 3
144-
145159
new: false
146160

147161
severity:
148162
default-severity: error
149-
150163
case-sensitive: false

Dockerfile

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22

33
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
44
#
5-
# Generated on 2021-03-25T21:36:57Z by kres 424ae88-dirty.
5+
# Generated on 2022-06-06T17:35:55Z by kres 65530e7.
66

77
ARG TOOLCHAIN
88

9+
# cleaned up specs and compiled versions
10+
FROM scratch AS generate
11+
912
# runs markdownlint
10-
FROM node:14.8.0-alpine AS lint-markdown
11-
RUN npm i -g [email protected]
12-
13+
FROM node:18.2.0-alpine AS lint-markdown
1314
WORKDIR /src
15+
RUN npm i -g [email protected]
16+
1417
COPY .markdownlint.json .
1518
COPY ./README.md ./README.md
16-
RUN markdownlint --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules /node_modules/sentences-per-line/index.js .
17-
18-
# collects proto specs
19-
FROM scratch AS proto-specs
20-
ADD testservice/api/test.proto /testservice/
19+
RUN markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .
2120

2221
# base toolchain image
2322
FROM ${TOOLCHAIN} AS toolchain
@@ -28,18 +27,17 @@ FROM toolchain AS tools
2827
ENV GO111MODULE on
2928
ENV CGO_ENABLED 0
3029
ENV GOPATH /go
31-
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b /bin v1.38.0
30+
ARG GOLANGCILINT_VERSION
31+
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/${GOLANGCILINT_VERSION}/install.sh | bash -s -- -b /bin ${GOLANGCILINT_VERSION}
3232
ARG GOFUMPT_VERSION
33-
RUN cd $(mktemp -d) \
34-
&& go mod init tmp \
35-
&& go get mvdan.cc/gofumpt/gofumports@${GOFUMPT_VERSION} \
36-
&& mv /go/bin/gofumports /bin/gofumports
37-
ARG PROTOBUF_GO_VERSION
38-
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${PROTOBUF_GO_VERSION}
39-
RUN mv /go/bin/protoc-gen-go /bin
40-
ARG GRPC_GO_VERSION
41-
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${GRPC_GO_VERSION}
42-
RUN mv /go/bin/protoc-gen-go-grpc /bin
33+
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
34+
&& mv /go/bin/gofumpt /bin/gofumpt
35+
ARG GOIMPORTS_VERSION
36+
RUN go install golang.org/x/tools/cmd/goimports@${GOIMPORTS_VERSION} \
37+
&& mv /go/bin/goimports /bin/goimports
38+
ARG DEEPCOPY_VERSION
39+
RUN go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \
40+
&& mv /go/bin/deep-copy /bin/deep-copy
4341

4442
# tools and sources
4543
FROM tools AS base
@@ -52,15 +50,13 @@ COPY ./proxy ./proxy
5250
COPY ./testservice ./testservice
5351
RUN --mount=type=cache,target=/go/pkg go list -mod=readonly all >/dev/null
5452

55-
# runs protobuf compiler
56-
FROM tools AS proto-compile
57-
COPY --from=proto-specs / /
58-
RUN protoc -I/testservice --go_out=paths=source_relative:/testservice --go-grpc_out=paths=source_relative:/testservice /testservice/test.proto
59-
6053
# runs gofumpt
6154
FROM base AS lint-gofumpt
62-
RUN find . -name '*.pb.go' | xargs -r rm
63-
RUN FILES="$(gofumports -l -local github.com/talos-systems/grpc-proxy .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'gofumports -w -local github.com/talos-systems/grpc-proxy .':\n${FILES}"; exit 1)
55+
RUN FILES="$(gofumpt -l .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'gofumpt -w .':\n${FILES}"; exit 1)
56+
57+
# runs goimports
58+
FROM base AS lint-goimports
59+
RUN FILES="$(goimports -l -local github.com/talos-systems/grpc-proxy .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/talos-systems/grpc-proxy .':\n${FILES}"; exit 1)
6460

6561
# runs golangci-lint
6662
FROM base AS lint-golangci-lint
@@ -76,11 +72,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/g
7672
# runs unit-tests
7773
FROM base AS unit-tests-run
7874
ARG TESTPKGS
79-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -count 1 ${TESTPKGS}
80-
81-
# cleaned up specs and compiled versions
82-
FROM scratch AS generate
83-
COPY --from=proto-compile /testservice/ /testservice/
75+
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 ${TESTPKGS}
8476

8577
FROM scratch AS unit-tests
8678
COPY --from=unit-tests-run /src/coverage.txt /coverage.txt

0 commit comments

Comments
 (0)