Source code synchronization helps users who want to use DSL to store, manage, and author their automation as code, and also want to version, maintain, and control code in a source code management (SCM) tool. This functionality is useful for applying GitOps principles to software delivery automation.
Source code synchronization permissions
If a project containing the source code synchronization objects does not have adequate permissions set, all jobs called by polling triggers or webhooks fail with the following error:
None of the principals in this authentication context ('project: Electric Cloud', 'project: EC-Git-VERSION', 'project: SCM_PROJECT', 'project: EC-DslDeploy-VERSION') have modify privilege on systemObject 'projects'
To resolve this issue, the project containing the source code synchronization object or one of principals in the error message must be given change permissions rights on the system object project. Refer to the following table for specific principal access settings.
Read | Modify | Execute | Change permissions | Actual |
---|---|---|---|---|
|
|
|
|
A principal cannot view or perform any actions on the SCM object. |
|
|
|
|
A principal can only view SCM object. |
|
|
|
|
A principal can view, create, modify, and delete SCM object. |
|
|
|
|
A principal can view and run the SCM object. |
|
|
|
|
A principal can view, create, and delete the SCM object. |
|
|
|
|
A principal can view, create, modify, delete, and execute the SCM object. |
For more information, refer to Access control.
Adding a source code synchronization object
Before SCM-to-server synchronizations can begin, you must add an object that includes the details required to perform the synchronization.
To add a source code synchronization object:
-
From the CloudBees navigation menu, select CloudBees CD/RO.
-
From the CloudBees CD/RO main menu, navigate to
. -
On the Source code synchronizations page, select Add source code synchronization.
-
Complete the following options:
Item
Description
Name
A user-defined name for this synchronization.
Project name
A unique name for the synchronization project.
Description (optional)
A user-defined description to help you identify the synchronization.
Type
The type of SCM. Currently,
git
is the only supported type.Send from source
Indicates that the synchronization occurs from the SCM to the server. This checkbox is selected by default. You cannot change it.
Plugin configuration
Select or type the name of the appropriate plugin configuration object for the EC-Git plugin. The configuration is displayed as a path name. For example,
/projects/myProject/pluginConfigurations/myConfiguration
Resource name
The name of the resource to synchronize.
Destination directory
The directory on the agent where the local SCM repository is located.
Repository
The name of the repository that contains the assets to be synchronized with the server.
Branch
The name of the branch in the repository.
Relative path (optional)
The relative path. This is a path in your repository to the correct dsl file structure.
Include objects
The objects to include in the synchronization. Enter the path to each object on a separate line. If you enter objects in this field, only those objects are synchronized. If you leave this field blank, all objects are synchronized.
Exclude objects
The objects to exclude from the synchronization. Enter the path to each object on a separate line.
Cleanup
Select this option to delete the destination directory after the job runs.
Ignore failures
Select this option to ignore failures during the import of DSL files.
Local mode
Select this option to prevent files from being sent to the server with the help of the clientFiles argument of the evalDsl operation in local mode. This option is available only if the destination directory is accessible from the CD/RO server. In a clustered deployment, all CD/RO server nodes must have access to this directory.
Additional DSL arguments
Any additional arguments for the evalDsl call.
-
Select Save changes.
Now, you can configure a trigger for the synchronization.
Configuring a trigger for source code synchronization
Set up a trigger to enable source code synchronization to run automatically.
To configure a trigger:
-
From the CloudBees navigation, select CloudBees CD/RO.
-
From the CloudBees CD/RO main menu, navigate to
. -
On the Source code synchronizations page, locate the synchronization object that you want to trigger.
-
In the Actions column, select the three vertical dots.
-
Select Configure trigger.
-
On the Triggers dialog, select Add +.
-
Enter a name for the trigger.
-
Select the plugin for the trigger.
-
Select Webhook or Polling as the trigger type.
The EC-Bitbucket, Bitbucket Data Center, and Trigger-Property plugins are not supported for source code synchronization triggers. -
Select Next.
Running a source code synchronization manually
To run a synchronization manually:
-
From the CloudBees navigation, select CloudBees CD/RO.
-
From the CloudBees CD/RO main menu, navigate to
. -
On the Source code synchronizations page, locate the synchronization object that you want to run.
-
Select Run.
After the synchronization runs, the run details are displayed.
Editing source code synchronization settings
To edit the synchronization settings:
-
From the main menu, select
. -
On the Source code synchronizations page, locate the synchronization object that you want to edit.
-
In the Actions column, select the three vertical dots.
-
Select Edit.
-
Edit the appropriate fields.
-
Select Save changes.
Enabling or disabling a source code synchronization trigger
To enable or disable a trigger:
-
From the main menu, select
. -
On the Source code synchronizations page, locate the synchronization object for which you want to enable or disable a trigger.
-
In the Actions column, select the three vertical dots.
-
Select Edit.
-
Scroll down to the Enable trigger checkbox.
-
Check or uncheck the checkbox to enable or disable the trigger.
-
Select Save changes.
Viewing the runs for a source code synchronization object
To view runs for an object:
-
From the CloudBees navigation, select CloudBees CD/RO.
-
From the CloudBees CD/RO main menu, navigate to
. -
On the Source code synchronizations page, locate the synchronization object for which you want to view runs.
-
In the Actions column, select the three vertical dots.
-
Select View runs.
Deleting source code synchronization
To delete a source code synchronization object:
-
From the CloudBees navigation, select CloudBees CD/RO.
-
From the CloudBees CD/RO main menu, navigate to
. -
On the Source code synchronizations page, locate the synchronization object for which you want to view runs.
-
In the Actions column, select the three vertical dots.
-
Select Delete.