Export & Import using prpcserviceutils from Jenkins in Pega v7.2.2 Document Name Process document PRPCServiceUtils download Jenkins URL https://pdn.pega.com/using-prpcserviceutils-andjenkins-automated-application-deployment/usingprpcserviceutils-and https://pdn.pega.com/exchange/components/remoteconfiguration-command-line-tool-prpcserviceutils https://jenkins.io/download/ Step1: Install Java 1.8 or higher and set below environment variables as 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 finish of the installation 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: Admin/Admin
Now start using the Jenkins 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: a. Ant Plugin b. Environment Injector Plugin c. 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: a. In the Global properties section, select Environmental variables. b. In the name field, enter PEGA_HOME. c. In the value field, enter the location where you extracted the prpcserviceutils.zip file i.e. C:\MyInstalls\prpcServiceUtils_722 d. 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. 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, a. To import or export a RAP using Product rule then set productname, productversion parameters:
b. 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, SystemName=$BUILD_TAG SourceHost=http://localhost:8722 SourceUser=admin@jenkins SourcePassword=rules 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) Select Inject environment variables to the build process option and provide below configuration, ARTIFACTS_DIR=C:/MyInstalls/Jenkins (Jenkins installation location/project Workspace location) 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, %PEGA_HOME%\scripts\utils\prpcServiceUtils.bat export --connpropfile %WORKSPACE%\%SystemName%_export.properties --artifactsdir %WORKSPACE% %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, Now the build will be running and you can open the build to see the console output,
Export task completed successfully as per the console message below, The exported Product zip file is created in Jenkins Project workspace folder as follows, The import process into the target machine is also successful as shown below,
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.