Skip to content

Commit

Permalink
log message when scm comes from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Echavarria committed Sep 16, 2024
1 parent 0525457 commit 9c8663e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -158,13 +162,15 @@ 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()
FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scm: jobSCM)
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)
Expand Down

0 comments on commit 9c8663e

Please sign in to comment.