Class ScriptProcessor
- java.lang.Object
-
- org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
-
- org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
-
- org.craftercms.deployer.impl.processors.ScriptProcessor
-
- All Implemented Interfaces:
DeploymentProcessor
,InitializableByConfigBean
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.context.ApplicationContextAware
public class ScriptProcessor extends AbstractMainDeploymentProcessor implements org.springframework.context.ApplicationContextAware
Implementation ofDeploymentProcessor
that delegates execution to a Groovy script Can be configured with the following YAML properties:- scriptPath: The relative path of the script to execute
- Since:
- 3.1.12
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description protected org.springframework.context.ApplicationContext
applicationContext
static String
CONFIG_KEY_SCRIPT_PATH
protected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor
sandboxInterceptor
static String
SCRIPT_VAR_APP_CTX
static String
SCRIPT_VAR_DEPLOYMENT
static String
SCRIPT_VAR_EXECUTION
static String
SCRIPT_VAR_FILTERED_CHANGE_SET
static String
SCRIPT_VAR_LOGGER
static String
SCRIPT_VAR_ORIGINAL_CHANGE_SET
protected groovy.util.GroovyScriptEngine
scriptEngine
protected String
scriptPath
The relative path of the script to execute-
Fields inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
FAIL_DEPLOYMENT_CONFIG_KEY, failDeploymentOnFailure
-
Fields inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
alwaysRun, env, excludeFiles, includeFiles, JUMPING_TO_PARAM_NAME, jumpTo, label, name, siteName, targetId
-
-
Constructor Summary
Constructors Constructor Description ScriptProcessor(groovy.util.GroovyScriptEngine scriptEngine, org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor sandboxInterceptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doDestroy()
Allows extending classes perform any custom cleanupprotected void
doInit(org.apache.commons.configuration2.Configuration config)
Allows extending classes perform any custom initializationprotected ChangeSet
doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet)
void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
Methods inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
doExecute, failDeploymentOnProcessorFailure, init, shouldExecute
-
Methods inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
destroy, execute, getFilteredChangeSet, isJumpToActive, isPostDeployment, setBeanName, setEnv, setSiteName, setTargetId, shouldIncludeFile, startJumpTo, supportsMode
-
-
-
-
Field Detail
-
CONFIG_KEY_SCRIPT_PATH
public static final String CONFIG_KEY_SCRIPT_PATH
- See Also:
- Constant Field Values
-
SCRIPT_VAR_LOGGER
public static final String SCRIPT_VAR_LOGGER
- See Also:
- Constant Field Values
-
SCRIPT_VAR_APP_CTX
public static final String SCRIPT_VAR_APP_CTX
- See Also:
- Constant Field Values
-
SCRIPT_VAR_DEPLOYMENT
public static final String SCRIPT_VAR_DEPLOYMENT
- See Also:
- Constant Field Values
-
SCRIPT_VAR_EXECUTION
public static final String SCRIPT_VAR_EXECUTION
- See Also:
- Constant Field Values
-
SCRIPT_VAR_FILTERED_CHANGE_SET
public static final String SCRIPT_VAR_FILTERED_CHANGE_SET
- See Also:
- Constant Field Values
-
SCRIPT_VAR_ORIGINAL_CHANGE_SET
public static final String SCRIPT_VAR_ORIGINAL_CHANGE_SET
- See Also:
- Constant Field Values
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext
-
scriptEngine
protected final groovy.util.GroovyScriptEngine scriptEngine
-
sandboxInterceptor
protected final org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor sandboxInterceptor
-
scriptPath
protected String scriptPath
The relative path of the script to execute
-
-
Constructor Detail
-
ScriptProcessor
@ConstructorProperties({"scriptEngine","sandboxInterceptor"}) public ScriptProcessor(groovy.util.GroovyScriptEngine scriptEngine, org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor sandboxInterceptor)
-
-
Method Detail
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
doInit
protected void doInit(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException
Description copied from class:AbstractDeploymentProcessor
Allows extending classes perform any custom initialization- Specified by:
doInit
in classAbstractDeploymentProcessor
- Parameters:
config
- the bean's configuration- Throws:
org.craftercms.commons.config.ConfigurationException
- if there's configuration related exception
-
doDestroy
protected void doDestroy()
Description copied from class:AbstractDeploymentProcessor
Allows extending classes perform any custom cleanup- Specified by:
doDestroy
in classAbstractDeploymentProcessor
-
doMainProcess
protected ChangeSet doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) throws DeployerException
Description copied from class:AbstractMainDeploymentProcessor
Performs the actual work of processing the files in theChangeSet
, it is also possible to return a newChangeSet
to be used for the following processors in the pipeline- Specified by:
doMainProcess
in classAbstractMainDeploymentProcessor
- Parameters:
deployment
- the current deploymentexecution
- the current executionfilteredChangeSet
- the filtered change set (as returned byAbstractDeploymentProcessor.getFilteredChangeSet(ChangeSet)
)originalChangeSet
- the original change set (as returned by the previous processors in the pipeline)- Returns:
- a new
ChangeSet
or null - Throws:
DeployerException
- if there is any error processing theChangeSet
-
-