...
This user guide will walk you through how to create and configure Salesforce CI/CD pipeline in Opsera
Table of Contents |
---|
Prerequisites for setting up the pipeline:
Below information are needed before setting up a pipeline,
...
3. Credentials of Source code Repository such as Gitlab/Github/Bitbucket
Steps to configure
...
Salesforce pipeline in Opsera
Login into the Opsera Portal (https://portal.opsera.io/) and sign in with your registered email.
Add
...
Salesforce Org to the Opsera portal
click Click on Tool Registry (found at the left panel of options as shown below)
...
2. Click on ‘New Tool’ (as shown below) - To add SFDC Org to establish an initiation.
...
3. Enter tool details as explained below,Tool Details in Create New Tool form:
Tool Name - Give a meaningful name for the tool
Tool Identifier- Select ‘SFDC Configurator’ from the drop down
Description - Give a description for the tool
...
4. Click Create
...
6. Once the tool is created, Click on ‘Connection’ tab to enter the details.
Enter values for the following fields:
Domain URL - Salesforce URL
...
SFDC Username
...
SFDC Client ID
...
SFDC Client Secret
...
SFDC Token
...
Password
Build Type - Ant Migration or Salesforce DX (SFDX)
...
...
7. Click Save. This will save the tool Configuration The tool configurations will be updated successfully and Salesforce org has been successfully added to Opsera portal.
...
Next - Create Source Code repository for your pipeline (Gitlab/
...
Github/
...
Bitbucket)
8. Click on Tool Registry on left navigation panel and click on ‘New Tool’.
...
9. Enter the following values:
Tool Name
...
Tool Identifier
...
- Select the
...
Source Code Management (SCM) tool from the
...
dropdown
Description
...
10. Click Create Toolbutton to save.
...
12. Click on Navigate to the Tool → Click on ‘Connection’ tab → Enter the following values:
URL
...
Username
...
Personal Access Token
...
...
13. Click ‘Save’ → Tool Configuration Save to update the tool’s configurations will be updated successfully. This would successfully add the repository SCM tool to the Opsera portal. Next, Jenkins tool to be added, and integrated with source code repository After saving the tool, ensure the Connection is successful by clicking ‘Test Connection
Add Jenkins tool and integrate with Source Code Management
14. Click on Tool Registry on left navigation panel and click on ‘New ‘+New Tool’.
...
15. Enter In Create New Tool form, enter the following values:
Tool Name
...
Tool Identifier
...
- Select Jenkins from the drop down
...
.
Description
...
16. Click Create Tool
...
17. Click on the Tool → Click on ‘Connections’ tab → Enter Jenkins URL, UserID, and navigate to 'Connections’ tab. Enter the following values:
Jenkins URL
Jenkins Port
Jenkins User ID
Jenkins Token
...
18. Save tool and then click ‘Test Configuration’ to ensure connection succeeds.→ succeeds→ Tool Configuration configurations will be updated successfully.
...
19. Click on Accounts tab
...
20. Click on ‘Register ‘+ Register New Account Credentials’ button
...
21. Create New Jenkins Account adding form will be openedopen
...
23. Select Platform [Select your source code repository management tool from the drop down - gitlabGitlab/githubGithub/bitbucketBitbucket], Then drop down for “tools” will be enabled - Select the tool that you just created.
...
Platform - Select your Source code management platform from the dropdown. Choose from Gitlab, Github and Bitbucket.
Tool - Select the recently created tool from the dropdown.
24. Enter Name and Description of credentials to be added in Jenkins and click on ‘Add Jenkins Credentials’. This would link the Jenkins job ‘Save’ button. The Jenkins Job is now linked to your source code repository.
...
25. Login to Jenkins to verify the integration of repository tool. Navigate to Jenkins and login, Click on Admin” from the right top corner and click on “Credentials” at the left list of options - to verify the Integration of repository tool with Jenkins.
...
Next, Creation of SFDC Jenkins jobs in Opsera Portal
(each one represents the SFDC Process such as Validate Package XML, Backup of an Org, Unit Test, Deploy to an Org)
...
SFDC Jenkins Jobs creation in Tools
Each job represents an SFDC Process:
SFDC Jenkins Jobs:
SFDC Create XML Package
Profile Migration
SFDC Validate XML Package
SFDC Backup
SFDC Deploy
SFDC Unit Test
SFDC Push Artifacts
25. In the Opsera portal - Navigate to Tool Registry and select the Jenkins tool you just created. Navigate to the Jobs tab and click on + Create Job button (as shown below)
...
27. Select Job Type as ‘SFDC Jobs’, Name, Description and Job Type as ‘Validate XML Package’
...
28. Click ‘Save Job’ 26. Make the following selections:
Job Type - SFDC Jobs
Build Step - SFDC Validate XML Package
Enter a Name and Description.
...
27. Click Create button to finish creating the job.
...
2928. Job The job has now been created on in the Jenkins Tool which will be used on in Pipelines to successfully create builds inside Jenkins.
3029. Repeat the above job process for creating other jobs for --> SFDC Backup, SFDC Unit Test and SFDC Deploy
...
Jobs have been created and configured and all ready for use. This is a one time configuration activity & can be used repeatedly for “n” number of pipelines.
...
Pipeline Creation
...
and
...
Configuration
3130. On the Opsera portal , Click on navigate to Pipelines from the left navigation panel to open the catalog to create pipeline. Click on ‘Catalog’ Tab (found at the right top panel as shown below)
...
3231. From the below list of pipeline templates, Under the ‘Salesforce Template’, click on “ Create Pipeline “ to add the pipeline successfullyIn the Marketplace in Pipeline Templates, locate Salesforce Template, and click + Create Pipeline to create a pipeline using this template.
...
To give a meaningful name for 32. To rename the pipeline, On navigate to Summary tab , and click on the little pencil icon (next to salesforce . Next to the pipeline template name - to edit the name)
...
“SalesForce Template”.
...
33. Edit the pipeline by editing any additional details. Click the Save icon to save the new name.
...
Create Package XML job & Configuration
34. Click on Navigate to Workflow tab → .
A default step ‘Create ‘SFDC Jenkins Create Package Job’ will be available
...
35. Click on the ‘Configuration icon’ gear icon on the ‘Create SFDC Jenkins Create Package Job’ step → It will open the fields for adding the configurationJob step to view the Step Configuration form.
...
36. Enter the below fields and click Save
Tool
...
- From the dropdown, select the Jenkins tool created in Tool Registry;
Job Type
...
- The default Job Type for Package creation job is ‘SFDC Package
...
Generation Job’. For other steps, it
...
is ‘Opsera managed jobs’.
Salesforce Credentials
...
- Source Org from which modified files will be fetched
Account
...
Repository → Based upon the Account - All the repositories available will be fetched [Select one]
...
- Select the source control management credentials that were added in the Tool Registry. Choose from Gitlab, Github or Bitbucket.
Workspace/Project - Select the Workspace or Project in the the source control management account.
Repository - All the repositories available will be fetched from the selected Workspace.
37. Click Save → all the configurations made to the step will be saved.
...
As a token of verification, a ‘SFDC_Create Package XML'’ build job will be created in Jenkins which will have ‘Pipeline and Step ID’ suffix for unique identification.
...
SFDC process includes , ‘Create Package XML’, ‘Validate XML’, ‘Backup’, ‘Unit Test’ and ‘Deploy’ the following steps in pipeline, where each one the pipeline:
Create Package XML
Validate XML
Backup
Unit Test
Deploy
Each can be used based upon the organization need and each can be plugged in/out based upon necessity.
...
Add a Validate XML
...
pipeline step to the workflow
38. Click on ‘Edit workflow’ option on the pipeline as shown below.
...
39. Click on ‘+' icon present below the ‘Jenkins SFDC Jenkins Create Package Job’ → It will add a Job.
A new step called 'Unconfigured step’ will be added to the workflow.
...
40. Click on ‘Done Editing’ and Done Editing then click on ‘Pencil’ the pencil icon on ‘Unconfigured Step’ →
Step detail fields Setup will be openedopen.
...
41. Enter the ‘Step name’ and select the tool as ‘Jenkins’values for the fields:
Step Name - Enter a unique step name.
Tool - Select Jenkins. Note: Tool cannot be changed after form is saved. To change the tool, delete the step and create a new one.
Tags - Select any tags to be applied at this level.
...
42. Click Save button to save the step level details.
...
43. Click ‘Configuration icon’ → configuration the gear icon (⚙️)→ Configuration fields will open
...
44. Enter Tool, Job Type, Job, Salesforce Credentials and Generate XML Step Info Unit Test Type field values and click on ‘Create Job and Save’.
...
45. Configuration section will be closed and the given details will be saved
...
46. As a token of verification, a ‘SFDC_Validate Package XML’ build job will be created in Jenkins which will have ‘Pipeline and Step ID’ suffix for unique identification.
...
Next Pipeline Step Configuration - Backup → The entire SFDC Org components will be taken as a backup and will be pushed to Git/Bitbucket Repository based upon the step configuration.
Next, Backup of an Org - Step to be Configured
47. Repeat the steps above for creating to create a New new step for Backup to be added
...
48. Click on Save to save the step details
...
49. Click ‘Configuration icon’ the gear icon (⚙️) → Enter the configuration details
Enter Tool, Job Type, Job, Salesforce Credentials, Account, Repository and Rollback Branch Name Workspace/Project and Repository field values.
...
50. Click on Create Job and Save button
...
51. Configuration section will be closed and the given details will be saved
...
52. As a token of verification, a ‘SFDC_Backup’ build job will be created in Jenkins which will have ‘Pipeline and Step ID’ suffix for unique identification.
...
...
Next Pipeline Step Configuration for Unit Test
(All the test classes will be executed for this step)
5352. Similar to above steps - New step for Unit test can be added
...
5453. Click on ‘Pencil icon’ the pencil icon (✎) on Unconfigured step and add Step level details
...
5554. Click on Save to save the step details
...
5655. Click ‘Configuration icon’ the gear icon (⚙️)’ → configuration fields will open
...
5756. Enter Tool, Job Type, Job, Salesforce Credentials field values and Click on 'Create Job and Save button’
...
5857. Configuration section will be closed and the given details will be saved
...
59. As a token of verification, a ‘SFDC_Unit Testing’ job will be created in Jenkins which will have ‘Pipeline and Step ID’ suffix for unique identification.
...
Next Pipeline Step Configuration for “ Deploy”
(Destination SFDC Org to be configured where the modified files created as part of ‘Create Package XML’ step will be deployed )
6058. Similar to above steps - New step for Deploy can be added
...
6159. Click on ‘Pencil icon’ on Unconfigured step and add Step level details
...
6260. Click on Save to save the step details
...
6361. Click ‘Configuration icon’ → configuration fields will open
...
6462. Enter Tool, Job Type, Job, Salesforce Credentials field values and Click on 'Create Job and Save button’
...
6563. Configuration section will be closed and the given details will be saved
...
66. As a token of verification, a ‘SFDC_Deploy’ job will be created in Jenkins which will have ‘Pipeline and Step ID’ suffix for unique identification.
...
The necessary steps of SFDC Process has been configured successfully. Now the pipeline can be started / initiated to run.
Sample Pipeline Run / Execution
Sample pipeline run has been shown below to explain the process and its successful deployment on Git to SFDC Org.
...
67. Custom Object ‘SFGA__Ad_Group_ID__c’ is taken as an example here [image taken before deployment in SFDC]
...
6864. On Git, Same custom object File ‘SFGA__Ad_Group_ID__c’ is modified for ‘Inline help text’ field and committed.
...
6965. In the Opsera Portal → Navigate to the configured pipeline → Click on ‘Start Pipeline’. as shown below.
...
7066. Pipeline start wizard Start Wizard will be opened → where components of modified files need to be selected.
On the wizard, we you have the option to select/deselect modified files and , view/edit the package xml.
...
71XML and use a past run’s XML .
Manual Pipeline Wizard Run
...
Use Past Run’s XML and XML/File Upload Process
...
Choose from Source Org:
If From Git is selected, you may include dependencies. By default, all CustomObject dependencies are included in the deployment while selecting components from the Git Side. By disabling this toggle, dependencies will be excluded from Git to SFDC merge unless explicitly selected. This can also be selected in a manual pipeline run on the following Component Type selection screen:
...
If dependencies are included in the pipeline run, verify their details in the Console log after the pipeline has run from Git to SFDC:
...
XML/File Upload Process
...
67. Select the date & components and click on ‘Next’‘Proceed with Selected Components’
...
7268. Modified files for selected components will be displayed from both Git/Bitbucket as well as SFDC.
Select the respective files & click on “Proceed with selected SFDC files” - Either Select the components from the list or upload components as a csv file to use for deployment.
...
7369. This will open the necessary steps to be executed. In this example, “ Unit testing “ - Click on the “unit testing “ box to open up the the testing classes. This needs to be specified . Please select each step below and then apply the required testing classes before proceeding. Please note, without this step, the pipeline cannot complete successfully. Once the necessary files are selected → Click on Next → To view the package XML
...
** Easier and simpler UI framework for enhancing Unit Test class selection.
** Bulk addition of Apex Test Classes can be made by multi-selecting the test classes displayed on the left-side table and clicking on Add Selected Button on top of the corresponding table.
** Bulk removal of selected Apex Test Classes can be made by multi-selecting the test classes displayed on the right-side table and clicking on Remove Selected Button on top of the corresponding table.
...
7470. Modified files will be converted to package XML for deployment → Click on Proceed to start the Opsera pipeline
...
7571. Opsera Pipeline process started as shown below
...
7672. Create Package Job is successful as shown below. Once Create Package job is successful, next pipeline step will be automatically taken for processing.
...
7773. Validate XML step is successful → which indicates modified files and its related objects are available in Package XML.
...
7874. Backup step is successful → This indicates a ‘Rollback branch’ created in Git repository tool and all the SFDC Components are backed up.
...
7975. Output of Backup Step - Git branch created.
...
8076. All the components and files of Source SFDC Org mentioned in Pipeline Backup step is backed up here.
...
8177. Unit test step is successful → which indicates all the test classes are successfully executed in respective SFDC Org mentioned in Pipeline step.
...
8278. Deploy step is successful → which indicates the modified files from Git are successfully deployed to Salesforce Destination Org as mentioned in pipeline step.
...
8379. Salesforce Destination Org has been updated with modified content from modified file in Git
...