@Override public void queueJob(String path) throws NameNotProvidedException { validateNameArg(path); BuildableItem project = lookupStrategy.getItem(build.getParent(), path, BuildableItem.class); LOGGER.log( Level.INFO, format("Scheduling build of %s from %s", path, build.getParent().getName())); project.scheduleBuild(new Cause.UpstreamCause((Run) build)); }
private String lookupJob(String path) throws IOException { LOGGER.log(Level.FINE, format("Looking up item %s", path)); AbstractItem item = lookupStrategy.getItem(build.getProject(), path, AbstractItem.class); if (item != null) { XmlFile xmlFile = item.getConfigFile(); String jobXml = xmlFile.asString(); LOGGER.log(Level.FINE, format("Looked up item with config %s", jobXml)); return jobXml; } else { LOGGER.log(Level.WARNING, format("No item called %s could be found.", path)); throw new IOException(format("No item called %s could be found.", path)); } }
@Override public boolean createOrUpdateConfig(String path, String config, boolean ignoreExisting) throws NameNotProvidedException, ConfigurationMissingException { LOGGER.log(Level.INFO, format("createOrUpdateConfig for %s", path)); boolean created = false; validateUpdateArgs(path, config); AbstractItem item = lookupStrategy.getItem(build.getProject(), path, AbstractItem.class); String jobName = FilenameUtils.getName(path); Jenkins.checkGoodName(jobName); if (item == null) { created = createNewItem(path, config); } else if (!ignoreExisting) { created = updateExistingItem(item, config); } return created; }