/** * Parses {@link SCM} configuration from the submitted form. * * @param target * The project for which this SCM is configured to. */ @SuppressWarnings("deprecation") public static SCM parseSCM(StaplerRequest req, AbstractProject target) throws FormException, ServletException { SCM scm = SCM.all().newInstanceFromRadioList(req.getSubmittedForm().getJSONObject("scm")); if (scm == null) { scm = new NullSCM(); // JENKINS-36043 workaround for AbstractMultiBranchProject.submit } scm.getDescriptor().generation++; return scm; }
@Override public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException { super.onLoad(parent, name); if (buildMixIn == null) { buildMixIn = createBuildMixIn(); } buildMixIn.onLoad(parent, name); builds = buildMixIn.getRunMap(); triggers().setOwner(this); for (Trigger t : triggers()) { try { t.start(this, Items.currentlyUpdatingByXml()); } catch (Throwable e) { LOGGER.log(Level.WARNING, "could not start trigger while loading project '" + getFullName() + "'", e); } } if(scm==null) scm = new NullSCM(); // perhaps it was pointing to a plugin that no longer exists. if(transientActions==null) transientActions = new Vector<Action>(); // happens when loaded from disk updateTransientActions(); }
@Override public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException { return new NullSCM(); } }
/** * {@inheritDoc} */ @Override public SCM getDefaultValue() { return new NullSCM(); }
/** * {@inheritDoc} */ @Override public SCM getDefaultValue() { return new NullSCM(); }
/** * {@inheritDoc} */ @Override public SCM getDefaultValue() { return new NullSCM(); }
@Override public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException { return new NullSCM(); } }
@Override public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException { return new NullSCM(); } }
/** * {@inheritDoc} */ @Override public SCM getDefaultValue() { return new NullSCM(); }
@Override public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException { return new NullSCM(); } }
@Override protected SCM reduceFromFullInheritance(Deque<SCM> list) { if (list == null || list.isEmpty()) { return new NullSCM(); } //Return the SCM that was defined last and is not a NullSCM Iterator<SCM> iter = list.descendingIterator(); while (iter.hasNext()) { SCM scm = iter.next(); if (scm != null && !(scm instanceof NullSCM)) { return scm; } } //All SCMs are NullSCMs; so it does not matter which one to return return list.peekLast(); } };
@Override protected SCM reduceFromFullInheritance(Deque<SCM> list) { if (list == null || list.isEmpty()) { return new NullSCM(); } //Return the SCM that was defined last and is not a NullSCM Iterator<SCM> iter = list.descendingIterator(); while (iter.hasNext()) { SCM scm = iter.next(); if (scm != null && !(scm instanceof NullSCM)) { return scm; } } //All SCMs are NullSCMs; so it does not matter which one to return return list.peekLast(); } };
/** * Parses {@link SCM} configuration from the submitted form. * * @param target * The project for which this SCM is configured to. */ public static SCM parseSCM(StaplerRequest req, AbstractProject target) throws FormException, ServletException { String scm = req.getParameter("scm"); if(scm==null) return new NullSCM(); int scmidx = Integer.parseInt(scm); SCMDescriptor<?> d = SCM._for(target).get(scmidx); d.generation++; return d.newInstance(req, req.getSubmittedForm().getJSONObject("scm")); }
/** * Parses {@link SCM} configuration from the submitted form. * * @param target * The project for which this SCM is configured to. */ public static SCM parseSCM(StaplerRequest req, AbstractProject target) throws FormException, ServletException { String scm = req.getParameter("scm"); if(scm==null) return new NullSCM(); int scmidx = Integer.parseInt(scm); SCMDescriptor<?> d = SCM._for(target).get(scmidx); d.generation++; return d.newInstance(req, req.getSubmittedForm().getJSONObject("scm")); }
/** * Parses {@link SCM} configuration from the submitted form. * * @param target * The project for which this SCM is configured to. */ public static SCM parseSCM(StaplerRequest req, AbstractProject target) throws FormException, ServletException { String scm = req.getParameter("scm"); if(scm==null) return new NullSCM(); int scmidx = Integer.parseInt(scm); SCMDescriptor<?> d = SCM._for(target).get(scmidx); d.generation++; return d.newInstance(req, req.getSubmittedForm().getJSONObject("scm")); }
/** * Parses {@link SCM} configuration from the submitted form. * * @param target The project for which this SCM is configured to. */ public static SCM parseSCM(StaplerRequest req, AbstractProject target) throws FormException, ServletException { String scm = req.getParameter("scm"); if (scm == null) { return new NullSCM(); } int scmidx = Integer.parseInt(scm); SCMDescriptor<?> d = SCM._for(target).get(scmidx); d.generation++; return d.newInstance(req, req.getSubmittedForm().getJSONObject("scm")); }
private static SCM getScm(final Run<?, ?> run) { Job<?, ?> job = run.getParent(); if (job instanceof WorkflowJob) { Collection<? extends SCM> scms = ((WorkflowJob) job).getSCMs(); if (!scms.isEmpty()) { return scms.iterator().next(); // TODO: what should we do if more than one SCM has been used } } else if (run instanceof AbstractBuild) { AbstractProject<?, ?> project = ((AbstractBuild) run).getProject(); if (project.getScm() != null) { return project.getScm(); } SCM scm = project.getRootProject().getScm(); if (scm != null) { return scm; } } return new NullSCM(); }
/** * Parses {@link SCM} configuration from the submitted form. * * @param target * The project for which this SCM is configured to. */ @SuppressWarnings("deprecation") public static SCM parseSCM(StaplerRequest req, AbstractProject target) throws FormException, ServletException { SCM scm = SCM.all().newInstanceFromRadioList(req.getSubmittedForm().getJSONObject("scm")); if (scm == null) { scm = new NullSCM(); // JENKINS-36043 workaround for AbstractMultiBranchProject.submit } scm.getDescriptor().generation++; return scm; }
@Override public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException { super.onLoad(parent, name); if (buildMixIn == null) { buildMixIn = createBuildMixIn(); } buildMixIn.onLoad(parent, name); builds = buildMixIn.getRunMap(); triggers().setOwner(this); for (Trigger t : triggers()) { try { t.start(this, Items.currentlyUpdatingByXml()); } catch (Throwable e) { LOGGER.log(Level.WARNING, "could not start trigger while loading project '" + getFullName() + "'", e); } } if(scm==null) scm = new NullSCM(); // perhaps it was pointing to a plugin that no longer exists. if(transientActions==null) transientActions = new Vector<Action>(); // happens when loaded from disk updateTransientActions(); }
@Override public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException { super.onLoad(parent, name); this.builds = new RunMap<R>(); this.builds.load(this, new Constructor<R>() { public R create(File dir) throws IOException { return loadBuild(dir); } }); // boolean! Can't tell if xml file contained false.. if (enableRemoteTrigger) OldDataMonitor.report(this, "1.77"); for (Trigger t : getTriggerDescribableList()) { t.start(this,false); } if(scm==null) scm = new NullSCM(); // perhaps it was pointing to a plugin that no longer exists. if(transientActions==null) transientActions = new Vector<Action>(); // happens when loaded from disk updateTransientActions(); getTriggerDescribableList().setOwner(this); }