Discussion

48
Replies
19896
Views
Mahesh Midthuru Member since 2015 4 posts
PEGA
Posted: September 19, 2017
Last activity: February 24, 2020

[Procedure] Export & Import using prpcServiceUtils from Jenkins in Pega v7.2.2

Hi All,

I had recently succeded in automating the export/import functionality from one environment to another environment using Product/Application rules using prpcServiceUtils in Pega v7.2.2 with the help of Jenkins 2.60.2. I would like to share this implementation details here on PSC so that it can be helpful to many.

References:

1. Process Document: https://pdn.pega.com/using-prpcserviceutils-and-jenkins-automated-application-deployment/using-prpcserviceutils-and

2. prpcServiceUtils Media - https://pdn.pega.com/exchange/components/remote-configuration-command-line-tool-prpcserviceutils

3. Jenkins - https://jenkins.io/download/

Step1: Install Java 1.8 or higher and set below environment variables (my Jenkins version is 2.60.2).

JAVA_HOME= C:\Program Files\Java\jdk1.8.0_101

JRE_HOME= C:\Program Files\Java\jre1.8.0_141

Path=%JRE_HOME%\bin;%JRE_HOME%\bin\server;

Step2: Download ANT media from http://ant.apache.org/bindownload.cgi

ANT_HOME= C:\MyInstalls\apache-ant-1.10.1

Path=%ANT_HOME%\bin

Step3: Install the downloaded Jenkins 2.60.2 Setup.exe file as windows service.

Installed at C:\MyInstalls\Jenkins location as shown below,

After the installation completes it will open the Jenkins login as shown below,

Now open the file C:\MyInstalls\Jenkins\secrets\initialAdminPassword in notepad and copy the password then paste it to continue.

Now install the suggested plugins as follows,

After the plugins were installed it will redirect to Admin account creation page as follows,

Credentials Provided: Admin/Admin

Now start using the Jenkins, it will route to the following page,

Step4: By default, ANT Plugin will be installed. “Environment Injector Plugin” and “Build with Parameters Plugin” needs to be installed from Manage Jenkins->Manage Plugins -> Available

Click on “Download now and install after restart” and go back to Manage Plugins in order to install another plugin as follows,

Select Restart Jenkins checkbox and re-login after Jenkins restart to see the installed Plugin. Now go to Available Plugins and search for “Build with Parameters” as follows,

Click on “Download now and install after restart” and now click on Restart Jenkins option as follows,

After the restart completion you can able to see the both installed plugins in Installed tab of Manage Plugins after re-login as follows,

Step5: Download the PrpcServiceUtils.zip file from above specified URL then extract the downloaded prpcServiceUtils-7.2.2.zip file into Jenkins accessible location as shown below,

Step6: Configure your build environment to call the prpcServiceUtils.bat or prpcServiceUtils.sh script and pass parameters to import or export the RAP:

  1. Verify that the following Jenkins plugins are installed:
    1. Ant Plugin
    2. Environment Injector Plugin
    3. Build with Parameters Plugin
  2. Open a web browser and navigate to the Jenkins server.
  3. Click Manage Jenkins.
  4. Click Configure System.
  5. Configure the PEGA_HOME environment variable:
    1. In the Global properties section, select Environmental variables.
    2. In the name field, enter PEGA_HOME.
    3. In the value field, enter the location where you extracted the prpcServiceUtils.zip file i.e. “C:\MyInstalls\prpcServiceUtils_722
    4. Click Add.
  6. ​Also add JAVA_HOME and ANT_HOME (if any issues with the paths in Jenkins).

Step7: Create the Product rule in the source application using Designer Studio > Application > Distribution > Package or from Records explorer as shown below,

Note: Make sure you don’t have any unlocked rulesets in your product rule, if enable the unchecked rulesets in your product rule.

