You are on page 1of 20

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:


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, 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 Itemlink to create a new
Project,

a.
2. Enter name of the project of type “Freestyle project” then click OK
a.
3. Click Save.
4. Click on Configure and select This project is parameterized as follows,

a.

b.
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,

a.
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)
a. Select “Inject environment variables to the build process” option and provide below
configuration

b. 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,
a. %PEGA_HOME%\scripts\utils\prpcServiceUtils.bat export --connPropFile
%WORKSPACE%\%SystemName%_export.properties --artifactsDir %WORKSPACE%
1.

b. %PEGA_HOME%\scripts\utils\prpcServiceUtils.bat import --connPropFile


%WORKSPACE%\%SystemName%_import.properties --artifactsDir %WORKSPACE%
1.

9. Go to Post-Build Actions tab then add the E-Mail Notification for the build failures,

a.
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,
a.
12. Click on Build with Parameters then perform the Build with the correct values as follows,
a.

b. Now the build will be running and you can open the build to see the console output
1.

c. Export task completed successfully as per the console message below,

1.
d. The exported Product zip file is created in Jenkins Project workspace folder as follows,

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

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

1.
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.

You might also like