How to use the Deploy Package

  • 24 February 2022
  • 0 replies
  • 13 views

Userlevel 3
Badge +8
 

How to use the Deploy Package

KB000188

PRODUCT
K2 blackpearl
TAGS
K2 Designer for Visual Studio
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

 

Introduction

Best practices in business application development requires that a solution be developed in a development environment, tested in a test environment, and once approved, deployed in a production environment. Because there are different environments involved, and because many organizations progressively lock down permissions through the process (i.e., developers have full control in the development environment, less control in the test environment, and may not have access at all to production), the deployment tools have been integrated into the build process to enable deployment to different environments.

 

 

About the Deployment Package

To facilitate transferring the process between environments the K2 Deployment Package is used. A deployment package is created when the project is successfully built with no errors. The package is copied and relocated to the target environment (e.g. Test or Production). When available in the environment, the MSBUILD utility from Microsoft is used to deploy the process in the new environment.
 
In summary, the Deployment Package is used successfully in the two steps described below:
 

Step 1: Build the process and create the deployment package

 
The K2 blackpearl business application is developed in the development environment. Quality Assurance and Testing is performed in this environment as well. Once complete, the process is built and deployed to the development environment. This ‘final’ version of the process is then available as the Deployment Package.
 
 
[Figure 1. Development process]
 
 

Step 2: Using the deploy package in another environment

 
Note: The deploy package is copied onto the K2 Server machine in the new environment
 
Once the deployment package is copied to the new environment, the MSBUILD application is used to perform the deployment task. This command line application will enable the developer to test all the environmental variables and resources to ensure that the business application will function once deployed. When the environment has been verified as compatible with the business application, it is then deployed to the K2 Server for use.
 
 
[Figure 2. Deployment process]
 
 

From K2 Process to Deployment Package

 
The Create Deploy Package option is available from the Solution Explorer in the K2 Designer for Visual Studio. Once the development cycle for a process is complete (i.e., the process has been built and tested appropriately), the deploy package is created.
 
This is done by performing the following steps in the K2 Designer for Visual Studio:
  1. Right-click on the project in the Solution Explorer
  2. Select the Create Deploy Package option
  3. Monitor the progress using the information bar in the lower left hand corner. Visual Studio will tell you when it is complete.
  4. When the package has been created, browse to the location on the file system

What is a Deploy Package?

The deploy package is a collection of files which the MSBUILD application will use to deploy the process in the new environment.
Important: Be sure that all the required files are copied to the target environment. Where files are corrupt or missing, the deployment process will not be successful. The deployment package includes an executable and supporting resource dependencies.
 
Deploy Package Files and Resources
[K2Project].exe
This is the project executable
[K2Project].dll
Libraries required to deploy the project
Deployment Folder
The MSBUILD files required are located in the Deployment folder
 
These files and resources can be seen in the figure below:  

[Figure 3. Deployment Package files]
 
Additional files, including the MSBUILD file, are located in the deployment folder:

 
 
[Figure 4. Additional files located in the Deployment folder]
 
 
To move the Deployment Package, all files in the object folder and sub directories (as shown in Figure 3) must be copied to the new environment.
 

Working with the MSBUILD File

 The MSBUILD file includes a number of properties that can be set as necessary.
 
Property Groups
 
The property group tags are set and cleared using the command line application MSBUILD. The table below describes the property options.
 
Property Tag
Boolean Setting
Description
Deploy_Processes
True / False
Deploys the process to the K2 Server
Create_Notifications
True / False
Deploys the notifications
Create_Workflow_Smart_Objects
True / False
Deploys Workflow SmartObjects
Create_Workflow_Reporting_SmartObjects
True / False
Deploys Reporting SmartObjects
TestOnly
True / False
Deploys only when TestOnly is set to false
Deploy_SmartObjects_And_Associations
True / False
Deploys SmartObjects and Associations
InfoPath_Process_And_Event_Deployment True / False Deploys the InfoPath process and the form if set to true; false does not deploy the InfoPath form.
 
