-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-26100] Switch buildEnvVars and others to Run #492
Changes from 3 commits
47f738c
6ee22da
803d0cb
e9dbe68
3c125fb
b409573
6d158dc
3681660
74cd756
f4bb730
e38f561
133609e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
import hudson.scm.ChangeLogSet; | ||
import hudson.scm.ChangeLogSet.AffectedFile; | ||
import hudson.scm.EditType; | ||
import jenkins.model.Jenkins; | ||
import org.apache.commons.lang.math.NumberUtils; | ||
import org.kohsuke.stapler.export.Exported; | ||
import org.kohsuke.stapler.export.ExportedBean; | ||
|
@@ -420,13 +421,16 @@ private boolean hasHudsonTasksMailer() { | |
} | ||
|
||
private boolean isCreateAccountBasedOnEmail() { | ||
Hudson hudson = Hudson.getInstance(); | ||
if (hudson == null) { | ||
Jenkins jenkins = Jenkins.getInstanceOrNull(); | ||
if (jenkins == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe just revert changes in this file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'k |
||
return false; | ||
} | ||
DescriptorImpl descriptor = (DescriptorImpl) jenkins.getDescriptor(GitSCM.class); | ||
if (descriptor != null) { | ||
return descriptor.isCreateAccountBasedOnEmail(); | ||
} else { | ||
return false; | ||
} | ||
DescriptorImpl descriptor = (DescriptorImpl) hudson.getDescriptor(GitSCM.class); | ||
|
||
return descriptor.isCreateAccountBasedOnEmail(); | ||
} | ||
|
||
@Override | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1255,8 +1255,8 @@ private void computeChangeLog(GitClient git, Revision revToBuild, TaskListener l | |
} | ||
} | ||
|
||
public void buildEnvVars(AbstractBuild<?, ?> build, java.util.Map<String, String> env) { | ||
super.buildEnvVars(build, env); | ||
@Override | ||
public void buildEnvironment(Run<?, ?> build, java.util.Map<String, String> env) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put in the usual TODOs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'k |
||
Revision rev = fixNull(getBuildData(build)).getLastBuiltRevision(); | ||
if (rev!=null) { | ||
Branch branch = Iterables.getFirst(rev.getBranches(), null); | ||
|
@@ -1319,7 +1319,7 @@ private String getBranchName(Branch branch) | |
return name; | ||
} | ||
|
||
private String getLastBuiltCommitOfBranch(AbstractBuild<?, ?> build, Branch branch) { | ||
private String getLastBuiltCommitOfBranch(Run<?, ?> build, Branch branch) { | ||
String prevCommit = null; | ||
if (build.getPreviousBuiltBuild() != null) { | ||
final Build lastBuildOfBranch = fixNull(getBuildData(build.getPreviousBuiltBuild())).getLastBuildOfBranch(branch.getName()); | ||
|
@@ -1333,7 +1333,7 @@ private String getLastBuiltCommitOfBranch(AbstractBuild<?, ?> build, Branch bran | |
return prevCommit; | ||
} | ||
|
||
private String getLastSuccessfulBuiltCommitOfBranch(AbstractBuild<?, ?> build, Branch branch) { | ||
private String getLastSuccessfulBuiltCommitOfBranch(Run<?, ?> build, Branch branch) { | ||
String prevCommit = null; | ||
if (build.getPreviousSuccessfulBuild() != null) { | ||
final Build lastSuccessfulBuildOfBranch = fixNull(getBuildData(build.getPreviousSuccessfulBuild())).getLastBuildOfBranch(branch.getName()); | ||
|
@@ -1772,9 +1772,9 @@ private boolean isRevExcluded(GitClient git, Revision r, TaskListener listener, | |
|
||
@Initializer(after=PLUGINS_STARTED) | ||
public static void onLoaded() { | ||
Jenkins jenkins = Jenkins.getInstance(); | ||
Jenkins jenkins = Jenkins.getInstanceOrNull(); | ||
if (jenkins == null) { | ||
LOGGER.severe("Jenkins.getInstance is null in GitSCM.onLoaded"); | ||
LOGGER.severe("Jenkins.getInstanceOrNull is null in GitSCM.onLoaded"); | ||
return; | ||
} | ||
DescriptorImpl desc = jenkins.getDescriptorByType(DescriptorImpl.class); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -470,7 +470,7 @@ protected String getCacheEntry() { | |
} | ||
|
||
protected static File getCacheDir(String cacheEntry) { | ||
Jenkins jenkins = Jenkins.getInstance(); | ||
Jenkins jenkins = Jenkins.getInstanceOrNull(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of these should actually be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went for the most stupidly non-logic-altering Findbugs fix I could. =) Wasn't 100% sure there weren't some cases where they might be expecting the existing behavior with a possibly null |
||
if (jenkins == null) { | ||
LOGGER.severe("Jenkins instance is null in AbstractGitSCMSource.getCacheDir"); | ||
return null; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.61
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.60 I meant.