public abstract class CommandInterpreter extends Builder
ExtensionPoint.LegacyInstancesAreScopedToHudson
BuildStep.PublisherList
Modifier and Type | Field and Description |
---|---|
protected String |
command
Command to execute.
|
BUILDERS, PUBLISHERS
Constructor and Description |
---|
CommandInterpreter(String command) |
Modifier and Type | Method and Description |
---|---|
abstract String[] |
buildCommandLine(FilePath script) |
FilePath |
createScriptFile(FilePath dir)
Creates a script file in a temporary name in the specified directory.
|
String |
getCommand() |
protected abstract String |
getContents() |
protected abstract String |
getFileExtension() |
protected int |
join(Proc p)
Reports the exit code from the process.
|
boolean |
perform(AbstractBuild<?,?> build,
Launcher launcher,
BuildListener listener)
Runs the step over the given build and reports the progress to the listener.
|
boolean |
perform(AbstractBuild<?,?> build,
Launcher launcher,
TaskListener listener) |
all, getDescriptor, getRequiredMonitorService, prebuild
getProjectAction, getProjectAction, getProjectActions, perform, prebuild
protected final String command
CommandInterpreter
implementation.public CommandInterpreter(String command)
public final String getCommand()
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException
BuildStepCompatibilityLayer
A plugin can contribute the action object to Actionable.getActions()
so that a 'report' becomes a part of the persisted data of Build
.
This is how JUnit plugin attaches the test report to a build page, for example.
When this build step needs to make (direct or indirect) permission checks to ACL
(for example, to locate other projects by name, build them, or access their artifacts)
then it must be run under a specific Authentication
.
In such a case, the implementation should check whether Jenkins#getAuthentication
is ACL.SYSTEM
,
and if so, replace it for the duration of this step with Jenkins#ANONYMOUS
.
(Either using ACL.impersonate(org.acegisecurity.Authentication)
, or by making explicit calls to ACL.hasPermission(Authentication, Permission)
.)
This would typically happen when no QueueItemAuthenticator
was available, configured, and active.
perform
in interface BuildStep
perform
in class BuildStepCompatibilityLayer
SimpleBuildStep.perform(Run, FilePath, Launcher, TaskListener)
if possible, always returning true or throwing an error.InterruptedException
- If the build is interrupted by the user (in an attempt to abort the build.)
Normally the BuildStep
implementations may simply forward the exception
it got from its lower-level functions.public boolean perform(AbstractBuild<?,?> build, Launcher launcher, TaskListener listener) throws InterruptedException
InterruptedException
protected int join(Proc p) throws IOException, InterruptedException
Result#UNSTABLE
). Any non-zero exit code will cause
the build step to fail.IOException
InterruptedException
public FilePath createScriptFile(@Nonnull FilePath dir) throws IOException, InterruptedException
IOException
InterruptedException
protected abstract String getContents()
protected abstract String getFileExtension()
Copyright © 2016. All rights reserved.