public boolean contains(D d) { return get(d)!=null; }
@Override public boolean isFingerprintConfigured() { return getPublishersList().get(Fingerprinter.class)!=null; }
public MavenInstallation inferMavenInstallation() { Maven m = getBuildersList().get(Maven.class); if (m!=null) return m.getMaven(); return null; }
/** * Is this monitor currently ignored? */ public boolean isIgnored() { NodeMonitor m = ComputerSet.getMonitors().get(this); return m==null || m.isIgnored(); }
/** * Returns only those upstream projects that defines {@link BuildTrigger} to this project. * This is a subset of {@link #getUpstreamProjects()} * <p>No longer used in the UI. * @return A List of upstream projects that has a {@link BuildTrigger} to this project. */ public final List<AbstractProject> getBuildTriggerUpstreamProjects() { ArrayList<AbstractProject> result = new ArrayList<AbstractProject>(); for (AbstractProject<?,?> ap : getUpstreamProjects()) { BuildTrigger buildTrigger = ap.getPublishersList().get(BuildTrigger.class); if (buildTrigger != null) if (buildTrigger.getChildJobs(ap).contains(this)) result.add(ap); } return result; }
private void locationChanged(Item item, String oldFullName, String newFullName) { // update BuildTrigger of other projects that point to this object. // can't we generalize this? for( Project<?,?> p : Jenkins.getInstance().allItems(Project.class) ) { BuildTrigger t = p.getPublishersList().get(BuildTrigger.class); if(t!=null) { String cp2 = Items.computeRelativeNamesAfterRenaming(oldFullName, newFullName, t.childProjects, p.getParent()); if (!cp2.equals(t.childProjects)) { t.childProjects = cp2; try { p.save(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldFullName+" to "+newFullName,e); } } } } } }
return null; InstallSourceProperty isp = tool.getProperties().get(InstallSourceProperty.class); if (isp == null) { return null;
T existing = get((D)d); String name = d.getJsonSafeClassName(); JSONObject o = json.optJSONObject(name);
ToolLocationNodeProperty property = node.getNodeProperties().get(ToolLocationNodeProperty.class); if (property != null) { result = property.getHome(installation);
public static String resolvePendingBuildName(Job<?, ?> job) { if (job instanceof AbstractProject) { GitLabCommitStatusPublisher publisher = (GitLabCommitStatusPublisher) ((AbstractProject) job).getPublishersList().get(GitLabCommitStatusPublisher.class); if (publisher != null) { return publisher.getName(); } } else if (job instanceof WorkflowJob) { GitLabPushTrigger trigger = GitLabPushTrigger.getFromJob(job); if (trigger != null) { return trigger.getPendingBuildName(); } } return null; } }
for (AbstractProject<?,?> p : Jenkins.getInstance().allItems(AbstractProject.class)) { try { ArtifactArchiver aa = p.getPublishersList().get(ArtifactArchiver.class); if (aa != null && aa.latestOnly != null) { if (aa.latestOnly) { p.save(); Fingerprinter f = p.getPublishersList().get(Fingerprinter.class); if (f != null && f.getRecordBuildArtifacts()) { f.recordBuildArtifacts = null;
/** * Accepts submission from the configuration page. */ @RequirePOST public synchronized HttpResponse doConfigSubmit( StaplerRequest req) throws IOException, ServletException, FormException { BulkChange bc = new BulkChange(MONITORS_OWNER); try { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); monitors.rebuild(req,req.getSubmittedForm(),getNodeMonitorDescriptors()); // add in the rest of instances are ignored instances for (Descriptor<NodeMonitor> d : NodeMonitor.all()) if(monitors.get(d)==null) { NodeMonitor i = createDefaultInstance(d, true); if(i!=null) monitors.add(i); } // recompute the data for (NodeMonitor nm : monitors) { nm.triggerUpdate(); } return FormApply.success("."); } finally { bc.commit(); } }
@Test @ConfiguredWithCode("MavenConfiguratorTest.yml") public void should_configure_maven_tools_and_global_config() { final Maven.DescriptorImpl descriptor= (Maven.DescriptorImpl) j.jenkins.getDescriptorOrDie(Maven.class); Assert.assertEquals(1, descriptor.getInstallations().length); Assert.assertEquals("/usr/share/maven", descriptor.getInstallations()[0].getHome()); InstallSourceProperty installSourceProperty = descriptor.getInstallations()[0].getProperties().get(InstallSourceProperty.class); Assert.assertEquals("3.5.0", installSourceProperty.installers.get(Maven.MavenInstaller.class).id); final SettingsProvider provider = GlobalMavenConfig.get().getSettingsProvider(); Assert.assertTrue(provider instanceof FilePathSettingsProvider); Assert.assertEquals("/usr/share/maven-settings.xml", ((FilePathSettingsProvider)provider).getPath()); } }
@Test @ConfiguredWithCode("JdkConfiguratorTest.yml") public void should_configure_maven_tools_and_global_config() { final Object descriptor = j.jenkins.getDescriptorOrDie(JDK.class); Assert.assertNotNull(descriptor); Assert.assertEquals(1, ((JDK.DescriptorImpl) descriptor).getInstallations().length); JDK jdk = ((JDK.DescriptorImpl) descriptor).getInstallations()[0]; Assert.assertEquals("jdk8", jdk.getName()); Assert.assertEquals("/jdk", jdk.getHome()); InstallSourceProperty installSourceProperty = jdk.getProperties().get(InstallSourceProperty.class); Assert.assertEquals(1, installSourceProperty.installers.size()); JDKInstaller installer = installSourceProperty.installers.get(JDKInstaller.class); Assert.assertEquals("jdk-8u181-oth-JPR", installer.id); Assert.assertTrue(installer.acceptLicense); } }
/** * @deprecated * Moved to {@link WipeWorkspace} * @return true if wipe workspace extenstion is enabled */ public boolean getWipeOutWorkspace() { return getExtensions().get(WipeWorkspace.class)!=null; }
/** * @deprecated * Moved to {@link IgnoreNotifyCommit} * @return true if commit notifications are ignored */ public boolean isIgnoreNotifyCommit() { return getExtensions().get(IgnoreNotifyCommit.class)!=null; }
@Deprecated public String getExcludedUsers() { UserExclusion ue = getExtensions().get(UserExclusion.class); return ue!=null ? ue.getExcludedUsers() : null; }
/** * @deprecated * Moved to {@link CloneOption} * @return reference repository or null if reference repository is not defined */ public String getReference() { CloneOption m = getExtensions().get(CloneOption.class); return m!=null ? m.getReference() : null; }
/** * @deprecated * Moved to {@link LocalBranch} * @return name of local branch used for checkout or null if LocalBranch extension is not enabled */ public String getLocalBranch() { LocalBranch lb = getExtensions().get(LocalBranch.class); return lb!=null ? lb.getLocalBranch() : null; }
private void addIfMissing(GhprbExtension ext) { if (getExtensions().get(ext.getClass()) == null) { getExtensions().add(ext); } } }