To Write deployer extension for Tridion Sites with following steps
- Create a custom step class which implements "ExecutableStep" (com.sdl.delivery.deployer.api.processing.pipeline.ExecutableStep) interface
- interface is available on udp-deployer-api-x.x.x-xxxx.jar which can be found on maven repo or in the deployer service installation directory.
- Override methods in CustomStep class
- configure
@Override
public void configure(Configuration configuration) throws ConfigurationException {
//this is section where we initialize step
} - process
@Override
public ExecutableStepResult process(ProcessingContext processingContext, StepDataProvider stepDataProvider) throws ProcessingException {
LOG.debug("Starting ExampleExtension");
var location = getPackageUnzipLocation(processingContext, stepDataProvider);
LOG.debug("ExampleExtension getPackageUnzipLocation location {}", location);
TransportPackage transportPackage = new TransportPackage(location, stepDataProvider.getBinaryStorage());
LOG.debug("ExampleExtension transportPackage {}", transportPackage);
final String action = transportPackage.getAction();
LOG.debug("PageStateNotifier action {}", action);
final String transactionId = transportPackage.getTransactionId().toString();
LOG.debug("Process Action {} for Transaction {}", action, transactionId);
switch (action) {
case DEPLOY_ACTION:
LOG.info("Publish action triggerred");
break;
case UNDEPLOY_ACTION:
LOG.info("UnPublish action triggerred");
break;
default:
LOG.error("Invalid action {}", action);
throw new ProcessingException("Invalid transport package action " + action);
}
return null;
}
- configure
- Write a spring configuration
- configuration class should be on package "com.sdl.delivery.spring.configuration"
- Let's name it ExampleConfiguration
package com.sdl.delivery.spring.configuration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;@Configuration
@ComponentScan(basePackages = {"org.rws.example"})
public class ExampleConfiguration {
} - above class allows your deployer extension to be developed on specific package for example in above ExampleConfiguration it scans package "org.rws.example" then you can implement your CustomStep on step 1 inside package "org.rws.example".
- Please also include following minimum java libraries for development of Tridion Sites deployer extension
- udp-common-config-api-x.x.x-xxxx.jar
- udp-common-config-x.x.x-xxxx.jar
- udp-common-util-x.x.x-xxxx.jar
- udp-core-x.x.x-xxxx.jar
- udp-data-legacy-transport-x.x.x-xxxx.jar
- udp-deployer-api-x.x.x-xxxx.jar
- udp-deployer-web-extension-x.x.x-xxxx.jar
- x.x.x-xxxx denotes version of api available on installation directory of deployer service.
- After creating CustomStep, based on your project setup (i.e. maven or gradle) configure build steps which could generate a add-on package file in zip.
- zip file contains generated jar file and dependent jars those are not available on deployer service libraries, and manifest file requires for Addon service to specify type of Add-on.
- you can refer maven project which is having build step to generate Addon-package https://github.com/neeteshnarvaria/deployer-extension/blob/master/pom.xml
- example maven project generates example-deployer-extension.zip
- after all the steps we need to configure/update deployer-conf.xml
- open in notepad and add custom pipeline after following pipelines, specifically after highlighted one in screenshot below
- custom pipeline
<Pipeline Id="Tridion-Example-Step" Action="Deploy,Undeploy" Verb="Process">
<Steps>
<Step Id="ExampleExtension" />
</Steps>
</Pipeline>
- open in notepad and add custom pipeline after following pipelines, specifically after highlighted one in screenshot below
- after configuring/update deployer-conf.xml save and close the file.
- add the generated package on add-on using upload
- select add-on
- after upload on add-on it will show as "Pending State"
- We need to restart deployer service to activate the deployer extension add-on.
- Deployer status should show "Success".
- it is ready to use and we can check functionality by adding some logs.
Refer following git repo which contains sample deployer extension having custom step: https://github.com/neeteshnarvaria/deployer-extension