Skip to content

Commit

Permalink
fixed getCacheDirectory()
Browse files Browse the repository at this point in the history
Signed-off-by: munishchouhan <[email protected]>
  • Loading branch information
munishchouhan committed Sep 24, 2024
1 parent a3b45e1 commit 633f141
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 8 additions & 3 deletions src/main/groovy/io/seqera/wave/configuration/ScanConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ class ScanConfig {

@Memoized
Path getCacheDirectory() {
final result = Path.of(buildDirectory).toAbsolutePath().resolve('.trivy-cache')
Files.createDirectories(result)
return result
try {
final result = Path.of(buildDirectory).toAbsolutePath().resolve('.trivy-cache')
Files.createDirectories(result)
return result
} catch (Exception e) {
log.error("Failed to create cache directory: ${e.message}")
return null
}
}

String getRequestsCpu() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ import io.seqera.wave.service.mirror.MirrorConfig
@MicronautTest
class K8sServiceImplTest extends Specification {

@Replaces(ScanConfig.class)
static class MockScanConfig extends ScanConfig {
@Override
Path getCacheDirectory() {
return Path.of('/build/scan/cache')
}
}

def 'should validate context OK ' () {
when:
def PROPS = [
Expand Down

0 comments on commit 633f141

Please sign in to comment.