-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Indroduce SimpleBuildWrapper that runs and stops node.
No tasks executions internally. Signed-off-by: Kanstantsin Shautsou <[email protected]>
- Loading branch information
Showing
37 changed files
with
1,846 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/DockerComputerSingle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.github.kostyasha.yad; | ||
|
||
import hudson.model.Run; | ||
import hudson.model.TaskListener; | ||
import hudson.remoting.Channel; | ||
import hudson.slaves.AbstractCloudComputer; | ||
import org.jenkinsci.plugins.cloudstats.ProvisioningActivity; | ||
import org.jenkinsci.plugins.cloudstats.TrackedItem; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.nio.charset.Charset; | ||
|
||
import static java.util.Objects.nonNull; | ||
|
||
/** | ||
* @author Kanstantsin Shautsou | ||
*/ | ||
public class DockerComputerSingle extends AbstractCloudComputer<DockerSlaveSingle> implements TrackedItem { | ||
private final ProvisioningActivity.Id activityId; | ||
private transient TaskListener listener; | ||
private transient Run run; | ||
|
||
public DockerComputerSingle(@Nonnull DockerSlaveSingle slave, @Nonnull ProvisioningActivity.Id activityId) { | ||
super(slave); | ||
this.activityId = activityId; | ||
} | ||
|
||
@Override | ||
public TaskListener getListener() { | ||
return nonNull(listener) ? listener : super.getListener(); | ||
} | ||
|
||
public void setListener(TaskListener listener) { | ||
this.listener = listener; | ||
} | ||
|
||
public Run getRun() { | ||
return run; | ||
} | ||
|
||
public void setRun(Run run) { | ||
this.run = run; | ||
} | ||
|
||
@Override | ||
public void setChannel(Channel channel, OutputStream launchLog, Channel.Listener listener) | ||
throws IOException, InterruptedException { | ||
super.setChannel(channel, launchLog, listener); | ||
} | ||
|
||
public boolean isReallyOffline() { | ||
return super.isOffline(); | ||
} | ||
|
||
@Override | ||
public boolean isOffline() { | ||
// create executors to pick tasks | ||
return false; | ||
} | ||
|
||
@Override | ||
public Charset getDefaultCharset() { | ||
// either fails | ||
// java.lang.NullPointerException | ||
// at hudson.model.Run.execute(Run.java:1702) | ||
// at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) | ||
// at hudson.model.ResourceController.execute(ResourceController.java:98) | ||
// at hudson.model.Executor.run(Executor.java:404) | ||
return Charset.forName("UTF-8"); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public ProvisioningActivity.Id getId() { | ||
return activityId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.