Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typecheck: : error obtaining VCS status: exit status 128 #4033

Closed
5 tasks done
chmouel opened this issue Aug 21, 2023 · 8 comments
Closed
5 tasks done

typecheck: : error obtaining VCS status: exit status 128 #4033

chmouel opened this issue Aug 21, 2023 · 8 comments
Labels
docker PR that update Docker code question Further information is requested

Comments

@chmouel
Copy link

chmouel commented Aug 21, 2023

Welcome

Description of the problem

getting this error this morning in our CI, thing works properly when building with -buildvcs=false, i am not sure how to pass that flag to golangci-lint

+ make lint-go
Linting go files...
cmd/pipelines-as-code-controller/main.go:1: : error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping. (typecheck)
package main
cmd/pipelines-as-code-watcher/main.go:1: : error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping. (typecheck)
package main
cmd/pipelines-as-code-webhook/main.go:1: : error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping. (typecheck)
package main
cmd/tkn-pac/main.go:1: : error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping. (typecheck)
package main
make: *** [Makefile:75: lint-go] Error 1

Version of golangci-lint

% docker run -it mirror.gcr.io/golangci/golangci-lint:latest golangci-lint --version
golangci-lint has version v1.54.1 built with go1.21.0 from a9378d9b on 2023-08-11T13:17:35Z

Configuration

https://github.com/openshift-pipelines/pipelines-as-code/blob/4f08ba0b810052a693d837472bc02a552fa4620a/.golangci.yml

Go environment

docker image

Verbose output of running

cmd/pipelines-as-code-controller/main.go:1: : error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping. (typecheck)
package main

A minimal reproducible example or link to a public repository

https://github.com/openshift-pipelines/pipelines-as-code

Validation

  • Yes, I've included all information above (version, config, etc.).
@chmouel chmouel added the bug Something isn't working label Aug 21, 2023
@ldez
Copy link
Member

ldez commented Aug 21, 2023

Hello,

