Uploading Reports - More options
Uploading Git Commit Logs
If you do not work with github
or cannot provide access to the source folder where the git logs are located, you can generate them on your own and upload them separately to the SeaLights servers.
Generating the commit reports
The file must be a JSON file with an array "commitLog
" of commits. Below, a sample command which generate 2 days of commit logs:
echo "{ \"commitLog\": " > commitLog.json
git log --pretty=format:'{"commit": "%H","authorName": "%an","authorEmail": "%ae","commiterName": "%cn","commiterEmail": "%ce","authorDate": "%at000","commiterDate": "%ct000","title": "%f"},' --since="2 days ago" | sed "$ s/,$//" | sed ':a;N;$!ba;s/\r\n\([^{]\)/\\n\1/g'| awk 'BEGIN { print("[") } { print($0) } END { print("]") }' >> commitLog.json
echo "}" >> commitLog.json
Upload git generated commit log reports
java -jar sl-test-listener.jar uploadReports -tokenfile /path/to/sltoken.txt -buildsessionidfile buildSessionId.txt -reportFile commitLog.json -type "commitLog" -source "script"
Uploading Multiple Files
When uploading report files to the SeaLights server, you might need to upload multiple files rather than only one.
This can be done by either provide a folder where all the files existing in it will be uploaded or alternatively upload each single file in a command line loop.
An open execution is required in order to upload a report
Upload multiple report files in a folder
java -jar sl-test-listener.jar uploadReports -tokenfile /path/to/sltoken.txt -buildsessionidfile buildSessionId.txt -reportFilesFolder "/path/to/reports/" -source "Junit xml report"
All the files in the specified folder will be uploaded regardless of their extension
In Windows, you should make sure to remove any trailing \
at the end of the path in the value of the -reportFilesFolder
flag
Upload multiple report files using a command line loop
Sample commands
for f in /path/to/junit_report_*.xml
do
java -jar sl-test-listener.jar uploadReports -tokenfile /path/to/sltoken.txt -buildsessionidfile buildSessionId.txt -reportFile "$f" -source "Junit xml report"
done
Last updated
Was this helpful?