Skip to content

Commit dea552f

Browse files
committed
LibraryConfiguration: defaultedVersionSCM(): drop fallback WorkflowJob handling
1 parent 863b170 commit dea552f

File tree

1 file changed

+7
-39
lines changed

1 file changed

+7
-39
lines changed

src/main/java/org/jenkinsci/plugins/workflow/libs/LibraryConfiguration.java

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -275,45 +275,13 @@ private String defaultedVersionSCM(@NonNull Run<?, ?> run, @NonNull TaskListener
275275
}
276276
}
277277

278-
if (scm0 == null) {
279-
// WARNING: the WorkflowJob.getSCMs() does not return SCMs
280-
// associated with the current build configuration, but
281-
// rather those that were associated with previous runs
282-
// for different branches (with lastSuccessfulBuild on top)!
283-
BranchJobProperty property = ((WorkflowJob)runParent).getProperty(BranchJobProperty.class);
284-
if (property == null) { // && !(runParent.getParent() instanceof SCMSourceOwner)) {
285-
if (logger != null) {
286-
logger.println("defaultedVersion(): " +
287-
"WorkflowJob '" +
288-
runParent.getClass().getName() +
289-
"' is not associated with any SCMs");
290-
}
291-
} else {
292-
Branch pipelineBranch = property.getBranch();
293-
if (logger != null) {
294-
logger.println("defaultedVersion(): " +
295-
"inspecting WorkflowJob '" +
296-
runParent.getClass().getName() +
297-
"' for SCMs it might use");
298-
}
299-
if (pipelineBranch != null) {
300-
if (logger != null) {
301-
logger.println("defaultedVersion(): inspecting pipelineBranch '" +
302-
pipelineBranch.getClass().getName() +
303-
"': " + pipelineBranch.toString());
304-
}
305-
/*
306-
if ("hudson.plugins.git.GitSCM".equals(scmN.getClass().getName())) {
307-
// The best we can do here is accept
308-
// the first seen SCM (with branch
309-
// support which we know how to query).
310-
scm0 = scmN;
311-
break;
312-
}
313-
*/
314-
}
315-
}
316-
}
278+
// WARNING: the WorkflowJob.getSCMs() does not return SCMs
279+
// associated with the current build configuration, but
280+
// rather those that were associated with previous runs
281+
// for different branches (with lastSuccessfulBuild on
282+
// top), so we should not fall back looking at those!
283+
// And we inspect (MBP) BranchJobProperty early in the
284+
// main defaultedVersion() method.
317285
} // if (runParent != null && runParent instanceof WorkflowJob)
318286

319287
// If no hit with runParent, look into the run itself:

0 commit comments

Comments
 (0)