Skip to content

Commit a514068

Browse files
committed
running protos on docker
Signed-off-by: alanprot <[email protected]>
1 parent 63b2eed commit a514068

File tree

6 files changed

+26
-20
lines changed

6 files changed

+26
-20
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -x
4+
VER="20.10.19"
5+
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
6+
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
7+
mkdir -vp ~/.docker/cli-plugins/
8+
curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
9+
chmod a+x ~/.docker/cli-plugins/docker-buildx
10+
mv /tmp/docker/* /usr/bin
11+
docker run --privileged --rm tonistiigi/binfmt --install all

.github/workflows/test-build-deploy.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,14 @@ jobs:
3434
steps:
3535
- name: Checkout Repo
3636
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37-
- name: Setup Git safe.directory
38-
run: |
39-
echo "this step is needed because when running in container, actions/checkout does not set safe.directory effectively."
40-
echo "See https://github.com/actions/runner/issues/2033. We should use --system instead of --global"
41-
git config --system --add safe.directory $GITHUB_WORKSPACE
42-
# Commands in the Makefile are hardcoded with an assumed file structure of the CI container
43-
# Symlink ensures paths specified in previous commands don’t break
4437
- name: Sym Link Expected Path to Workspace
4538
run: |
46-
mkdir -p /go/src/github.com/cortexproject/weaveworks-common
47-
ln -s $GITHUB_WORKSPACE/* /go/src/github.com/cortexproject/weaveworks-common
39+
sudo mkdir -p /go/src/github.com/cortexproject/weaveworks-common
40+
sudo ln -s $GITHUB_WORKSPACE/* /go/src/github.com/cortexproject/weaveworks-common
41+
- name: Install Docker Client
42+
run: sudo ./.github/workflows/scripts/install-docker.sh
43+
- name: Ls
44+
run: ls /go/src/github.com/cortexproject/weaveworks-common
4845
- name: CheckProtos
4946
run: make check-protos
5047

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ GO_FLAGS := -ldflags "-extldflags \"-static\" -linkmode=external -s -w" -tags ne
1414
PROTOC_IMAGE=namely/protoc:1.23_0
1515

1616
protos:
17-
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/weaveworks/common -w /go/src/github.com/weaveworks/common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/weaveworks/common --go_out=plugins=grpc:/go/src/ server/fake_server.proto
18-
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/weaveworks/common -w /go/src/github.com/weaveworks/common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/weaveworks/common --go_out=plugins=grpc:/go/src/ middleware/middleware_test/echo_server.proto
19-
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/weaveworks/common -w /go/src/github.com/weaveworks/common $(PROTOC_IMAGE) -I/go/src/github.com/weaveworks/common -I/go/src/github.com/weaveworks/common/vendor/github.com/gogo/protobuf/ --proto_path=/go/src/github.com/weaveworks/common --gogofast_out=plugins=grpc:/go/src/ httpgrpc/httpgrpc.proto
17+
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/cortexproject/weaveworks-common -w /go/src/github.com/cortexproject/weaveworks-common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/cortexproject/weaveworks-common --go_out=plugins=grpc:/go/src/ server/fake_server.proto
18+
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/cortexproject/weaveworks-common -w /go/src/github.com/cortexproject/weaveworks-common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/cortexproject/weaveworks-common --go_out=plugins=grpc:/go/src/ middleware/middleware_test/echo_server.proto
19+
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/cortexproject/weaveworks-common -w /go/src/github.com/cortexproject/weaveworks-common $(PROTOC_IMAGE) -I/go/src/github.com/cortexproject/weaveworks-common -I/go/src/github.com/cortexproject/weaveworks-common/vendor/github.com/gogo/protobuf/ --proto_path=/go/src/github.com/cortexproject/weaveworks-common --gogofast_out=plugins=grpc:/go/src/ httpgrpc/httpgrpc.proto
2020

2121
protos: $(GENERATED_PROTOS)
2222

instrument/instrument_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestCollectedRequest(t *testing.T) {
6060

6161
func TestCollectedRequest_Error(t *testing.T) {
6262
c := &spyCollector{}
63-
require.NoError(t, instrument.CollectedRequest(context.Background(), "test", c, nil, func(_ context.Context) error {
63+
require.Error(t, instrument.CollectedRequest(context.Background(), "test", c, nil, func(_ context.Context) error {
6464
return errors.New("boom")
6565
}))
6666
assert.True(t, c.before)

mflag/flag_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func TestEverything(t *testing.T) {
8585
require.NoError(t, Set("test_uint64", "1"))
8686
require.NoError(t, Set("test_string", "1"))
8787
require.NoError(t, Set("test_float64", "1"))
88-
require.NoError(t, Set("testrequire.NoError(_duration", "1s"))
88+
require.NoError(t, Set("test_duration", "1s"))
8989
desired = "1"
9090
Visit(visitor)
9191
if len(m) != 8 {
@@ -276,7 +276,7 @@ func testPanic(f *FlagSet, t *testing.T) {
276276
args := []string{
277277
"-int", "21",
278278
}
279-
require.NoError(t, f.Parse(args))
279+
f.Parse(args) //nolint:errcheck
280280
}
281281

282282
func TestParsePanic(t *testing.T) {
@@ -368,7 +368,7 @@ func TestSetOutput(t *testing.T) {
368368
var buf bytes.Buffer
369369
flags.SetOutput(&buf)
370370
flags.Init("test", ContinueOnError)
371-
require.NoError(t, flags.Parse([]string{"-unknown"}))
371+
flags.Parse([]string{"-unknown"}) //nolint:errcheck
372372
if out := buf.String(); !strings.Contains(out, "-unknown") {
373373
t.Logf("expected output mentioning unknown; got %q", out)
374374
}

middleware/logging_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ func TestBadWriteLogging(t *testing.T) {
3838
Log: logging.Logrus(logrusLogger),
3939
}
4040
handler := func(w http.ResponseWriter, r *http.Request) {
41-
_, err := io.WriteString(w, "<html><body>Hello World!</body></html>")
42-
require.NoError(t, err)
41+
io.WriteString(w, "<html><body>Hello World!</body></html>") //nolint:errcheck
4342
}
4443
loggingHandler := loggingMiddleware.Wrap(http.HandlerFunc(handler))
4544

@@ -129,8 +128,7 @@ func TestLoggingRequestsAtInfoLevel(t *testing.T) {
129128
LogRequestAtInfoLevel: true,
130129
}
131130
handler := func(w http.ResponseWriter, r *http.Request) {
132-
_, err := io.WriteString(w, "<html><body>Hello World!</body></html>")
133-
require.NoError(t, err)
131+
io.WriteString(w, "<html><body>Hello World!</body></html>") //nolint:errcheck
134132
}
135133
loggingHandler := loggingMiddleware.Wrap(http.HandlerFunc(handler))
136134

0 commit comments

Comments
 (0)