diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2020-04-01 16:24:08 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-04-01 16:24:08 +0300 |
commit | 880c701e50a71b848d32a7a599647bb0634ec321 (patch) | |
tree | 0d10c5f6343d56a7f67bee45257586a526e875ff | |
parent | b5623c08747c56af0b3640b413deeeabbd1288a3 (diff) |
Make `lint` independent from golangci-lint-alpine image
Docker image that contains `golangci-lint` is not versioned
by Go version and does not make much sense for us by creating
report.
As result of moving to Go 1.14 we also need to update version
of `golangci-lint`. Otherwise it won't be run correctly.
Support for Go 1.14 included in
https://github.com/golangci/golangci-lint/releases/tag/v1.23.8
Changed to the latest 1.24.o release.
-rw-r--r-- | .gitlab-ci.yml | 22 | ||||
-rw-r--r-- | _support/makegen.go | 6 | ||||
-rw-r--r-- | internal/praefect/server_test.go | 6 | ||||
-rw-r--r-- | internal/rubyserver/balancer/balancer.go | 4 | ||||
-rw-r--r-- | internal/service/repository/archive_test.go | 4 | ||||
-rw-r--r-- | internal/service/repository/raw_changes_test.go | 4 |
6 files changed, 21 insertions, 25 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 800941ee1..522c13448 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -251,19 +251,13 @@ praefect_sql_test: - make test-postgres lint: - image: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine + image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.24 stage: test - before_script: - # this removes dependency to the github.com/libgit2/git2go: https://gitlab.com/gitlab-org/gitaly/issues/1706 - - git rm -r --quiet cmd/gitaly-remote script: - # Write the code coverage report to gl-code-quality-report.json - # and print linting issues to stdout in the format: path/to/file:line description - - golangci-lint run --config .golangci.yml --out-format code-climate | tee gl-code-quality-report.json | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"' - after_script: - - git checkout --quiet --no-progress HEAD cmd/gitaly-remote # restore removed code - artifacts: - reports: - codequality: gl-code-quality-report.json - paths: - - gl-code-quality-report.json + - go version + - make lint + # Temporary allowed to fail because https://github.com/golangci/golangci-lint/issues/896 + # The job fails frequently https://gitlab.com/gitlab-org/gitaly/-/jobs/494211383 + # and it stops further development process, so it is temporary measure. + # Must be fixed under: https://gitlab.com/gitlab-org/gitaly/-/issues/2605 + allow_failure: true diff --git a/_support/makegen.go b/_support/makegen.go index 81a5ae611..870184741 100644 --- a/_support/makegen.go +++ b/_support/makegen.go @@ -318,16 +318,16 @@ func (gm *gitalyMake) GolangCILintURL() string { func (gm *gitalyMake) GolangCILintSHA256() string { switch runtime.GOOS + "/" + runtime.GOARCH { case "darwin/amd64": - return "fcf80824c21567eb0871055711bf9bdca91cf9a081122e2a45f1d11fed754600" + return "f05af56f15ebbcf77663a8955d1e39009b584ce8ea4c5583669369d80353a113" case "linux/amd64": - return "109d38cdc89f271392f5a138d6782657157f9f496fd4801956efa2d0428e0cbe" + return "241ca454102e909de04957ff8a5754c757cefa255758b3e1fba8a4533d19d179" default: return "unknown" } } func (gm *gitalyMake) GolangCILintVersion() string { - return "1.22.2" + return "1.24.0" } func (gm *gitalyMake) GolangCILint() string { diff --git a/internal/praefect/server_test.go b/internal/praefect/server_test.go index 3c3e0c9f7..fab6db90c 100644 --- a/internal/praefect/server_test.go +++ b/internal/praefect/server_test.go @@ -519,7 +519,8 @@ func TestRepoRename(t *testing.T) { defer cancel() // virtualRepo is a virtual repository all requests to it would be applied to the underline Gitaly nodes behind it - virtualRepo := &(*repo0) + cpRepo0 := *repo0 + virtualRepo := &cpRepo0 virtualRepo.StorageName = virtualStorage.Name repoServiceClient := gitalypb.NewRepositoryServiceClient(cc) @@ -548,7 +549,8 @@ func TestRepoRename(t *testing.T) { require.False(t, resp.GetExists(), "repo with old name must gone") // as we renamed the repo we need to update RelativePath before we could check if it exists - renamedVirtualRepo := &(*virtualRepo) + cpVirtualRepo := *virtualRepo + renamedVirtualRepo := &cpVirtualRepo renamedVirtualRepo.RelativePath = newName resp, err = repoServiceClient.RepositoryExists(ctx, &gitalypb.RepositoryExistsRequest{ Repository: renamedVirtualRepo, diff --git a/internal/rubyserver/balancer/balancer.go b/internal/rubyserver/balancer/balancer.go index abd722530..c2f1a8ae7 100644 --- a/internal/rubyserver/balancer/balancer.go +++ b/internal/rubyserver/balancer/balancer.go @@ -121,7 +121,7 @@ func (*builder) Scheme() string { return Scheme } // care what "address" the caller wants to resolve. We always resolve to // the current list of address for local gitaly-ruby processes. func (b *builder) Build(_ resolver.Target, cc resolver.ClientConn, _ resolver.BuildOption) (resolver.Resolver, error) { - //nolint:golint // There is no obvious way to use UpdateState() without completely replacing the current configuration + //nolint:staticcheck // There is no obvious way to use UpdateState() without completely replacing the current configuration cc.NewServiceConfig(`{"LoadBalancingPolicy":"round_robin"}`) return newGitalyResolver(cc, b.addressUpdates), nil } @@ -244,7 +244,7 @@ func (r *gitalyResolver) monitor() { func (r *gitalyResolver) sendUpdate() chan struct{} { au := <-r.addressUpdates - //nolint:golint // There is no obvious way to use UpdateState() without completely replacing the current configuration + //nolint:staticcheck // There is no obvious way to use UpdateState() without completely replacing the current configuration r.clientConn.NewAddress(au.addrs) return au.next } diff --git a/internal/service/repository/archive_test.go b/internal/service/repository/archive_test.go index 93102a87f..a7afef228 100644 --- a/internal/service/repository/archive_test.go +++ b/internal/service/repository/archive_test.go @@ -267,9 +267,9 @@ func TestGetArchivePathInjection(t *testing.T) { f, err := os.Create(filepath.Join(repoExploitPath, "id_12345.pub")) require.NoError(t, err) - evilPubKeyFile := fmt.Sprintf(`# + evilPubKeyFile := `# ssh-ed25519 my_super_evil_ssh_pubkey - #`) + #` _, err = fmt.Fprint(f, evilPubKeyFile) require.NoError(t, err) diff --git a/internal/service/repository/raw_changes_test.go b/internal/service/repository/raw_changes_test.go index 76f1e2233..07cc8f975 100644 --- a/internal/service/repository/raw_changes_test.go +++ b/internal/service/repository/raw_changes_test.go @@ -371,13 +371,13 @@ func TestGetRawChangesInvalidUTF8Paths(t *testing.T) { for _, rawChange := range msg.GetRawChanges() { if string(rawChange.GetOldPathBytes()) == nonUTF8Filename { oldPathFound = true - //nolint:golint // gitlab.com/gitlab-org/gitaly/issues/1746 + //nolint:staticcheck // gitlab.com/gitlab-org/gitaly/issues/1746 require.Equal(t, rawChange.GetOldPath(), InvalidUTF8PathPlaceholder) } if string(rawChange.GetNewPathBytes()) == nonUTF8Filename { newPathFound = true - //nolint:golint // gitlab.com/gitlab-org/gitaly/issues/1746 + //nolint:staticcheck // gitlab.com/gitlab-org/gitaly/issues/1746 require.Equal(t, rawChange.GetNewPath(), InvalidUTF8PathPlaceholder) } } |