# #go #proxy
Вопрос:
Я пытаюсь запустить сканирование blackduck в приложении Go через командную строку. Команда, которую я использую, приведена ниже:
sudo java -jar detect.jar
--blackduck.trust.cert=true
--detect.java.path="/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home"
--detect.project.name="My App"
--detect.project.version.name="My App - test"
--detect.code.location.name="My App - test"
--blackduck.url="https://<private-blackduck-portal>/"
--blackduck.api.token="<API_TOKEN>"
--detect.source.path="/Users/<user>/go/src/<private-github-repo>/projects/my-app"
Подключение к blackduck успешно, но когда он пытается создать приложение, он не может получить пакеты Go — мы получаем следующую ошибку для каждого из них «наберите tcp: поиск proxy.golang.org: такой ошибки хоста нет». Вы можете увидеть результаты ниже.
У меня есть свой GOPROXY, установленный на нашем личном зеркале для proxy.golang.org (нахожусь за доверенным лицом). Это прекрасно работает, когда я делаю go get
и т. Д. В репозитории, только во время сканирования blackduck у меня возникает эта проблема.
Также стоит отметить, что я запускаю сканирование blackduck для java-приложения, и у меня нет проблем с этим приложением. Это только те приложения, в которых у меня возникают проблемы.
| _ | | | |
| | | |___| |_ ___ ___| |_
| | | / _ __/ _ / __| __|
| |/ / __/ || __/ (__| |_
|___/ ___|_____|___|__|
Detect Version: 6.9.1
2021-08-19 15:15:37 AEST INFO [main] ---
2021-08-19 15:15:37 AEST INFO [main] --- Current property values:
2021-08-19 15:15:37 AEST INFO [main] --- --property = value [notes]
2021-08-19 15:15:37 AEST INFO [main] --- ------------------------------------------------------------
2021-08-19 15:15:37 AEST INFO [main] --- blackduck.api.token = **************************************************************************************************** [cmd]
2021-08-19 15:15:37 AEST INFO [main] --- blackduck.trust.cert = true [cmd]
2021-08-19 15:15:37 AEST INFO [main] --- blackduck.url = <private-blackduck-portal>/ [cmd]
2021-08-19 15:15:37 AEST INFO [main] --- detect.code.location.name = My App - test [cmd]
2021-08-19 15:15:37 AEST INFO [main] --- detect.java.path = /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home [cmd]
2021-08-19 15:15:37 AEST INFO [main] --- detect.project.name = My App [cmd]
2021-08-19 15:15:37 AEST INFO [main] --- detect.project.version.name = My App - test [cmd]
2021-08-19 15:15:37 AEST INFO [main] --- detect.source.path = /Users/<user>/go/src/<private-github-repo>/projects/my-app [cmd]
2021-08-19 15:15:37 AEST INFO [main] --- ------------------------------------------------------------
2021-08-19 15:15:37 AEST INFO [main] ---
2021-08-19 15:15:37 AEST INFO [main] --- Tildes will be automatically resolved to USER HOME.
2021-08-19 15:15:37 AEST INFO [main] --- Source directory: /Users/<user>/go/src/<private-github-repo>/projects/my-app
2021-08-19 15:15:37 AEST INFO [main] --- Output directory: /var/root/blackduck
2021-08-19 15:15:37 AEST INFO [main] --- Run directory: /var/root/blackduck/runs/2021-08-19-05-15-37-341
2021-08-19 15:15:37 AEST INFO [main] ---
2021-08-19 15:15:38 AEST ERROR [main] --- Automatically trusting server certificates - not recommended for production use.
2021-08-19 15:15:38 AEST INFO [main] --- A successful connection was made.
2021-08-19 15:15:38 AEST INFO [main] --- Connection to the Black Duck server was successful.
2021-08-19 15:15:38 AEST ERROR [main] --- Automatically trusting server certificates - not recommended for production use.
2021-08-19 15:15:39 AEST INFO [main] --- Successfully connected to Black Duck (version 2020.10.0)!
2021-08-19 15:15:39 AEST INFO [main] --- ----------------------------------
2021-08-19 15:15:39 AEST INFO [main] --- Polaris tools will not be run.
2021-08-19 15:15:39 AEST INFO [main] --- ----------------------------------
2021-08-19 15:15:39 AEST INFO [main] --- Will include the Docker tool.
2021-08-19 15:15:39 AEST INFO [main] --- Docker actions finished.
2021-08-19 15:15:39 AEST INFO [main] --- ----------------------------------
2021-08-19 15:15:39 AEST INFO [main] --- Will include the Bazel tool.
2021-08-19 15:15:39 AEST INFO [main] --- Bazel actions finished.
2021-08-19 15:15:39 AEST INFO [main] --- ----------------------------------
2021-08-19 15:15:39 AEST INFO [main] --- Will include the detector tool.
2021-08-19 15:15:39 AEST INFO [main] --- Searching for detectors. This may take a while.
2021-08-19 15:15:40 AEST INFO [main] ---
2021-08-19 15:15:40 AEST INFO [main] --- Running executable >/usr/local/go/bin/go list -m
2021-08-19 15:15:40 AEST INFO [main] --- Process finished: 0
2021-08-19 15:15:40 AEST INFO [main] --- Running executable >/usr/local/go/bin/go version
2021-08-19 15:15:40 AEST INFO [main] --- Process finished: 0
2021-08-19 15:15:40 AEST INFO [main] --- Running executable >/usr/local/go/bin/go list -mod=readonly -m -u -json all
2021-08-19 15:15:40 AEST INFO [main] --- Process finished: 1
2021-08-19 15:15:40 AEST INFO [main] --- Error Output:
2021-08-19 15:15:40 AEST INFO [main] --- go list -m: loading module retractions for cloud.google.com/go@v0.44.3: Get "https://proxy.golang.org/cloud.google.com/go/@v/list": dial tcp: lookup proxy.golang.org: no such host
***<several more lines with the same error for other packages>***
2021-08-19 15:15:40 AEST INFO [main] --- ======================================================================================================
2021-08-19 15:15:40 AEST INFO [main] --- Detector Report
2021-08-19 15:15:40 AEST INFO [main] --- ======================================================================================================
2021-08-19 15:15:40 AEST INFO [main] --- /Users/<user>/go/src/<private-github-repo>/projects/my-app (depth 0)
2021-08-19 15:15:40 AEST INFO [main] --- GO_MOD - Go Mod Cli
2021-08-19 15:15:40 AEST INFO [main] --- Found file: /Users/<user>/go/src/<private-github-repo>/projects/my-app/go.mod
2021-08-19 15:15:40 AEST INFO [main] --- Found executable: /usr/local/go/bin/go
2021-08-19 15:15:40 AEST INFO [main] --- GIT - Git Cli
2021-08-19 15:15:40 AEST INFO [main] --- Found file: /Users/<user>/go/src/<private-github-repo>/projects/my-app/.git
2021-08-19 15:15:40 AEST INFO [main] --- Found executable: /usr/bin/git
2021-08-19 15:15:40 AEST INFO [main] --- GIT - Git Parse
2021-08-19 15:15:40 AEST INFO [main] --- Found file: /Users/<user>/go/src/<private-github-repo>/projects/my-app/.git
2021-08-19 15:15:40 AEST INFO [main] --- Found file: /Users/<user>/go/src/<private-github-repo>/projects/my-app/.git/config
2021-08-19 15:15:40 AEST INFO [main] --- Found file: /Users/<user>/go/src/<private-github-repo>/projects/my-app/.git/HEAD
2021-08-19 15:15:40 AEST INFO [main] --- Not needed as fallback: GIT - Git Cli successful
2021-08-19 15:15:40 AEST INFO [main] --- ----------------------------------
2021-08-19 15:15:41 AEST INFO [main] --- Detector actions finished.
2021-08-19 15:15:41 AEST INFO [main] --- ----------------------------------
2021-08-19 15:15:41 AEST INFO [main] --- Project name: My App
2021-08-19 15:15:41 AEST INFO [main] --- Project version: My App - test
2021-08-19 15:15:42 AEST INFO [main] --- ----------------------------------
2021-08-19 15:15:42 AEST INFO [main] --- Will include the signature scanner tool.
2021-08-19 15:15:42 AEST ERROR [main] --- Automatically trusting server certificates - not recommended for production use.
2021-08-19 15:15:42 AEST ERROR [main] --- Automatically trusting server certificates - not recommended for production use.
2021-08-19 15:15:46 AEST INFO [main] --- No scan targets provided - registering the source path /Users/<user>/go/src/<private-github-repo>/projects/my-app to scan
2021-08-19 15:15:46 AEST INFO [main] --- The Black Duck Signature Scanner downloaded/found successfully: /var/root/blackduck/tools
2021-08-19 15:15:46 AEST INFO [main] --- Starting the Black Duck Signature Scan commands.
2021-08-19 15:15:46 AEST INFO [pool-3-thread-1] --- Black Duck CLI command: /var/root/blackduck/tools/Black_Duck_Scan_Installation/scan.cli-2020.10.0/jre/Contents/Home/bin/java -Done-jar.silent=true -Done-jar.jar.path=/var/root/blackduck/tools/Black_Duck_Scan_Installation/scan.cli-2020.10.0/lib/cache/scan.cli.impl-standalone.jar -Xmx4096m -jar /var/root/blackduck/tools/Black_Duck_Scan_Installation/scan.cli-2020.10.0/lib/scan.cli-2020.10.0-standalone.jar --no-prompt --scheme https --host <private-blackduck-portal> --port 443 --insecure -v --logDir /var/root/blackduck/runs/2021-08-19-05-15-37-341/scan/BlackDuckScanOutput/2021-08-19_05-15-46-774_1 --statusWriteDir /var/root/blackduck/runs/2021-08-19-05-15-37-341/scan/BlackDuckScanOutput/2021-08-19_05-15-46-774_1 --project My App --release My App - test --name My App - test scan /Users/<user>/go/src/<private-github-repo>/projects/my-app
2021-08-19 15:16:09 AEST INFO [pool-3-thread-1] ---
2021-08-19 15:16:09 AEST INFO [pool-3-thread-1] --- Black Duck Signature Scanner return code: 0
2021-08-19 15:16:09 AEST INFO [pool-3-thread-1] --- You can view the logs at: '/private/var/root/blackduck/runs/2021-08-19-05-15-37-341/scan/BlackDuckScanOutput/2021-08-19_05-15-46-774_1'
2021-08-19 15:16:09 AEST INFO [main] --- Completed the Black Duck Signature Scan commands.
2021-08-19 15:16:09 AEST INFO [main] --- Signature scanner actions finished.
2021-08-19 15:16:09 AEST INFO [main] --- ----------------------------------
2021-08-19 15:16:09 AEST INFO [main] --- Will include the binary scanner tool.
2021-08-19 15:16:09 AEST INFO [main] --- Binary scanner actions finished.
2021-08-19 15:16:09 AEST INFO [main] --- ----------------------------------
2021-08-19 15:16:09 AEST INFO [main] --- Vulnerability Impact Analysis tool will not be run.
2021-08-19 15:16:09 AEST INFO [main] --- ----------------------------------
2021-08-19 15:16:09 AEST INFO [main] --- Will perform Black Duck post actions.
2021-08-19 15:16:09 AEST INFO [main] --- Black Duck actions have finished.
2021-08-19 15:16:09 AEST INFO [main] --- All tools have finished.
2021-08-19 15:16:09 AEST INFO [main] --- ----------------------------------
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- Creating status file: /var/root/blackduck/runs/2021-08-19-05-15-37-341/status/status.json
2021-08-19 15:16:09 AEST INFO [main] --- Status file has been deleted. To preserve status file, turn off cleanup actions.
2021-08-19 15:16:09 AEST INFO [main] --- Cleaning up directory: /var/root/blackduck/runs/2021-08-19-05-15-37-341
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- ======== Detect Issues ========
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- DETECTORS:
2021-08-19 15:16:09 AEST INFO [main] --- /Users/<user>/go/src/<private-github-repo>/projects/my-app
2021-08-19 15:16:09 AEST INFO [main] --- Exception: GO_MOD - Go Mod Cli
2021-08-19 15:16:09 AEST INFO [main] --- DetectableException: Querying for the go mod graph failed:1
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- ======== Detect Result ========
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- Black Duck Project BOM: https://<private-blackduck-portal>/api/projects/e51f552a-e328-4224-9941-c5b3e74782ba/versions/7f99cf3f-e638-4dac-b924-7ca6f19c32e7/components
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- ======== Detect Status ========
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- GIT: SUCCESS
2021-08-19 15:16:09 AEST INFO [main] --- GO_MOD: FAILURE
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- Signature scan / Snippet scan on /Users/<user>/go/src/<private-github-repo>/projects/my-app: SUCCESS
2021-08-19 15:16:09 AEST INFO [main] --- Overall Status: FAILURE_DETECTOR - Detect had one or more detector failures while extracting dependencies. Check that all projects build and your environment is configured correctly.
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- ===============================
2021-08-19 15:16:09 AEST INFO [main] ---
2021-08-19 15:16:09 AEST INFO [main] --- Detect duration: 00h 00m 32s 246ms
2021-08-19 15:16:09 AEST ERROR [main] --- Exiting with code 5 - FAILURE_DETECTOR
Я не знаю, почему это проблема только во время сканирования блэкдака, не уверен, что еще можно попробовать — любая помощь была бы признательна.