public abstract class BaseCommandContext extends org.jenkinsci.plugins.workflow.steps.Step implements ICommandServiceData, IBaseCommandData
| Constructor and Description |
|---|
BaseCommandContext() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure(JobContext jobCtx,
CommandService aCommandService) |
protected void |
configure(hudson.model.Run<?,?> aRun,
hudson.FilePath aWorkspace,
hudson.Launcher aLauncher,
hudson.model.TaskListener aTaskListener,
CommandService aCommandService) |
void |
executeCommands() |
CommandService |
getCommandService() |
CommandState |
getCommandState()
Get the command state for the associated completed command.
|
abstract IBaseCommandData |
getDataForCommand(ICommand command) |
hudson.EnvVars |
getEnvVars()
When running from pipeline, the result returned from
Run.getEnvironment(TaskListener) won't include
the system environments set by the env.VAR=value or withEnv(['VAR=value']). |
JobContext |
getJobContext() |
CommandState |
getLastCommandState()
Get the command state for the last command being executed.
|
void |
logError(Exception ex) |
void |
logError(String message) |
void |
logError(String prefix,
Exception ex) |
void |
logStatus(String status) |
void |
setCommandState(CommandState commandState)
Set the command state for the associated running command.
|
void |
setLastCommandState(CommandState lastCommandState)
Set the command state for the last command being executed in the command service.
|
org.jenkinsci.plugins.workflow.steps.StepExecution |
start(org.jenkinsci.plugins.workflow.steps.StepContext context)
Pipeline function call entrance.
|
abstract org.jenkinsci.plugins.workflow.steps.StepExecution |
startImpl(org.jenkinsci.plugins.workflow.steps.StepContext context) |
protected void configure(hudson.model.Run<?,?> aRun,
hudson.FilePath aWorkspace,
hudson.Launcher aLauncher,
hudson.model.TaskListener aTaskListener,
CommandService aCommandService)
protected void configure(JobContext jobCtx, CommandService aCommandService)
public final org.jenkinsci.plugins.workflow.steps.StepExecution start(org.jenkinsci.plugins.workflow.steps.StepContext context)
throws Exception
start in class org.jenkinsci.plugins.workflow.steps.Stepcontext - the pipeline step contextExceptionpublic abstract org.jenkinsci.plugins.workflow.steps.StepExecution startImpl(org.jenkinsci.plugins.workflow.steps.StepContext context)
throws Exception
Exceptionpublic hudson.EnvVars getEnvVars()
Run.getEnvironment(TaskListener) won't include
the system environments set by the env.VAR=value or withEnv(['VAR=value']). We need to call
StepContext.get(EnvVar.class) for the full environment variables set.
If the field is not null, we are running from pipeline and we use this as the source of environment variables;
otherwise we fetch the environment variables from Run as normal.
getEnvVars in interface IBaseCommandDatapublic void executeCommands()
public abstract IBaseCommandData getDataForCommand(ICommand command)
getDataForCommand in interface ICommandServiceDatapublic void setCommandState(CommandState commandState)
IBaseCommandDatasetCommandState in interface IBaseCommandDatacommandState - the result command state.public CommandState getCommandState()
IBaseCommandDatagetCommandState in interface IBaseCommandDatapublic CommandState getLastCommandState()
ICommandServiceDatagetLastCommandState in interface ICommandServiceDataIBaseCommandData.getCommandState()public void setLastCommandState(CommandState lastCommandState)
ICommandServiceDatasetLastCommandState in interface ICommandServiceDatalastCommandState - the last command state.IBaseCommandData.setCommandState(CommandState)public CommandService getCommandService()
getCommandService in interface ICommandServiceDatapublic final JobContext getJobContext()
getJobContext in interface IBaseCommandDatapublic void logStatus(String status)
logStatus in interface IBaseCommandDatapublic void logError(Exception ex)
logError in interface IBaseCommandDatapublic void logError(String prefix, Exception ex)
logError in interface IBaseCommandDatapublic void logError(String message)
logError in interface IBaseCommandDataCopyright © 2016–2017. All rights reserved.