Skip to content

Commit

Permalink
Change storage location on CI to avoid Develocity scan dumps with dis…
Browse files Browse the repository at this point in the history
…abled publication to be captured for republication

(cherry picked from commit 5d61c69)
  • Loading branch information
jprinet authored and gsmet committed Jan 15, 2024
1 parent 613d9e3 commit f6082fb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .mvn/gradle-enterprise-custom-user-data.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f6082fb

Please sign in to comment.