$ git clone git@github.com:openshift-pipelines/pipelines-as-code.git
...
$ cd pipelines-as-code
$ golangci-lint run -v             
INFO [config_reader] Config search paths: [./ /home/ldez/sources/experimental/pipelines-as-code /home/ldez/sources/experimental /home/ldez/sources /home/ldez /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 38 linters: [asciicheck bodyclose dogsled dupl durationcheck errcheck errorlint exhaustive exportloopref forbidigo forcetypeassert gochecknoinits gocritic gofumpt goheader goimports gomodguard goprintffuncname gosec gosimple govet importas ineffassign makezero misspell nakedret nilerr noctx prealloc predeclared promlinter revive staticcheck stylecheck tparallel unparam unused whitespace] 
INFO [loader] Using build tags: [e2e]             
INFO [loader] Go packages loading at mode 575 (files|imports|deps|exports_file|types_sizes|compiled_files|name) took 423.026605ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 9.858524ms 
INFO [linters_context] importas settings found, but no aliases listed. List aliases under alias: key. 
INFO [linters_context/goanalysis] analyzers took 0s with no stages 
INFO [runner/skip_dirs] Skipped 74 issues from dir pkg/provider/gitea/structs by pattern pkg/provider/gitea/structs 
INFO [runner] Issues before processing: 953, after processing: 0 
INFO [runner] Processors filtering stat (out/in): autogenerated_exclude: 821/879, identifier_marker: 821/821, nolint: 0/41, cgo: 953/953, filename_unadjuster: 953/953, exclude: 821/821, exclude-rules: 41/821, skip_dirs: 879/953, path_prettifier: 953/953, skip_files: 953/953 
INFO [runner] processing took 36.880164ms with stages: exclude-rules: 14.747077ms, identifier_marker: 8.473804ms, nolint: 7.86421ms, path_prettifier: 3.238705ms, autogenerated_exclude: 1.543588ms, skip_dirs: 794.383µs, cgo: 137.891µs, filename_unadjuster: 76.149µs, max_same_issues: 854ns, fixer: 565ns, uniq_by_line: 415ns, skip_files: 405ns, severity-rules: 373ns, exclude: 346ns, max_from_linter: 277ns, diff: 268ns, source_code: 228ns, path_shortener: 182ns, sort_results: 180ns, max_per_file_from_linter: 174ns, path_prefixer: 90ns 
INFO [runner] linters took 334.415108ms with stages: goanalysis_metalinter: 297.482253ms 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 9 samples, avg is 56.0MB, max is 119.7MB 
INFO Execution took 770.601714ms
$ docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.54.1 golangci-lint run -v
INFO [config_reader] Config search paths: [./ /app / /root] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 38 linters: [asciicheck bodyclose dogsled dupl durationcheck errcheck errorlint exhaustive exportloopref forbidigo forcetypeassert gochecknoinits gocritic gofumpt goheader goimports gomodguard goprintffuncname gosec gosimple govet importas ineffassign makezero misspell nakedret nilerr noctx prealloc predeclared promlinter revive staticcheck stylecheck tparallel unparam unused whitespace] 
INFO [loader] Using build tags: [e2e]             
INFO [loader] Go packages loading at mode 575 (deps|name|types_sizes|compiled_files|exports_file|files|imports) took 22.370059115s 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 11.525808ms 
INFO [linters_context] importas settings found, but no aliases listed. List aliases under alias: key. 
INFO [linters_context/goanalysis] analyzers took 6m42.296002048s with top 10 stages: buildir: 3m22.038931923s, buildssa: 47.699919917s, the_only_name: 16.467139188s, unparam: 9.815711241s, dupl: 9.006907732s, nilness: 6.933818054s, exhaustive: 5.421477137s, inspect: 3.385792639s, printf: 3.257324234s, fact_purity: 3.197562419s 
INFO [runner/skip_dirs] Skipped 74 issues from dir pkg/provider/gitea/structs by pattern pkg/provider/gitea/structs 
INFO [runner/max_same_issues] 1/4 issues with text ": error obtaining VCS status: exit status 128\n\tUse -buildvcs=false to disable VCS stamping." were hidden, use --max-same-issues 
INFO [runner] Issues before processing: 1824, after processing: 3 
INFO [runner] Processors filtering stat (out/in): identifier_marker: 1692/1692, fixer: 3/3, autogenerated_exclude: 1692/1750, nolint: 876/917, uniq_by_line: 4/876, max_per_file_from_linter: 4/4, max_same_issues: 3/4, max_from_linter: 3/3, cgo: 1824/1824, skip_dirs: 1750/1824, source_code: 3/3, exclude: 1692/1692, severity-rules: 3/3, path_prefixer: 3/3, filename_unadjuster: 1824/1824, path_prettifier: 1824/1824, diff: 4/4, path_shortener: 3/3, sort_results: 3/3, skip_files: 1824/1824, exclude-rules: 917/1692 
INFO [runner] processing took 81.734068ms with stages: exclude-rules: 48.280524ms, identifier_marker: 18.928927ms, nolint: 9.336011ms, path_prettifier: 2.312566ms, autogenerated_exclude: 1.676156ms, skip_dirs: 989.557µs, cgo: 99.23µs, filename_unadjuster: 40.557µs, source_code: 34.054µs, uniq_by_line: 21.84µs, max_same_issues: 8.834µs, skip_files: 1.879µs, max_per_file_from_linter: 1.294µs, path_shortener: 766ns, max_from_linter: 635ns, exclude: 410ns, fixer: 205ns, diff: 189ns, severity-rules: 184ns, sort_results: 173ns, path_prefixer: 77ns 
INFO [runner] linters took 20.250251408s with stages: goanalysis_metalinter: 20.16846045s 
cmd/pipelines-as-code-controller/main.go:1: : error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping. (typecheck)
package main
cmd/pipelines-as-code-watcher/main.go:1: : error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping. (typecheck)
package main
cmd/pipelines-as-code-webhook/main.go:1: : error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping. (typecheck)
package main
INFO File cache stats: 411 entries of total size 1.4MiB 
INFO Memory: 411 samples, avg is 1494.8MB, max is 6820.7MB 
INFO Execution took 42.635134422s 

🤔 Feel like there is something missing inside the Docker image.

@ldez
Copy link
Member

ldez commented Aug 21, 2023

It's related to git, the hidden error is:

fatal: detected dubious ownership in repository at '/app
To add an exception for this directory, call:

        git config --global --add safe.directory /app

you have to run git config --global --add safe.directory /app

@ldez ldez added question Further information is requested and removed bug Something isn't working labels Aug 21, 2023
@ldez ldez added the docker PR that update Docker code label Aug 21, 2023
@ldez
Copy link
Member

ldez commented Aug 21, 2023

Fixed by #4034

@ldez ldez closed this as completed Aug 21, 2023
@kjavaherpour
Copy link

kjavaherpour commented Aug 21, 2023

It's related to git, the hidden error is:

fatal: detected dubious ownership in repository at '/app
To add an exception for this directory, call:

        git config --global --add safe.directory /app

you have to run git config --global --add safe.directory /app

What if you don't have git inside your image?

@ldez
Copy link
Member

ldez commented Aug 21, 2023

The error is an error from git, and git is a kind of requirement for Go itself so I don't know what to say.

We maintain our Docker image with the right tooling, so use our Docker image.

https://golangci-lint.run/usage/install/#docker

@kjavaherpour
Copy link

The error is an error from git, and git is a kind of requirement for Go itself so I don't know what to say.

We maintain our Docker image with the right tooling, so use our Docker image.

https://golangci-lint.run/usage/install/#docker

Ah sorry, I was mistaken. Adding the command git config --global --add safe.directory /app worked for me too.

@chmouel
Copy link
Author

chmouel commented Aug 22, 2023

🤔 Feel like there is something missing inside the Docker image.

it worked for us, thanks ludo!

(it's weird that this issue only came up now, i guess you updated your base image with latest git lately?)

@jonasdk
Copy link

jonasdk commented Aug 23, 2023

We are still having all kinds of problems like described here.
We have tried the fix as described here:

Fixed by #4034

We have added:

git config --global --add safe.directory '*'

But keep having the above issue popping up time and time again. Any suggestions to why this problem is so hard to get by?

dixler pushed a commit to pulumi/pulumi-std that referenced this issue Jan 3, 2024
`make lint-golang` errors with:
  error obtaining VCS status: exit status 128

Uses workaround from:
  golangci/golangci-lint#4033
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker PR that update Docker code question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants