Fail xray job if unauth
What does this MR do and why?
issue: #22 (closed)
After inspecting attached X Ray scan CI job it is marked as successful despite GitLab API returning 401 responses.
in this MR, if 401 is returned, no reports will be generated.
experiment from my localhost:
tiangao@Tians-MBP-2 repository-x-ray % make build
Building cmd/scan...
go build -ldflags="-s -X 'main.buildTime=2024-03-21T16:52:24-0400' -X 'main.build=1.1.0-6-g951f4c4'" -o=./bin/x-ray-scan ./cmd/scan
tiangao@Tians-MBP-2 repository-x-ray % bin/x-ray-scan -p internal/testdata/dep_files/ -o reports
2024/03/24 17:18:37 INFO Scanning in internal/testdata/dep_files/
2024/03/24 17:18:37 INFO Found go.mod at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found package.json at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found Gemfile.lock at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found pyproject.toml at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found requirements.txt at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found environment.yml at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found composer.json at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found pom.xml at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found build.gradle at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found build.gradle.kts at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found ConsoleApp1.csproj at internal/testdata/dep_files/ConsoleApp1
2024/03/24 17:18:37 INFO Found conanfile.txt at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found conanfile.py at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Found vcpkg.json at internal/testdata/dep_files
2024/03/24 17:18:37 INFO Scanning package.json
2024/03/24 17:18:37 INFO Found 7 JavaScript modules
2024/03/24 17:18:37 INFO Getting JavaScript modules descriptions. This can take a while...
2024/03/24 17:18:37 INFO Processing batch... (1/1)
2024/03/24 17:18:40 Failed to get completions. url http://127.0.0.1:3000/api/v4 returns 401, optional details:
tiangao@Tians-MBP-2 repository-x-ray % rm -rf reports
tiangao@Tians-MBP-2 repository-x-ray % bin/x-ray-scan -p internal/testdata/dep_files/ -o reports
2024/03/24 17:19:30 INFO Scanning in internal/testdata/dep_files/
2024/03/24 17:19:30 INFO Found go.mod at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found package.json at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found Gemfile.lock at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found pyproject.toml at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found requirements.txt at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found environment.yml at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found composer.json at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found pom.xml at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found build.gradle at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found build.gradle.kts at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found ConsoleApp1.csproj at internal/testdata/dep_files/ConsoleApp1
2024/03/24 17:19:30 INFO Found conanfile.txt at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found conanfile.py at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Found vcpkg.json at internal/testdata/dep_files
2024/03/24 17:19:30 INFO Scanning package.json
2024/03/24 17:19:30 INFO Found 7 JavaScript modules
2024/03/24 17:19:30 INFO Getting JavaScript modules descriptions. This can take a while...
2024/03/24 17:19:30 INFO Processing batch... (1/1)
2024/03/24 17:19:36 Failed to get completions. url http://127.0.0.1:3000/api/v4 returns 401, optional details:
Closes #22 (closed)
Edited by Tian Gao