Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
-Duse-jenkins-bom
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
<properties>
<revision>1.35</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.150.1</jenkins.version>
<jenkins.version>2.236-rc29908.d71e7c850809</jenkins.version>
<java.level>8</java.level>
<binary.src>src/main/go/org/jenkinsci/plugins/durabletask</binary.src>
<useBeta>true</useBeta>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the best approach here. It doesn't seem wise to use this flag. It's a big switch and can hide other potential issues.

I guess this can't be merged until after all supported versions have the new API anyway. We've got enough pieces involved here and demonstrations of behavior that the Beta restriction doesn't help. The purpose is to make these API changes available and then use them as soon as possible. Marking them as Beta, waiting for propagation, and then removing the restriction, and waiting for further propagation makes little sense.

</properties>

<repositories>
Expand Down Expand Up @@ -53,6 +54,12 @@
<version>1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>trilead-api</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ssh-slaves</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ public String getScript() {
}

LOGGER.log(Level.FINE, "launching {0}", launcherCmd);

launcher.prepareFilterRules(getRun(), this);

Launcher.ProcStarter ps = launcher.launch().cmds(launcherCmd).envs(escape(envVars)).pwd(ws).quiet(true);
if (LAUNCH_DIAGNOSTICS) {
ps.stdout(listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Run;
import hudson.model.TaskListener;
import java.io.IOException;
import java.nio.charset.Charset;
Expand All @@ -44,6 +45,25 @@ public abstract class DurableTask extends AbstractDescribableImpl<DurableTask> i

private static final Logger LOGGER = Logger.getLogger(DurableTask.class.getName());

/**
* Optional information about the run that has triggered this task
*/
protected transient Run<?, ?> run;

/**
* @since TODO
*/
public void setRun(Run<?, ?> run) {
this.run = run;
}

/**
* @since TODO
*/
public Run<?, ?> getRun() {
return run;
}

@Override public DurableTaskDescriptor getDescriptor() {
return (DurableTaskDescriptor) super.getDescriptor();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import javax.annotation.Nonnull;
import jenkins.MasterToSlaveFileCallable;
import jenkins.security.MasterToSlaveCallable;
import jenkins.tasks.filters.EnvVarsFilterableBuilder;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.input.ReaderInputStream;
import org.apache.commons.io.output.CountingOutputStream;
Expand All @@ -81,7 +82,7 @@
/**
* A task which forks some external command and then waits for log and status files to be updated/created.
*/
public abstract class FileMonitoringTask extends DurableTask {
public abstract class FileMonitoringTask extends DurableTask implements EnvVarsFilterableBuilder {

private static final Logger LOGGER = Logger.getLogger(FileMonitoringTask.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.List;
import hudson.model.TaskListener;
import java.io.IOException;

import org.kohsuke.stapler.DataBoundConstructor;
import java.io.OutputStream;
import java.nio.charset.Charset;
Expand Down Expand Up @@ -126,7 +127,9 @@ public String getScript() {
writeWithBom(c.getPowerShellWrapperFile(ws), scriptWrapper);
}
}


launcher.prepareFilterRules(getRun(), this);

Launcher.ProcStarter ps = launcher.launch().cmds(args).envs(escape(envVars)).pwd(ws).quiet(true);
ps.readStdout().readStderr();
Proc p = ps.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import hudson.Proc;
import hudson.model.TaskListener;
import java.io.IOException;

import org.kohsuke.stapler.DataBoundConstructor;

/**
Expand Down Expand Up @@ -76,6 +77,8 @@ public String getScript() {
c.getBatchFile1(ws).write(cmd, "UTF-8");
c.getBatchFile2(ws).write(script, "UTF-8");

launcher.prepareFilterRules(getRun(), this);

Launcher.ProcStarter ps = launcher.launch().cmds("cmd", "/c", "\"\"" + c.getBatchFile1(ws) + "\"\"").envs(escape(envVars)).pwd(ws).quiet(true);
/* Too noisy, and consumes a thread:
ps.stdout(listener);
Expand Down