@SuppressFBWarnings(value="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification="Jenkins.getInstance() is not null") public GitTool resolveGitTool(TaskListener listener) { if (gitTool == null) return GitTool.getDefaultInstallation(); GitTool git = Jenkins.getInstance().getDescriptorByType(GitTool.DescriptorImpl.class).getInstallation(gitTool); if (git == null) { listener.getLogger().println("Selected Git installation does not exist. Using Default"); git = GitTool.getDefaultInstallation(); } return git; }
/** * Resolves the {@link GitTool}. * @param gitTool the {@link GitTool#getName()} to resolve. * @return the {@link GitTool} * @since 3.4.0 */ @CheckForNull protected GitTool resolveGitTool(String gitTool) { return StringUtils.isBlank(gitTool) ? GitTool.getDefaultInstallation() : Jenkins.getActiveInstance() .getDescriptorByType(GitTool.DescriptorImpl.class) .getInstallation(gitTool); }
@Initializer(after=PLUGINS_STARTED) public static void onLoaded() { Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { LOGGER.severe("Jenkins.getInstance is null in GitSCM.onLoaded"); return; } DescriptorImpl desc = jenkins.getDescriptorByType(DescriptorImpl.class); if (desc.getOldGitExe() != null) { String exe = desc.getOldGitExe(); String defaultGit = GitTool.getDefaultInstallation().getGitExe(); if (exe.equals(defaultGit)) { return; } System.err.println("[WARNING] you're using deprecated gitexe attribute to configure git plugin. Use Git installations"); } }
.using(GitTool.getDefaultInstallation().getGitExe()) .getClient(); StandardCredentials credential = lookupCredentials(item, credentialsId, url);