From 5d61c691acce60e600fffa79a6f5dae7b1ad2535 Mon Sep 17 00:00:00 2001 From: Jerome Prinet Date: Tue, 9 Jan 2024 14:48:47 +0100 Subject: [PATCH] Change storage location on CI to avoid Develocity scan dumps with disabled publication to be captured for republication --- .mvn/gradle-enterprise-custom-user-data.groovy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.mvn/gradle-enterprise-custom-user-data.groovy b/.mvn/gradle-enterprise-custom-user-data.groovy index 8e78dcf99e597..0f9b416591ea7 100644 --- a/.mvn/gradle-enterprise-custom-user-data.groovy +++ b/.mvn/gradle-enterprise-custom-user-data.groovy @@ -12,6 +12,17 @@ if(session?.getRequest()?.getBaseDirectory() != null) { if(!publish) { // do not publish a build scan for test builds log.debug("Disabling build scan publication for " + session.getRequest().getBaseDirectory()) + + // change storage location on CI to avoid Develocity scan dumps with disabled publication to be captured for republication + if (System.env.GITHUB_ACTIONS) { + try { + def storageLocationTmpDir = java.nio.file.Files.createTempDirectory(java.nio.file.Paths.get(System.env.RUNNER_TEMP), "buildScanTmp").toAbsolutePath() + log.debug('Update storage location to ' + storageLocationTmpDir) + gradleEnterprise.setStorageDirectory(storageLocationTmpDir) + } catch (IOException e) { + log.error('Temporary storage location directory cannot be created, the Build Scan will be published', e) + } + } } } buildScan.publishAlwaysIf(publish)