Skip to content

Commit 9160ce1

Browse files
committed
add debugging
1 parent 6b41553 commit 9160ce1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

statistic-client/runDocker.bash

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
./gradlew build
3+
docker run --memory 1024m -v $(pwd)/build/classes/groovy/main/:/app/classes/:ro --network=host -e "DEFECTDOJO_URL=${DEFECTDOJO_URL}" -e "DEFECTDOJO_APIKEY=${DEFECTDOJO_API_KEY}" -e "DEFECTDOJO_USERNAME=${DEFECTDOJO_USERNAME}" quay.io/sdase/defectdojo-statistic-client:4

statistic-client/src/main/groovy/org/sdase/StatisticClient.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class StatisticClient {
2323

2424
static void call() {
2525
log.info('StatisticClient')
26+
log.debug('Debug logging enabled')
2627

2728
String dateFormat = 'yyyy-MM-dd HH:mm'
2829

@@ -39,7 +40,6 @@ class StatisticClient {
3940
LocalDateTime startDate = LocalDateTime.parse(startDateString, formatter)
4041

4142
log.info "Time range to look at: ${startDate} - ${endDate}"
42-
4343
def dojoConf = createDojoConf()
4444

4545
// set DEFECT_DOJO_OBJET_LIMIT to 3000 to save tons of unnecessary requests.
@@ -48,9 +48,11 @@ class StatisticClient {
4848
def productService = new ProductService(dojoConf)
4949
//noinspection GroovyAccessibility -- see comment above
5050
productService.DEFECT_DOJO_OBJET_LIMIT = 3000
51+
log.debug("limit is set to productService.DEFECT_DOJO_OBJET_LIMIT ${productService.DEFECT_DOJO_OBJET_LIMIT}")
5152
def findingService = new FindingService(dojoConf)
5253
//noinspection GroovyAccessibility -- see comment above
5354
findingService.DEFECT_DOJO_OBJET_LIMIT = 3000
55+
log.debug("limit is set to findingService.DEFECT_DOJO_OBJET_LIMIT ${findingService.DEFECT_DOJO_OBJET_LIMIT}")
5456

5557
generateResponseStatistic(productService, findingService, startDate, endDate)
5658
}
@@ -92,13 +94,14 @@ class StatisticClient {
9294
.filter(product -> shouldIncludeProduct(product))
9395
.collect(Collectors.toList())
9496

95-
log.debug "${products.size()} products found, iterating"
97+
log.info "${products.size()} products found, iterating"
9698

9799
for (product in products) {
98100
def findings = findingService.search([
99101
test__engagement__product: product.id.toString(),
100102
duplicate: "false"
101103
])
104+
log.info "Processing product ${product.id.toString()}"
102105
for (finding in findings) {
103106
if (finding.getCreatedAt() > endDate) {
104107
// skip all findings that were created after the end date. note that we can't filter for that at

0 commit comments

Comments
 (0)