The two properties that affect the deployment process are Deploy_Processes and TestOnly. The TestOnly property enables a mock deploy which essentially ‘tests’ the environment to ensure that all parameters are correct. Thereafter the Deploy_Processes option is set to true and the FULL process deployment takes place.
 
Note: The options to Deploy Process and TestOnly cannot both be true or both false. When one is true the other must be false.
 
The below XML code sample shows the properties set for a deployment:
<PropertyGroup>
    <Deploy_Processes>True</Deploy_Processes>
    <Create_Notifications>True</Create_Notifications>
    <Deploy_SmartObjects_And_Associations>True</Deploy_SmartObjects_And_Associations>
    <Create_Workflow_Smart_Objects>True</Create_Workflow_Smart_Objects>
    <Create_Workflow_Reporting_Smart_Objects>True</Create_Workflow_Reporting_Smart_Objects>
 </PropertyGroup>
 <PropertyGroup>
    <TestOnly>False</TestOnly>
    <Environment>Development</Environment>
 </PropertyGroup>
 
 
 

 Deployment Methodology

  1. Test the environment to ensure that the Deploy Package’s process will run within the given environment. This is done by setting the TestOnly flag to ‘true’, and the Deploy_Processes flag to ‘false’.
  2. After the environment has been tested, set the TestOnly flag to ‘false’, and the Deploy_Processes flag to ‘true’. This will deploy the proceses to the target K2 Server.
 

Using the MSBUILD Application

The MSBUILD application is provided as a tool with the .NET 2.0 Framework. The .NET 2.0 Framework must be installed on the machine in order to use the deploy package.
Note: The MSBUILD Application is a command line application and must be run from a command prompt (i.e., there is no user interface available).
  
As shown in Figure 5, the MSBUILD Application can be located using Windows Explorer, but cannot be run from there.
 
 
[Figure 5. The location of the MSBUILD utility]
 
Note: Figure 5 demonstrates the relationship between using the command prompt and where the MSBUILD executable is physically located. To use the MSBUILD utility, you must run it from a command prompt, as explained below.
 
To run the MSBUILD utility:
 
1.       Open a command prompt (click on Start > Run and type in CMD and press ENTER)
2.       At the prompt, type in cd WindowsMicrosoft.NETFrameworkV2.0.50727 and press ENTER
3.       For help on using the application, type MSBUILD /? and press ENTER
Note: You can set an environment path variable to make the MSBUILD utility available at any command prompt. At a command prompt, type in
C: SET PATH = “C:WINDOWSMicrosoft.NETFrameworkV2.0.50727” and then press ENTER.
 

Example: Using MSBUILD

 
Note: You must log in as an account that has export rights on the target K2 Server in order to deploy a process.
 
The two examples below will assist in deploying the package to a new environment. For further assistance in using MSBUILD, please refer to the Microsoft Documentation.
 
For the following examples, the following assumptions are made:
  1. The [FileName] is the full path to the MSBUILD File. For example, if you have a project named “Expense Claims Process” located at “C:Visio Expense”, the FileName above should be “C:Visio ExpenseobjDebugDeploymentExpense Claims Process.msbuild” 
  2. The [Environment] is the name of the environment you are deploying to. For example, Development or Production

Testing the Environment

To test the environment settings without deploying the package, use the TestOnly flag.
 
Use the following syntax:
 
          MSBUILD [FileName] /p:TestOnly=True;Environment=[Environment]
 
If no errors are reported by this command your environment is most likely suitable to deploy the package. You may now proceed to deploy the package.
 

Deploying the Package

To deploy the package, use the following syntax:
 
          MSBUILD [FileName] /p:Environment=[Environment]
 

Sample Syntax

Using our assumptions above, the following command could be used to test the deployment environment:
               
          MSBUILD “C:Visio ExpenseobjDebugDeploymentExpense Claims Process.msbuild” /p:TestOnly=True;Environment=Production
 
To deploy using our assumptions above, the following command could be used:
 
          MSBUILD “C:Visio ExpenseobjDebugDeploymentExpense Claims Process.msbuild” /p:Environment=Production

 


0 replies

Be the first to reply!

Reply