Skip to content

Commit

Permalink
changes to fit last (1.465) jenkins version, following the API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DeminAlexey committed May 30, 2012
1 parent 9c82261 commit 9047271
Show file tree
Hide file tree
Showing 14 changed files with 323 additions and 92 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/target
/work
.settings/
.DS_Store
.classpath
.project

89 changes: 42 additions & 47 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,54 +1,51 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.403</version>
<version>1.465</version>
</parent>
<!-- parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>hudson-plugin-parent</artifactId>
<version>2.1.0</version>
<relativePath>../pom.xml</relativePath>
</parent-->

<!-- parent> <groupId>org.jvnet.hudson.plugins</groupId> <artifactId>hudson-plugin-parent</artifactId>
<version>2.1.0</version> <relativePath>../pom.xml</relativePath> </parent -->

<artifactId>jenkins-multijob-plugin</artifactId>
<version>1.1-SNAPSHOT</version>
<version>1.2-SNAPSHOT</version>
<packaging>hpi</packaging>
<name>Jenkins Multijob plugin</name>
<description>Enabling full hierarchy of Jenkins jobs</description>
<url>http://wiki.jenkins-ci.org/display/JENKINS/Multijob+Plugin</url>

<distributionManagement>
<repository>
<id>maven.jenkins-ci.org</id>
<url>http://maven.jenkins-ci.org:8081/content/repositories/releases/</url>
</repository>
</distributionManagement>
<repository>
<id>maven.jenkins-ci.org</id>
<url>http://maven.jenkins-ci.org:8081/content/repositories/releases/</url>
</repository>
</distributionManagement>


<developers>
<developers>
<developer>
<id>alex-n</id>
<name>Alex Nickolaevsky</name>
<email>[email protected]</email>
</developer>
<developer>
<id>alex-n</id>
<name>Alex Nickolaevsky</name>
<email>[email protected]</email>
</developer>
<developer>
<id>ronil</id>
<name>Roni Licht</name>
<email>[email protected]</email>
</developer>
<id>ronil</id>
<name>Roni Licht</name>
<email>[email protected]</email>
</developer>
<developer>
<id>itaior</id>
<name>Itai Or</name>
<email>[email protected]</email>
</developer>
</developers>
<id>itaior</id>
<name>Itai Or</name>
<email>[email protected]</email>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com:jenkinsci/tikal-multijob-plugin.git</connection>
<developerConnection>scm:git:[email protected]:jenkinsci/tikal-multijob-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/tikal-multijob-plugin.git</url>
<developerConnection>scm:git:[email protected]:jenkinsci/tikal-multijob-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/tikal-multijob-plugin.git</url>
</scm>


Expand All @@ -62,19 +59,17 @@
</dependency>
</dependencies>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public MultiJobBuilder(String phaseName, List<PhaseJobsConfig> phaseJobs,
this.phaseJobs = Util.fixNull(phaseJobs);
this.continuationCondition = continuationCondition;
}




@Override
@SuppressWarnings("rawtypes")
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
Expand All @@ -78,6 +80,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
"Starting build job %s.\n",
HyperlinkNote.encodeTo('/' + project.getUrl(),
project.getFullName()));

PhaseJobsConfig projectConfig = projects.get(project);
List<Action> actions = new ArrayList<Action>();
prepareActions(build, project, projectConfig, listener, actions);
Expand All @@ -87,6 +90,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
if (future != null) {
futuresList.add(future);
}

}
boolean failed = false;
for (Future future : futuresList) {
Expand All @@ -95,9 +99,11 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
}
try {
AbstractBuild jobBuild = (AbstractBuild) future.get();

Result result = jobBuild.getResult();

ChangeLogSet<Entry> changeLogSet = jobBuild.getChangeSet();
//jobBuild.getArtifacts()
if (changeLogSet != null) {
((MultiJobBuild) build).addChangeLogSet(changeLogSet);
}
Expand Down Expand Up @@ -175,6 +181,8 @@ public boolean phaseNameExist(String phaseName){
}
return false;
}



@Extension
public static class DescriptorImpl extends BuildStepDescriptor<Builder> {
Expand Down Expand Up @@ -203,6 +211,9 @@ public boolean configure(StaplerRequest req, JSONObject formData) {
}

}




@SuppressWarnings("rawtypes")
public void buildDependencyGraph(AbstractProject owner,
Expand Down Expand Up @@ -285,6 +296,8 @@ public String getLabel() {
return label;
}
}



