Skip to content

Commit

Permalink
Allow retry of jobs in a phase + multiple fixes
Browse files Browse the repository at this point in the history
- Updated dependencies
- Stopping Multi Job will also stops all downstream job [JENKINS-24139]
[JENKINS-22292] [JENKINS-21879] [JENKINS-20273] [JENKINS-23161]
- Add the possibility to make a step conditional. You can define simple
groovy expression for each job. [JENKINS-23968]
- Fix NPE when a downstream job is unstable [JENKINS-20846]
[JENKINS-20557]
- Add retry on a failed job when a user defined condition is met. You
can configure the number of retries per job.
- Some fixes to match the new look of Jenkins.
- Rename Delete to "Delete job" because there is confusion between the
deletion of parameters and the delete of a job.
- Allow reordering jobs in a phase
  • Loading branch information
harcher81 committed Sep 22, 2014
1 parent 6cef74b commit 4260fc5
Show file tree
Hide file tree
Showing 38 changed files with 2,658 additions and 2,226 deletions.
15 changes: 11 additions & 4 deletions pom.xml
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.480</version>
<version>1.565.1</version>
</parent>
<!-- parent> <groupId>org.jvnet.hudson.plugins</groupId> <artifactId>hudson-plugin-parent</artifactId>
<version>2.1.0</version> <relativePath>../pom.xml</relativePath> </parent -->
Expand Down Expand Up @@ -59,20 +59,27 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>parameterized-trigger</artifactId>
<version>2.21</version>
<version>2.25</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>envinject</artifactId>
<version>1.83</version>
<version>1.90</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>conditional-buildstep</artifactId>
<version>1.3.1</version>
<version>1.3.3</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
<version>1.10</version>
<optional>true</optional>
</dependency>
</dependencies>

<build>
Expand Down
Expand Up @@ -23,55 +23,55 @@

public class FileBuildParameters extends AbstractBuildParameters {

private final String propertiesFile;

@DataBoundConstructor
public FileBuildParameters(String propertiesFile) {
this.propertiesFile = propertiesFile;
}

public Action getAction(AbstractBuild<?,?> build, TaskListener listener, AbstractProject project)
throws IOException, InterruptedException {

EnvVars env = build.getEnvironment(listener);

String resolvedPropertiesFile = env.expand(propertiesFile);
FilePath f = build.getWorkspace().child(resolvedPropertiesFile);
if (!f.exists()) {
listener
.getLogger()
.println(
"[parameterizedtrigger] Could not trigger downstream project, as properties file "
+ resolvedPropertiesFile
+ " did not exist.");
return null;
}

String s = f.readToString();
s = env.expand(s);
Properties p = new Properties();
p.load(new StringInputStream(s));

List<ParameterValue> values = new ArrayList<ParameterValue>();
for (Map.Entry<Object, Object> entry : p.entrySet()) {
values.add(new StringParameterValue(entry.getKey().toString(),
entry.getValue().toString()));
}

return new ParametersAction(values);

}

public String getPropertiesFile() {
return propertiesFile;
}

@Extension
public static class DescriptorImpl extends Descriptor<AbstractBuildParameters> {
@Override
public String getDisplayName() {
return "Parameters from properties file";
}
}
private final String propertiesFile;

@DataBoundConstructor
public FileBuildParameters(String propertiesFile) {
this.propertiesFile = propertiesFile;
}

public Action getAction(AbstractBuild<?,?> build, TaskListener listener, AbstractProject project)
throws IOException, InterruptedException {

EnvVars env = build.getEnvironment(listener);

String resolvedPropertiesFile = env.expand(propertiesFile);
FilePath f = build.getWorkspace().child(resolvedPropertiesFile);
if (!f.exists()) {
listener
.getLogger()
.println(
"[parameterizedtrigger] Could not trigger downstream project, as properties file "
+ resolvedPropertiesFile
+ " did not exist.");
return null;
}

String s = f.readToString();
s = env.expand(s);
Properties p = new Properties();
p.load(new StringInputStream(s));

List<ParameterValue> values = new ArrayList<ParameterValue>();
for (Map.Entry<Object, Object> entry : p.entrySet()) {
values.add(new StringParameterValue(entry.getKey().toString(),
entry.getValue().toString()));
}

return new ParametersAction(values);

}

public String getPropertiesFile() {
return propertiesFile;
}

@Extension
public static class DescriptorImpl extends Descriptor<AbstractBuildParameters> {
@Override
public String getDisplayName() {
return "Parameters from properties file";
}
}

}
13 changes: 13 additions & 0 deletions src/main/java/com/tikal/jenkins/plugins/multijob/LineQueue.java
@@ -0,0 +1,13 @@
package com.tikal.jenkins.plugins.multijob;

public final class LineQueue {
private boolean errorFound;

public LineQueue(boolean errorFound) {
this.errorFound = errorFound;
}

public boolean hasError() {
return errorFound;
}
}

0 comments on commit 4260fc5

Please sign in to comment.