From 9c8663e5c89500dc4ae9195bfca01fced943463d Mon Sep 17 00:00:00 2001 From: Aaron Echavarria Date: Mon, 16 Sep 2024 12:08:32 -0600 Subject: [PATCH] log message when scm comes from cache --- .../plugins/jte/util/FileSystemWrapperFactory.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/groovy/org/boozallen/plugins/jte/util/FileSystemWrapperFactory.groovy b/src/main/groovy/org/boozallen/plugins/jte/util/FileSystemWrapperFactory.groovy index ad20a3df..be378335 100644 --- a/src/main/groovy/org/boozallen/plugins/jte/util/FileSystemWrapperFactory.groovy +++ b/src/main/groovy/org/boozallen/plugins/jte/util/FileSystemWrapperFactory.groovy @@ -99,9 +99,11 @@ class FileSystemWrapperFactory { private static FileSystemWrapper fromSCM(FlowExecutionOwner owner, WorkflowJob job, SCM scm) { FileSystemWrapper fsw + TemplateLogger logger = new TemplateLogger(owner.getListener()) FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scm: scm) if (CACHE.containsKey(cacheKey)) { fsw = CACHE.get(cacheKey) + logger.print("Loading scm: ${scm.getKey()} from cache") } else { SCMFileSystem fs fs = SCMFileSystem.of(job, scm) @@ -114,7 +116,7 @@ class FileSystemWrapperFactory { private static FileSystemWrapper fromMultiBranchProject(FlowExecutionOwner owner, WorkflowJob job, TaskListener listener){ ItemGroup parent = job.getParent() - + TemplateLogger logger = new TemplateLogger(owner.getListener()) BranchJobProperty property = job.getProperty(BranchJobProperty) if (!property) { throw new JTEException("BranchJobProperty is somehow missing") @@ -137,6 +139,7 @@ class FileSystemWrapperFactory { FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scmSource: scmSource, scmHead: head, scmRevision: rev) if (CACHE.containsKey(cacheKey)) { fsw = CACHE.get(cacheKey) + logger.print("Loading scm: ${scmKey} from cache") } else { fs = SCMFileSystem.of(scmSource, head, rev) fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner) @@ -148,6 +151,7 @@ class FileSystemWrapperFactory { FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scm: jobSCM) if (CACHE.containsKey(cacheKey)) { fsw = CACHE.get(cacheKey) + logger.print("Loading scm: ${scmKey} from cache") } else { fs = SCMFileSystem.of(job, jobSCM) fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner) @@ -158,6 +162,7 @@ class FileSystemWrapperFactory { } private static FileSystemWrapper fromPipelineJob(FlowExecutionOwner owner, WorkflowJob job){ + TemplateLogger logger = new TemplateLogger(owner.getListener()) FlowDefinition definition = job.getDefinition() SCM jobSCM = definition.getScm() String scmKey = jobSCM.getKey() @@ -165,6 +170,7 @@ class FileSystemWrapperFactory { FileSystemWrapper fsw if (CACHE.containsKey(cacheKey)) { fsw = CACHE.get(cacheKey) + logger.print("Loading scm: ${scmKey} from cache") } else { SCMFileSystem fs = SCMFileSystem.of(job, jobSCM) fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner)