Git Merge - Opsera Pipeline
This document will provide an overview of the workflow followed for Git Merge feature where components will be merged/synced from SFDC Org to Git branch.
How to create Task
Login into Opsera portal & click on “Tasks” option from the left menu
Upon clicking on the “Tasks” menu, the Opsera Task Management screen displays.
Click on “New Task“ and a window will open to configure the Task.
Enter Name, Description, Tags [any], Type – SFDC Org Sync
Once you select the type as “SFDC Org sync”, it will open up the rest of the fields to be configured.
Jenkins tool | Shows all Jenkins Tool from Tool Registry - Select one |
SFDC Account | Shows all SFDC Account from Tool Registry - Select one |
Account | Shows account added in Jenkins tool from Tool registry |
Repository | Select repo from account |
Branch | Select Branch where changes to be merged |
Once above all fields are selected, click on “ Create “ from the right bottom, to finish creating the task.
Now, Task has been added successfully (As shown below)
Click on “ Go back” icon to navigate to the table view to view the newly created Task.
You have the option to exclude or include an XML package from the merge during the task run. This will include the package XML along with retrieving the components into the file path of your choice.
To include the XML package, use the following steps:
Including an XML package with merge
Within the Salesforce Organization Sync task, click on the gear icon to edit the task:
2. Scroll down and toggle on “Include Package XML”:
3. In Package XML Reference Path field, you can either specify the name of the folder where the Package XML will be merged or have the Package XML updated in current directory.
To specify the file where the Package XML will be merged: Include the file path name.
To have the Package XML updated in the current directory: Give the path as “.” (dot).
4. Save and proceed to follow the next steps. Once the task has successfully been completed, the Package XML will be viewable in the reference path provided above.
For example, if you include the following Package XML Reference Path:
The package XML will be merged into the given Repository, Branch & current directory:
Run a successful Merge task
On the Opsera Task table, select individual task to view Task Details→ click on ‘Run Task’ button
Click on ‘Run Task’ on the confirmation dialog box
On the SFDC Git Task Configuration page, click Start a New Instance button. Select components and click Proceed with Selected Components
In SFDC Files tab→ use the File Selection Rule Filter to select modified files.
The Filter field will filter the Field selection by “Contains”, “Starts With”, “Ends with” or “Equals” and the Value provided.
Select the modified files whichever needed for merging and Proceed with the Files
Click on ‘Proceed’ button on the Package XML page
Task will start to run and merge with a message ‘request to start this task has been submitted’
Click on Activity Logs → where Task run logs will be captured
Once Merge is successful → ‘Git Merge Action: Synch up successful’ message will be displayed
SFDC Org and Git branch – Modified files should be in Sync now (as shown below)
SFDC Org
Git Branch
Merge Conflict Scenario
If there is a conflict, a Pull Request will be automatically created and PR link will be captured in the Task Logs for user action
Resolving Conflicts from GitHub UI
Open the Pull Request Link and click on Resolve Conflicts.
The conflicts will be displayed on screen.
Resolve the conflicts and click on Mark as Resolved.
Click on Commit Merge to push the changes as part of the Pull Request.
Merge Pull Request will be enabled and Pull Request can now be merged.
Resolving Conflicts from GitLab UI
Open the Pull Request Link and click on Resolve Conflicts.
Click on either Interactive Mode or Edit Inline option to edit the files for resolving conflicts and click on Commit to source branch to push the changes as part of Pull Request.
Merge will be enabled and Pull Request can now be merged
Resolving Conflicts from BitBucket UI
Open the Pull Request Link and click on Resolve Conflicts (Power Editor for BitBucket Atlassian App).
Merge will be enabled once the conflicts are resolved and the Pull Request can then be merged
No changes to sync scenario
When there is no change to pull from SFDC Org → A message depicting ‘No changes to be pulled’. will be displayed