View this page in the latest version of Appian. Configure a Post-Deployment Process Share Share via LinkedIn Reddit Email Copy Link Print On This Page Overview This page is about post-deployment processes in Appian and how to configure them for two common use cases. A post-deployment process can be specified to automatically run after one of the following supported types of deployments has finished on an environment. From this process, you'll be able to access key information about the relevant deployment. Type of Deployment Runs Post-Deployment Process Compare and Deploy (Direct) Yes Programmatic via native APIs (External) Yes Export and import (Manual) No Note: The Automated Deployment Manager plug-in, available on the AppMarket, does not run the post-deployment process. Post-deployment processes provide flexibility, which allows you to automate tasks, leverage third-party tools, and customize your workflow. Automating your post-deployment steps helps you reduce manual tasks and errors. How it works Within each application, Appian allows you to add a process model in the Deploy view that will run after an incoming deployment is completed. You can configure your workflow to trigger actions based on deployment properties. Appian will pass the deployment UUID to the process model which can then be used with a!deployment() to retrieve deployment properties. Once you add a process model as a post-deployment process for an application, that specific application will become a dependent of the process model. When you import the specific application to a new environment, the process setting is imported as well. Below are two examples of common use cases for adding post-deployment processes: Run expression rule test cases after a successful deployment Trigger a Jenkins job after a successful deployment These use cases will demonstrate how to access your deployment information from the process model and build your workflow. Run expression rule test cases Appian recommends running expression rule test cases before and after you deploy changes to your application. A post-deployment process will automate this task every time so that you don’t need to manually run them. Create a process model To run test cases after an incoming deployment is finished, we will create a simple process model that kicks off test cases for all expression rules in the corresponding application. The process will use a!deployment() to retrieve deployment information and the Start Rule Tests (Applications) smart service to run test cases for expression rules. Create a new process model. Add 3 process variables: pv!deploymentUUID, pv!status, pv!applications. These variables will store deployment and application information. In the process model toolbar, click the Properties button and select the Variables tab. Click Add Variable and in the Name field, enter deploymentUUID and set it as type Deployment. This variable will represent the UUID of a deployment. In the Parameter field, select the Allow the value for the variable to be provided when starting a process checkbox. Click OK. Add another variable named status with the type as Text. This variable will represent the status of a deployment. We will use this variable in our script task later on. Add another variable named applications with the type as Application and click OK. We will use this variable in the Start Rule Tests smart service later on. Drag and drop a Script Task node between the start node and end node, and name it Check Deployment Status. In this process, we need to check that the deployment has been completed before running the expression rule test cases. Double-click the script task node and select the Data tab. Select the Output tab and click New Custom Output. Name the custom output status and in the expression editor, enter a!deployment(pv!deploymentUUID, “status”). We are using a!deployment() to retrieve the deployment status. pv!deploymentUUID represents the deployment UUID, which will be populated after the deployment is finished. In the Target field, select pv!status. This process variable will store the status of the deployment so we can use it to determine whether the process should continue or end. Click Save and Close. Drag and drop Start Rule Tests (Application) smart service node after the script task. Double-click the Start Rule Tests (Application) smart service and select the Data tab. In the Inputs tab, click the Applications input. In the Value field, enter =a!deployment(pv!deploymentUUID, “applications”) in the expression editor. This expression retrieves the applications associated with the deployment. Save the value in pv!applications and click OK. Using a process variable instead of using the specific application name allows this process to be dynamic. You can reuse the process for any application and deployment. Drag and drop an XOR node between the script task and smart service and name it Deployment Completed?. Add a connector from the XOR node to the End node. This XOR node will route the process to the smart service or the end node depending on what the deployment status is. Double-click the XOR node and select the Decision tab. Click NEW CONDITION and in the condition field enter pv!status= “Completed”. “Completed” is the deployment status and indicates that all objects in the package have been successfully imported. Partial deployments are represented by the status Completed with Errors. In the Result field, select the Start Rule Tests (Application) smart service. In the Result field of the Else if none are true condition, select End Node. Click OK. In the File menu, select Save & Publish. Set the post-deployment process After creating our process model, we are ready to add it as a post deployment process: In Applications view, select the appropriate application. In the Deploy view > INCOMING tab, click the Modify Selection icon. In the Post-Deployment Process Model field, select the appropriate process model. In the Process Parameter field, select the process variable to pass the deployment identifier to. For this example we will select pv!deploymentUUID. Click SAVE. Once your process model has been added to the Deploy view, you can kick off the post deployment process by deploying a package to the target environment. After the process is complete, you can view your test case results in the Manage Test Cases dialog. You can also monitor your process in the Monitor View > Process Activity. Trigger a Jenkins job The post-deployment process also provides a connection point to the rest of your infrastructure and can be used to integrate with your existing third-party tools. For instance, you can use Jenkins to trigger a job that will automate activities, such as running FitNesse or other functional test scripts after a deployment. In our example below, we will create a simple process model, along with a connected system and integration object to connect to Jenkins. The process will use a!deployment() to retrieve deployment information and the Call Integration smart service to utilize the Jenkins integration. Keep in mind this example can also be easily tailored to work with any other third-party tool by modifying the configurations of the connected system and integration objects. Configure Jenkins In this section, we’ll go through the steps to create a new Jenkins job, enable it to be triggered remotely, and set up a user account to do so with an API key. If you already have this configured, you can skip to Create a connected system and integration for Jenkins. If you don’t already have Jenkins set up, install and configure Jenkins before following the instructions below. Create a new Jenkins job Go to your Jenkins Home Page. From the left-hand panel, click New Item. Enter a job name in the Item Name field. For example: “Run Application Tests”. Select Freestyle project. Click OK, then click Save. Under Build Triggers, check the box next to Trigger Builds Remotely. Optional: you can provide a job authentication token, which is separate from the user account and credentials to build the job. We recommend generating a key by using a random key generator tool. Under Pipeline, you can enter your own script or use a sample one that Jenkins provides. Below, we modified their sample “Hello World” script in order to output “Testing done!” instead. Click Save. Set up a Jenkins user If you do not have a Jenkins user account configured which can build jobs remotely, follow the instructions below. We will create and use an account that isn’t linked to an actual human user. As an administrator, create a user account which will be used to remotely trigger the Jenkins job. Click on Manage Jenkins > Manage Users > Create User. Enter the user information. Click Create User. Click Manage Jenkins > Configure Global Security > Authorization. Assuming you are using matrix-based security, add the user you just created and give them the following permissions: Overall: Read, Job: Build, Read, and Workspace. Click Save. Log out of the administrator account and log back in as the user you just created, in order to create an API key for this user. Click on the user dropdown in the top right and click Configure. Under API Token, click Add new Token. This will prompt you to name your token. Click Generate to create the token, and make sure to copy it to use later on. You now have a Jenkins job that’s ready to be triggered remotely and a user account that can do so! Create a connected system and integration for Jenkins In this section, we’ll go through the steps to create an HTTP connected system and integration object to trigger the Jenkins job with the user account and API key you configured above. Then we’ll create a post-deployment process model that uses this integration. In Appian Designer, select your application. Create and configure a new connected system: Click on the New menu and select Connected System. Select HTTP and add a name, description, and logo for your new connected system. Enter the Base URL of your Jenkins server. Under Authentication, select Basic. In the Username field, enter the Jenkins user that you configured above. In the Password field, enter the API token that you configured for that user. Click Use in New Integration. This will save your connected system, and prompt you to set the appropriate security rolemap for it. Once you have done so, click Save. Appian will then automatically prompt you to create an integration object, which is already configured to use the connected system that you just created. Add a name and description for the integration, and a folder to save it in. Click Create. Configure the integration to build the Jenkins job that you created above: In the Relative Path field, enter “job/[the name of your job]/build”. In the Method dropdown, select POST. This automatically updates the Usage radio button to Modifies data. Click Test Request to test your integration. If the configurations are all correct, you will see a successful response in the right pane. On your Jenkins dashboard, you will also see that a new build for this job has been triggered. Clicking into that build and clicking Console Output will display the results of the pipeline script that you entered. In the integration object, click Save Changes. Appian is now able to trigger your Jenkins job remotely. Create a process model Now that we have created a connected system and integration, we will create a process model that will trigger a Jenkins job after a deployment has completed. Create a new process model. Add 2 process variables: pv!deploymentUUID and pv!status. Appian will automatically populate pv!deploymentUUID with the deployment identifier, and you can use this to query for its status. In the process model toolbar, click the Properties button and select the Variables tab. Click Add Variable and in the Name field, enter deploymentUUID and set it as type Deployment. This variable will represent the UUID of a deployment. In the Parameter field, select the Allow the value for the variable to be provided when starting a process checkbox. Click OK. Add another variable named status with the type as Text. This variable will represent the status of a deployment. We will use this variable in our script task later on. Drag and drop a Script Task node between the start node and end node, and name it Check Deployment Status. In this process, we need to check that the deployment has been completed before triggering the Jenkins job. Double-click the Script Task node and select the Data tab. Select the Output tab and click New Custom Output. Name the custom output status and in the expression editor, enter a!deployment(pv!deploymentUUID, “status”). We are using a!deployment() to retrieve the deployment status. pv!deploymentUUID represents the deployment UUID, which will be populated after the deployment is finished. In the Target field, select pv!status. This process variable will store the status of the deployment so we can use it to determine whether the process should continue or end. Click Save and Close. Drag and drop an XOR node after the script task, and name it Deployment Completed? Add a connector from the XOR node to the End Node. This XOR node will route the process to the next node or the end node depending on if the deployment has been completed successfully. Drag and drop Call Integration smart service between the XOR node and the end node. Name it Build Jenkins Job. Double-click the Call Integration smart service node and select the Setup tab. In the integration picker, select the integration you created above. If you want to create a new integration or edit the existing one, you can do that from here. If you want to map process variables to the integration’s rule inputs, you can do that in the Data tab. Click OK. Double-click the XOR node and select the Decision tab. Click NEW CONDITION and in the condition field enter pv!status= “Completed”. “Completed” is the deployment status that indicates a deployment was successful; other statuses may be used depending on the workflow you want to achieve. In the Result field, select the Call Integration smart service. In the Result field of the Else if none are true condition, select End Node. Click OK. In the File menu, select Save & Publish. Set the post-deployment process Now that we have a process model that will call the Jenkins integration and build a job, we are ready to add it as the post-deployment process for our application. In Applications view, select the appropriate application. In the Deploy view > INCOMING tab, click the Modify Selection icon. In the Post-Deployment Process Model field, select the process model you created above. In the Process Parameter field, select the appropriate process variable. For this example we will select pv!deploymentUUID. Click SAVE. Once your process model has been configured from the Deploy view, you can kick off the post-deployment process by using compare and deploy to push changes to the target environment. After the process is complete, you can view the corresponding process instance in the Monitor view > PROCESS ACTIVITY in Appian Designer to check the status of the job itself in Jenkins. Feedback Was this page helpful? SHARE FEEDBACK Loading...