Error: failed post-processing: 820:39: missing ',' in argument list - go

protoc-gen-validate is a protoc plugin to generate polyglot message validators.
The project uses Bazel for builds and has an open pull request to add support for customization of validation error messages.
The original code was made in 2020. Recently it was updated with the latest code, and after fixing all merge conflicts now it fails to build, but I can't find the issue:
~/GitHub/protoc-gen-validate (i18n) $ make bazel-tests
bazel test //tests/... --test_output=errors
INFO: Analyzed 68 targets (0 packages loaded, 0 targets configured).
INFO: Found 62 targets and 6 test targets...
ERROR: /Users/mparnisari/GitHub/protoc-gen-validate/tests/harness/cases/BUILD:46:21: Generating into bazel-out/darwin-fastbuild/bin/tests/harness/cases/go_/github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go failed: (Exit 1): go-protoc-bin failed: error executing command bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_go/go/tools/builders/go-protoc-bin_/go-protoc-bin -protoc bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/protoc ... (remaining 117 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
[error] failed post-processing: 820:39: missing ',' in argument list (and 10 more errors)
--validate_out: protoc-gen-validate: Plugin failed with status code 1.
2021/12/14 23:46:43 error running protoc: exit status 1
ERROR: /Users/mparnisari/GitHub/protoc-gen-validate/tests/harness/cases/BUILD:46:21 GoCompilePkg tests/harness/cases/go.a failed: (Exit 1): go-protoc-bin failed: error executing command bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_go/go/tools/builders/go-protoc-bin_/go-protoc-bin -protoc bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/protoc ... (remaining 117 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
INFO: Elapsed time: 0.962s, Critical Path: 0.48s
INFO: 8 processes: 8 internal.
FAILED: Build did NOT complete successfully
Judging by the fact that the error ([error] failed post-processing: 820:39: missing ',' in argument list (and 10 more errors)) appears immediately after I fire the tests command, I figure this is an issue with Bazel, but I'm not sure.
UPDATE 1: I narrowed it down to this:
~/GitHub/fork/protoc-gen-validate (i18n) $ make testcases
cd tests/harness/cases && \
protoc \
-I . \
-I ../../.. \
--go_out="module=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go,Mtests/harness/cases/other_package/embed.proto=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/other_package/go;other_package,Mtests/harness/cases/yet_another_package/embed.proto=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/yet_another_package/go,Mvalidate/validate.proto=github.com/envoyproxy/protoc-gen-validate/validate,Mgoogle/protobuf/any.proto=google.golang.org/protobuf/types/known/anypb,Mgoogle/protobuf/duration.proto=google.golang.org/protobuf/types/known/durationpb,Mgoogle/protobuf/struct.proto=google.golang.org/protobuf/types/known/structpb,Mgoogle/protobuf/timestamp.proto=google.golang.org/protobuf/types/known/timestamppb,Mgoogle/protobuf/wrappers.proto=google.golang.org/protobuf/types/known/wrapperspb,Mgoogle/protobuf/descriptor.proto=google.golang.org/protobuf/types/descriptorpb:./go" \
--plugin=protoc-gen-go=/Users/mparnisari/go/bin/protoc-gen-go \
--validate_out="module=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go,lang=go,Mtests/harness/cases/other_package/embed.proto=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/other_package/go,Mtests/harness/cases/yet_another_package/embed.proto=github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/yet_another_package/go:./go" \
./*.proto
filename-with-dash.proto:5:1: warning: Import validate/validate.proto is unused.
[error] failed post-processing: 820:39: missing ',' in argument list (and 10 more errors)
--validate_out: protoc-gen-validate: Plugin failed with status code 1.
make:
*** [testcases] Error 1
UPDATE 2: narrowed it down. if I delete this file: tests/harness/cases/maps.proto
make testcases works
UPDATE 3: narrowed it down. if I remove these lines: https://github.com/envoyproxy/protoc-gen-validate/blob/main/tests/harness/cases/maps.proto#L14-L17
make testcase works

Building with switch --sandbox_debug would provide an untruncated stacktrace.
It's all about one missing comma ...the only question is within which file and line.
It complains about the harness_py_proto tests # 46:21. Running a syntax check on file tests/harness/executor/cases.go suggested, because if 820:39 isn't in some generated file, this might be the file which fits best (by line numbers and also the error message). I'm not that fluent in Go syntax, that's why I cannot spot it at sight - but a syntax checker or linter could:
lint bazel testcases bazel-tests
Also the Makefile might be a possible candidate, but there's not much going on:
.PHONY: harness
harness: testcases tests/harness/go/harness.pb.go tests/harness/go/main/go-harness tests/harness/cc/cc-harness bin/harness ## runs the test harness, validating a series of test cases in all supported languages
./bin/harness -go -cc
.PHONY: bazel-tests
bazel-tests: ## runs all tests with Bazel
bazel test //tests/... --test_output=errors
Ever tried running make harness previously? When it does what the comment says ...
## runs the test harness, validating a series of test cases in all supported languages

Related

Error go test -v on https://github.com/slicen/cert-manager-webhook-linode

I completely make a config and create a token on linode
but i got this error when try to test my fetch-test-binaries.sh
this is the message
go test -v
# github.com/slicen/cert-manager-webhook-linode [github.com/slicen/cert-manager-webhook-linode.test]
./main_test.go:20:7: undefined: dns.SetBinariesPath
./main_test.go:20:23: undefined: kubeBuilderBinPath
FAIL github.com/slicen/cert-manager-webhook-linode [build failed]
make: *** [Makefile:15: verify] Error 2
can someone help me to resolve please ?
The error on file
main_test.go line 7 & 23 Link FIle : https://github.com/slicen/cert-manager-webhook-linode/blob/master/main_test.go
and makefile line 15 Link File : https://github.com/slicen/cert-manager-webhook-linode/blob/master/Makefile
The Repository Link : https://github.com/slicen/cert-manager-webhook-linode
I have tried to resolve with downgrade or upgrade my Go Version and searching but i found nothing,
I tried to just go test -v(not doing anything, just clone & go test) but i got same error
Please Help me, Thanks
SetBinariesPath was removed from cert-manager in commit cd92bf321fe14f857f34763583071e068f6c96b3
github.com/slicen/cert-manager-webhook-linode was updated to a newer version of cert-manager in commit 7131f7755b1278e48341f0d71fabac5b56b964fb - and it looks like that moved to a version of cert-manager which includes the removal of SetBinariesPath. The var declaration for kubeBuilderBinPath was correctly stripped away, but the call to dns.SetBinariesPath and a reference to the now removed kubeBuilderBinPath still remain.
So, essentially the code in main_test.go is invalid - at minimum line 20 should be removed.

go application build with bazel can't link when running inside container

I am trying to containerize my application build, though, when running the build that uses bazel with bazel-gazelle inside a container I will get this error:
$ bazel run --spawn_strategy=local //:gazelle --verbose_failures
INFO: Analyzed target //:gazelle (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/workstation/.cache/bazel/_bazel_workstation/fb227af4c7b6aa39cc5b15d7fd9b737a/external/go_sdk/BUILD.bazel:43:15: GoToolchainBinary external/go_sdk/builder [for host] failed: (Exit 1): go failed: error executing command
(cd /home/workstation/.cache/bazel/_bazel_workstation/fb227af4c7b6aa39cc5b15d7fd9b737a/execroot/__main__ && \
exec env - \
GOROOT_FINAL=GOROOT \
external/go_sdk/bin/go tool link -o bazel-out/host/bin/external/go_sdk/builder bazel-out/host/bin/external/go_sdk/builder.a)
# Configuration: e0f1106e28100863b4221c55fca6feb935acec078da5376e291cf644e275dae5
# Execution platform: #local_config_platform//:host
/opt/go/pkg/tool/linux_amd64/link: mapping output file failed: invalid argument
Target //:gazelle failed to build
INFO: Elapsed time: 2.302s, Critical Path: 0.35s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
I tried to run it standalone:
$ /home/workstation/.cache/bazel/_bazel_workstation/fb227af4c7b6aa39cc5b15d7fd9b737a/external/go_sdk/bin/go tool link -o bazel-out/host/bin/external/go_sdk/builder bazel-out/host/bin/external/go_sdk/builder.a
/opt/go/pkg/tool/linux_amd64/link: mapping output file failed: invalid argument
and still got no success.
Never had this kind of link problem and the linker don't provide much more information. Tried to install all packages I could think of and still no luck.
For context:
Running Ubuntu 20.04 LTS
Docker 20.10.9
Bazel 4.2.2
Rules GO v0.31.0
Bazel Gazelle v0.25.0
Also tried to run it with the strace, though I don't think I am skilled enough to find meaningful information from the tool output.
#edit
For more context:
e$ /home/workstation/.cache/bazel/_bazel_workstation/fb227af4c7b6aa39cc5b15d7fd9b737a/external/go_sdk/bin/go tool link -v -o bazel-out/host/bin/external/go_sdk/builder bazel-out/host/bin/external/go_sdk/builder.a
HEADER = -H5 -T0x401000 -R0x1000
searching for runtime.a in /opt/go/pkg/linux_amd64/runtime.a
/opt/go/pkg/tool/linux_amd64/link: mapping output file failed: invalid argument

Storing Artifacts From a Failed Build

I am running some screen diffing tests in one of my Cloud Build steps. The tests produce png files that I would like to view after the build, but it appears to upload artifacts on successful builds.
If my test fail, the process exits with a non-zero code, which results in this error:
ERROR: build step 0 "gcr.io/k8s-skaffold/skaffold" failed: step exited with non-zero status: 1
Which further results in another error
ERROR: (gcloud.builds.submit) build a22d1ab5-c996-49fe-a782-a74481ad5c2a completed with status "FAILURE"
And no artifacts get uploaded.
I added || true after my tests, so it exits successfully, and the artifacts get uploaded.
I want to:
A) Confirm that this behavior is expected
B) Know if there is a way to upload artifacts even if a step fails
Edit:
Here is my cloudbuild.yaml
options:
machineType: 'N1_HIGHCPU_32'
timeout: 3000s
steps:
- name: 'gcr.io/k8s-skaffold/skaffold'
env:
- 'CLOUD_BUILD=1'
entrypoint: bash
args:
- -x # print commands as they are being executed
- -c # run the following command...
- build/test/smoke/smoke-test.sh
artifacts:
objects:
location: 'gs://cloudbuild-artifacts/$BUILD_ID'
paths: [
'/workspace/build/test/cypress/screenshots/*.png'
]
Google Cloud Build doesn't allow us to upload artifacts (or run some steps ) if a build step fails. This is the expected behavior.
There is an already feature request created in Public Issue Tracker to allow us to run some steps even though the build has finished or failed. Please feel free to star it to get all the related updates on this issue.
A workaround per now is as you mentioned using || true after the tests or use || exit 0 as mentioned in this Github issue.

Sonarqube : The 'report' parameter is missing

I am using MSBuild. I have Java 8 installed.
I am running the following commands:
SonarQube.Scanner.MSBuild.exe begin /k:"ABC" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="8b839xxxxxxxxxxxxxxxxxxxxxxx6b00125bf92" /d:sonar.verbose=true
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild
SonarQube.Scanner.MSBuild.exe end /d:sonar.login="8b839xxxxxxxxxxxxxxxxxxxxxxx6b00125bf92"
The last step fails:
ERROR: Error during SonarQube Scanner execution
ERROR: The 'report' parameter is missing
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
The SonarQube Scanner did not complete successfully
12:53:21.909 Creating a summary markdown file...
12:53:21.918 Post-processing failed. Exit code: 1
The MSBuild version is greater than 14.
Java 8 is properly installed. Documentation indicates that Java 8 is adequate.
Any idea on what could be wrong?
Where do I add the -X switch? I tried on all 3 statements
Update :I installed Java SDK 9. Still same issue.
Update :With verbose logging and using /n naming parameter:
INFO: Analysis report generated in 992ms, dir size=4 MB
INFO: Analysis reports compressed in 549ms, zip size=1 MB
INFO: Analysis report generated in C:\ABC\.sonarqube\out\.sonar\scanner-report
DEBUG: Upload report
DEBUG: POST 400 http://localhost:9000/api/ce/submit?projectKey=ABC | time=1023ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 54.833s
INFO: Final Memory: 51M/170M
INFO: ------------------------------------------------------------------------
DEBUG: Execution getVersion
DEBUG: Execution stop
ERROR: Error during SonarQube Scanner execution
ERROR: The 'report' parameter is missing
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
Process returned exit code 1
The SonarQube Scanner did not complete successfully
Creating a summary markdown file...
Post-processing failed. Exit code: 1
I've struggled the same problem with SonarQube and I've finally found a solution:
You need to restart sonar service after using evaluation token.
Please note this isn't the answer, however I feel this feedback is valuable to getting this question answered.
I can reproduce this issue in POSTMan with a POST request to:
http://localhost:9000/api/ce/submit?projectKey=myProjectKey
This returns
{
"errors": [
{
"msg": "The 'report' parameter is missing"
}
]
}
You can get a similar error by removing the projectKey query parameter. I tried adding a report query parameter and received the same error:
http://localhost:9000/api/ce/submit?projectKey=brian3016&report=report
Given this, I feel there is a problem with their code. It should have included a report parameter when creating the POST request, but it failed to do so.
Verbose output seems to have changed from using the -X switch to /d:sonar.verbose=true. E.G.
SonarScanner.MSBuild.exe begin /k:"myProjectKey" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="myLogin" /d:sonar.verbose=true
Note the verbose logging didn't give me any valuable insight.
(Also note that the documentation currently says to use SonarQube.Scanner.MSBuild.exe, but the verbose logger told me to switch to SonarScanner.MSBuild.exe)
SO...how we we report this issue to someone that can fix it? Their documentation says to go to Stackoverflow. So here we are.
I thought it may have been an issue with a project. So I created a new project with nothing other than the startup template Console Application. Same error.
In my case SonarQube 7.9.1 (deployed with Helm to Kubernetes cluster) was missing temp directory /opt/sonarqube/temp/tc/work/Tomcat/localhost/ROOT after Helm rollback. No idea what happened to it.
Logfile /opt/sonarqube/logs/web.log inside SonarQube pod had this error:
2021.02.02 06:57:03 WARN web[AXdZ6l6MParQCncJACv3][o.s.s.w.ServletRequest] Can't read file part for parameter report
java.io.IOException: The temporary upload location [/opt/sonarqube/temp/tc/work/Tomcat/localhost/ROOT] is not valid
The fix was to exec into pod and create the missing directory. Would like to know the reason though...
The issue is with the sonar service starting up.
First try to stop the SonarStart.bat by using Ctrl+c, and then try to open localhost:9000 ( or whichever port you configured sonar server).
If it is still opening then go to task manager and search for wrapper.exe service and stop the service. If no service is found then go to:
Task manager>Details> and stop all java.exe process.
Note: If you running many Java applications, right-click the java.exe and choose goto service, and stop only those java.exe that belongs to AppX deployment.services
Now start sonarstart.bat as administrator..
today i face the same error when using jenkins to scanner the code.
get the error when POST /api/ce/submit and get 400 code by add the sonar.verbose=true
i use the below step to check reason
first to restart the sonarqube => failed
check the report file size by using "du -sh" get 108m and DB server support 1G => failed
login the sonar-qube server and check the access.log, web.log and another log, finally find the error reason " Processing of multipart/form-data request failed. No space left on device", so i check the server by command "df -h", some devices are used 100% => so i remove some no-using file and fix it!!!
check if you have enough memory
ex: free -m
In my case I had to upgrade memory.

Travis build fail with error 65

I have a Travis CI setup on GitHub. I use it to check my commits for iOS app. The problem is, I very often and randomly get an error 65. I have yet to find a solution.
When I restart the job 2-3 times after it has failed it passes in 90% of times.
I previously also had a problem with logs being too verbose for Travis (>4MB) but I added xcpretty to fix that.
Errors I took from log:
...
Generating 'XYZ.app.dSYM'
❌ error: couldn't remove '/Users/travis/Library/Developer/Xcode/DerivedData/XYZ-aaltcjvmshpmlufpmzdsgbernspl/Build/Products/Debug-iphonesimulator/XYZ.app/SomeName.storyboardc' after command failed: Directory not empty
...
And then at the end of Travis log:
Testing failed:
The file “056-Jj-FAu-view-XmS-Ro-0cO.nib” couldn’t be opened because there is no such file.
error: couldn't remove '/Users/travis/Library/Developer/Xcode/DerivedData/XYZ-aaltcjvmshpmlufpmzdsgbernspl/Build/Products/Debug-iphonesimulator/XYZ.app/SomeName.storyboardc' after command failed: Directory not empty
error: lipo: can't move temporary file: /Users/travis/Library/Developer/Xcode/DerivedData/XYZ-aaltcjvmshpmlufpmzdsgbernspl/Build/Products/Debug-iphonesimulator/XYZ.app.dSYM/Contents/Resources/DWARF/XYZ to file: /Users/travis/Library/Developer/Xcode/DerivedData/XYZ-aaltcjvmshpmlufpmzdsgbernspl/Build/Products/Debug-iphonesimulator/XYZ.app.dSYM/Contents/Resources/DWARF/XYZ.lipo (No such file or directory)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil emitted errors but did not return a nonzero exit code to indicate failure
** TEST FAILED **
The following build commands failed:
LinkStoryboards
LinkStoryboards
(2 failures)
The command "./scripts/build.sh" exited with 65.
I am using Xcode 8 both in Xcode and Travis settings.
Ah, good question. Occasionally, xcodebuild steps that are failing during the codesigning step can be addressed using travis_retry - Travis will retry the step 3 times for any non-zero exit status, which should reduce the need for you to restart it manually. There are some suggested code snippets in the travis-ci/travis-ci GitHub issue on this as well. Good luck!
If you're running into the error code 65 (from random failures) here's a command you can pipe on the end of your xcodebuild (assuming you're running tests) command to get back more consistent results:
(XCODEBUILD_COMMAND_HERE) | awk 'BEGIN {success=0} $0 ~ /.* tests, with 0 failures \(.*/ {success=1} {print $0} END {if(success==0){exit 1}}
This looks for tests, with 0 failures ( in your output text, thus using the text output of xcodebuild instead of the status code of xcodebuild to determine success.
Note: Keep in mind, if you do something like NSLog(' tests, with 0 failures ('); in your code you make get a false positive, it's very unlikely to happen by accident. You may have to update tests, with 0 failures ( in the awk script between updates of xcodebuild. But, having consistent results with xcodebuild is definitely worth that price.

Resources