Step8: Configure the Jenkins Project to pass data to the prpcServiceUtils tool,

  1. Create new project by Click on Create New Jobs link or New Item link to create a new Project,
  2. Enter name of the project of type “Freestyle project” then click OK
  3. Click Save.
  4. Click on Configure and select This project is parameterized as follows,
  5. Click Add Parameter -> String Parameter type and create the parameters that Jenkins passes to the prpcServiceUtils tool as follows,
    1. To import or export a RAP using Product rule then set productName, productVersion parameters:
    2. To import or export using application then set applicationName, applicationVersion parameters:
  6. Select Prepare an environment for the run. In the Properties Content section, enter the following properties as shown below,
  7. Now go to Source Code Management tab and select the option None (as we are not getting the source code from repositories like Git/Subversion)
    1. Select “Inject environment variables to the build process” option and provide below configuration
    2. ARTIFACTS_DIR=C:/MyInstalls/Jenkins (Jenkins installation location/Project Workspace location) and ImportExistingInstance=skip (parameter to skip the import of the existing instances, to override we need to provide this value as “override”)
  8. Now add the Build step -> Invoke Ant action for the export and import of the RAP action as follows,
    1. %PEGA_HOME%\scripts\utils\prpcServiceUtils.bat export --connPropFile %WORKSPACE%\%SystemName%_export.properties --artifactsDir %WORKSPACE%
    2. %PEGA_HOME%\scripts\utils\prpcServiceUtils.bat import --connPropFile %WORKSPACE%\%SystemName%_import.properties --artifactsDir %WORKSPACE%
  9. Go to Post-Build Actions tab then add the E-Mail Notification for the build failures,
  10. Click on Save
  11. Open C:\MyInstalls\prpcServiceUtils_722\scripts\samples\jenkins\Jenkins-build.xml file and configure the required properties for import and export tasks as follows,
  12. Click on Build with Parameters then perform the Build with the correct values as follows,
    1. Now the build will be running and you can open the build to see the console output
    2. Export task completed successfully as per the console message below,
    3. The exported Product zip file is created in Jenkins Project workspace folder as follows,

    4. The import process into the target machine is also successful as shown below,

    5. The import process related files will be created in Project work space folder as follows,

Jenkins Additional Information:

How to change boot configuration?

By default, your Jenkins runs at http://localhost:8080/. This can be changed by editing jenkins.xml, which is located in your installation directory. This file is also the place to change other boot configuration parameters, such as JVM options, HTTPS setup, etc.

Starting/Stopping the service

Jenkins is installed as a Windows service, and it is configured to start automatically upon boot. To start/stop them manually, use the service manager from the control panel, or the sc command line tool.

Inheriting your existing Hudson/Jenkins installation

If you'd like your new installation to take over your existing Jenkins/Hudson data, copy your old data directory into the new JENKINS_HOME directory.

How to configure E-mail Notification?

Configure the account details in-order to send the email notifications during the build failures from Manage Jenkins > Configure System > E-mail Notification as shown below,

Note: Make sure you allow the Less secure apps enabled for your gmail/yahoo accounts from https://myaccount.google.com/lesssecureapps

https://login.yahoo.com/account/security#other-apps

If your build is failed then the mail will be sent to the mail id which is provided in the Post-Build Actions in the Project,

Schedule Build Plugin:

Go to Manage Jenkins > Manage Plugins > Available > search for “Schedule Build Plugin” and install using “Download now and install after restart”,

Now you can see the schedule properties in Manage Jenkins > Configure System > Schedule Build Plugin

Open PegaExportImportRAP > Configure > Build Triggers > enable Build periodically and provide the Schedule expression like below,

To get help regarding the Schedule expressions click on the help icon as shown below,

Now go to Jenkins dashboard and see the icons beside your Project as shown below,

Note: In our case “Schedule a build with parameters for PegaExportImportRAP” is enabled as our project is parameterized.

Build ran at 1:52:06PM as shown below.

You can have a look into the Process document and the sample Jenkins-build.xml files in the attached zip file.

Additional Information:

https://community1.pega.com/community/product-support/question/export-import-multiple-product-rules-using-prpcserviceutils

https://community1.pega.com/community/product-support/question/controlling-import-task-based-export-task-build-status

Regards

Mahesh Midthuru

***Updated by moderator: Lochan to add group tags FAQ and Blog***

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

DevOps Low-Code App Development Installation and Deployment Developer Knowledge Share
Share this page LinkedIn