Skip to content

Commit

Permalink
Merge pull request #18 from leanix/feature/CID-1502/fix-logging-end-s…
Browse files Browse the repository at this point in the history
…tatement

CID-1502 Fix logging and add header to requests
  • Loading branch information
geoandri authored Apr 10, 2023
2 parents 7909d1d + 4d8e778 commit 7ab34fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class VsmSbomBoosterApplication(

summaryReportService.appendRecord("Started VSM SBOM Booster at: ${LocalDateTime.now()}\n")
summaryReportService.appendRecord(
"VSM SBOM Booster ran with the following parameters " +
"VSM SBOM Booster started with the following parameters " +
"(secrets are omitted): \n"
)
summaryReportService.appendRecord("MOUNTED_VOLUME: ${propertiesConfiguration.mountedVolume}\n")
Expand Down Expand Up @@ -60,8 +60,6 @@ class VsmSbomBoosterApplication(
propertiesConfiguration.region
)
}

summaryReportService.appendRecord("\nFinished VSM SBOM Booster at ${LocalDateTime.now()} \n")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
import org.springframework.stereotype.Component
import java.time.LocalDateTime
import java.util.*
import kotlin.system.exitProcess

Expand Down Expand Up @@ -54,6 +55,8 @@ class ExitScheduler(
getPercentage(VsmSbomBoosterApplication.counter.get().toDouble(), tasksSubmitted.toDouble())
)} %."
)

summaryReportService.appendRecord("\nFinished VSM SBOM Booster at ${LocalDateTime.now()} \n")
exitProcess(1)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ class VsmDiscoveryService(

companion object {
private val logger: Logger = LoggerFactory.getLogger(VsmDiscoveryService::class.java)
const val SOURCE_CUSTOM_HEADER = "X-Lx-Vsm-Discovery-Source"
}

fun sendToVsm(projectUrl: String, downloadedFolder: String, leanIxToken: String, region: String) {
val restTemplate = RestTemplate()
val headers = HttpHeaders()
headers.contentType = MediaType.MULTIPART_FORM_DATA
headers.set("Authorization", "Bearer $leanIxToken")
headers.set(SOURCE_CUSTOM_HEADER, "VSMSbomBooster")

val multipartBodyBuilder = MultipartBodyBuilder()

Expand Down

0 comments on commit 7ab34fd

Please sign in to comment.