Creating custom workflows for DTGov in JBDS(-IS)

Version 5

    Prerequisites

    You need to have installed DTGov from JBoss Overlord project or as a part of Red Hat JBoss Fuse Service Works 6 and JBoss Developer Studio along with the Integration Stack plugins:

     

    Create new governance workflow

    At the moment DTGov only supports one KieJar for all DTGov workflows, so first thing you need to do, after starting JBDS, is to import the default dtgov workflows into you workspace:

    • In JBDS select File -> Import -> Maven -> Existing Maven Projects and navigate to <FSW installation>jboss-eap-6.1/data where the dtgov workflows are located. The Maven integration in JBDS will take care of the rest. After Maven import you can experience bug in Eclipse BPMN2 Modeler (https://bugs.eclipse.org/bugs/show_bug.cgi?id=418108), depends on version you are using.

    screen1.png

    screen2.png

    • At this point you can author new governance workflows in src/main/resources/SRAMPPackage folder. To create new BPMN2 Process Diagram select File -> New -> Other -> BPMN2 -> Generic BPMN 2.0 Diagram -> Process Diagram Type.

    screen3.png

    screen4.png

    • Once the new process definition is opened in BPMN2 Modeler, make sure you have Custom tasks Modeler palette. If you don't, right click on dtgov-workflows in Project Explorer -> Properties -> BPMN2 -> Target Runtime -> select 'JBoss jBPM 5 Business Process Engine'

    screen5.png

    • Create model a brand new BPMN2 workflow diagram of your own. You can use overlord.demo.SimpleReleaseProcess.bpmn, which is part of the default dtgov-workflows, as an inspiration and sample for configuring DTGov Supporting Services tasks. Official DTGov demos can be found here: https://github.com/Governance/dtgov/tree/master/dtgov-demos
    • Few tips for DTGov workflow modeling:
      • at first, set appropriate process id (will be used by DTGov to pick up the definition from S-RAMP repository) and package name:

    screen6.png

      • second, create DTGov-specific Process variables in Data Items tab: DeploymentUrl , ArtifactUuid , Response , NotificationUrl , UpdateMetaDataUrl , DTGovUrl (these are used in DTGov Supporting Services):

    screen7.png

    DTGov User Tasks

    If your process definition contains user task activities you should create task forms for them. By convention the name of the task form needs to be <taskname>-taskform.xml and needs to be placed in the same directory as the process definition. See overlord.demo.CheckDeployment-taskform.xml as an example.

     

    DTGov Supporting Services

    In order to make it a little easier to author interesting Governance Workflows, DTGov provides a set of useful Governance Services. A list of these services follows:

    • Deployment Service - deploys a binary application artifact to a configured target
    • Meta-Data Update Service - allows simple modification of an artifact’s meta-data
    • Notification Service - provides a simple way to send email notifications

    These services can be invoked by using the work items defined above in the HttpClientWorkDefinitions.wid file. Configuration samples of these work items can be taken from the overlord.demo.SimpleReleaseProcess.bpmn file. You can find more information in DTGov Guide and DTGov wiki page: https://github.com/Governance/dtgov/wiki/GuideGovernanceWorkflows.

     

    E-mail templates for notifications can be modified at:

    jboss-eap-6.1/standalone/deployments/dtgov.war/WEB-INF/classes/governance-email-templates/

     

    Configure DTGov

    Configuration of DTGov (<FSW installation>jboss-eap-6.1/standalone/configuration/dtgov.properties) also needs to be modified:

    • add targets which you use in your new workflow, e.g.:
    governance.targets= fsw|http://www.jboss.org/overlord/deployment-status.owl#InProd|copy|/home/sbunciak/runtimes/fsw-6.0.0-Beta/jboss-eap-6.1/standalone/deployments
    • modify queries to trigger the appropriate workflow, e.g.:
    governance.queries=/s-ramp/ext/SwitchYardApplication|org.jboss.soa.process_sample|DeploymentUrl={governance.url}/rest/deploy/{target}/{uuid}::NotificationUrl={governance.url}/rest/notify/email/{group}/deployed/{target}/{uuid}::UpdateMetaDataUrl={governance.url}/rest/update/{name}/{value}/{uuid}::DTGovUrl={dtgov.ui.url}

    Note: Be sure to have the default ontology (deployment-status.owl) deployed to S-RAMP. This is done automatically by the FSW installer. Community version of DTGov needs to be seeded manually, this can be done by ant script: http://docs.jboss.org/overlord/dtgov/1.0.0.Final/html_single/#_download_installation_and_configuration

     

    Deploy workflow

    In order to deploy the modified workflows to S-RAMP you need to:

    • start FSW server
    • from <FSW installation>jboss-eap-6.1/data (where the dtgov-workflows project is located) execute:
    mvn clean deploy
    • and finally restart FSW to pick up the changes you made.

     

    Test your workflow

    To test your workflow you can useS-RAMP Container Adapter for Arquillian. It's a custom remote container adapter implementation for Arquillian, providing archive deployment capabilities as well as other useful features, like DTGov Task Management. Give it a try!