public ContinuationCondition getContinuationCondition() {
return continuationCondition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package com.tikal.jenkins.plugins.multijob;

import java.io.IOException;
import java.util.Map;

import hudson.Extension;
import hudson.model.DependencyGraph;
import hudson.model.ItemGroup;
import hudson.model.TopLevelItem;
import hudson.model.Hudson;
import hudson.model.Project;
import hudson.scm.SCM;
import hudson.triggers.Trigger;
import hudson.triggers.TriggerDescriptor;

import com.tikal.jenkins.plugins.multijob.views.MultiJobView;

Expand All @@ -19,17 +25,17 @@ private MultiJobProject(ItemGroup parent, String name) {
public MultiJobProject(Hudson parent, String name) {
super(parent, name);
}

@Override
protected Class<MultiJobBuild> getBuildClass() {
return MultiJobBuild.class;
}

@Override
public Hudson getParent() {
return Hudson.getInstance();
}

public DescriptorImpl getDescriptor() {
return DESCRIPTOR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,33 @@

import hudson.EnvVars;
import hudson.Extension;
import hudson.model.*;
import hudson.model.Action;
import hudson.model.AutoCompletionCandidates;
import hudson.model.Describable;
import hudson.model.JobProperty;
import hudson.model.JobPropertyDescriptor;
import hudson.model.ParameterValue;
import hudson.model.TaskListener;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BooleanParameterDefinition;
import hudson.model.ChoiceParameterDefinition;
import hudson.model.Descriptor;
import hudson.model.FileParameterValue;
import hudson.model.Hudson;
import hudson.model.ParameterDefinition;
import hudson.model.ParametersAction;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.StringParameterDefinition;
import hudson.model.StringParameterValue;
//import hudson.scm.SubversionSCM;
//import hudson.scm.SubversionSCM.ModuleLocation;
import hudson.tasks.Builder;
import hudson.util.FormValidation;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;
Expand All @@ -16,12 +37,23 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;

//import com.tikal.jenkins.plugins.multijob.scm.MultiJobScm;

public class PhaseJobsConfig implements Describable<PhaseJobsConfig> {

private String jobName;
private String jobProperties;
private boolean currParams;
private boolean exposedSCM;

public boolean isExposedSCM() {
return currParams;
}

public void setExposedSCM(boolean exposedSCM) {
this.exposedSCM = exposedSCM;
}

public boolean isCurrParams() {
return currParams;
}
Expand Down Expand Up @@ -91,11 +123,14 @@ public FormValidation doCheckJobName(@QueryParameter String value) {
}
return result;
}



private void savePhaseJobConfigParameters(String localJobName) {
AbstractProject project = ((AbstractProject) Hudson.getInstance().getItem(localJobName));
List<ParameterDefinition> parameterDefinitions = getParameterDefinition(project);
StringBuilder sb = new StringBuilder();
// ArrayList<ModuleLocation> scmLocation = null;
for (ParameterDefinition pdef : parameterDefinitions) {
String paramValue = null;
if (pdef instanceof StringParameterDefinition) {
Expand All @@ -107,6 +142,7 @@ private void savePhaseJobConfigParameters(String localJobName) {
}
sb.append(pdef.getName()).append("=").append(paramValue).append("\n");
}


AbstractProject item = getCurrentJob();
if (item instanceof MultiJobProject) {
Expand All @@ -120,13 +156,29 @@ private void savePhaseJobConfigParameters(String localJobName) {
for (PhaseJobsConfig phaseJob : phaseJobs) {
if (phaseJob.getJobName().equals(localJobName)) {
phaseJob.setJobProperties(sb.toString());
// if (phaseJob.isExposedSCM()){
// if (parentProject.getScm().getType().equals(MultiJobScm.class.getName())){
// ((MultiJobScm)parentProject.getScm()).addScm(project, project.getScm());
// }
// }
save();
}
}
}
}

}
// if (parentProject.getScm().getType().equals(MultiJobScm.class.getName()) && scmLocation !=null){
// scmLocation.addAll(Arrays.asList(((SubversionSCM)parentProject.getScm()).getLocations()));
// SubversionSCM scm =new SubversionSCM(scmLocation, ((SubversionSCM)parentProject.getScm()).getWorkspaceUpdater(),((SubversionSCM)parentProject.getScm()).getBrowser(),((SubversionSCM)parentProject.getScm()).getExcludedRegions(),((SubversionSCM)parentProject.getScm()).getExcludedUsers(), ((SubversionSCM)parentProject.getScm()).getExcludedRevprop(),((SubversionSCM)parentProject.getScm()).getExcludedCommitMessages(), ((SubversionSCM)parentProject.getScm()).getIncludedRegions());
// try {
// parentProject.setScm(scm);
// } catch (IOException e) {
// e.fillInStackTrace();
// }
// }
}

}

private AbstractProject getCurrentJob() {
Expand Down
Loading

0 comments on commit 9047271

Please sign in to comment.