Source code synchronization

4 minute readReference

Use these commands to manage team assets stored in Git repositories.

  • Store the model DSL in a Git repository.

  • Commit subsequent edits to the repository.

  • Set up a source code synchronization (scmSync) object to automatically push changes to the server.

createScmSync

Creates a new source code synchronization object.

Argument Name Type Description

projectName

String

(Required) The name of the CloudBees CD/RO project that must be unique among all projects.

scmSyncName

String

(Required) The name of this scmSync object.

branch

String

The name of the branch in the repository specified with the repository parameter.

configurationName

String

The EC-Git plugin configuration name. Refer to Create plugin configurations for details.

configurationProjectName

String

The configuration project name.

description

String

Comment text describing this object that is not interpreted at all by CloudBees CD/RO.

destinationDir

String

Destination directory on the agent where the local SCM repository is located.

excludeObjects

List

List of object paths to exclude from synchronization.

exportParameters

List

Comma separated list of import parameters.

importParameters

List

Comma separated list of import parameters.

includeObjects

List

List of object paths to include in synchronization.

relativePath

String

Relative path.

repository

String

The name of the repository containing scmSync assets.

resourceName

String

Resource name

scmType

String

The type of SCM. Currently, git is the only supported type.

syncType

String

The type of synchronization: to or from the SCM. Currently, only supported value is fromScm.

Response

<response requestId="1" nodeId="192.168.1.217"> <scmSync> <scmSyncId>5ce0f6b0-3cef-11ec-8d74-12f00530b5d8</scmSyncId> <scmSyncName>testScmSyncName</scmSyncName> <branch>main</branch> <configurationName>my-git-config</configurationName> <configurationProjectName>Default </configurationProjectName> <createTime>2021-11-03T21:45:29.474Z</createTime> <destinationDir>c:\tmp</destinationDir> <lastModifiedBy>admin</lastModifiedBy> <modifyTime>2021-11-03T21:45:29.474Z</modifyTime> <owner>admin</owner> <projectName>Default</projectName> <propertySheetId>5ce0f6b2-3cef-11ec-8d74-12f00530b5d8 </propertySheetId> <repository>Repo</repository> <resourceName>local</resourceName> <scmType>git</scmType> <syncType>fromScm</syncType> <tracked>1</tracked> </scmSync> </response>

ec-perl

$<object>->createScmSync(<projectName>, <ScmSyncName>, {<optionals>});

Example

$ec->createScmSync('default' 'testScmSync1', {branch => 'main', configurationName => 'my-git-config', scmType => 'git', syncType => 'fromScm', repository => 'Repo', resourceName => 'local', destinationDir => 'c:\tmp'});

ectool usage

Usage: createScmSync <projectName> <scmSyncName> [--branch <branch>] [--configurationName <configurationName>] [--configurationProjectName <configurationProjectName>] [--description <description>] [--destinationDir <destinationDir>] [--excludeObjects excludeObject1 excludeObject2 ...] [--exportParameter exportParameter1 exportParameter2 ...] [--importParameter <var1>=<val1> [<var2>=<val2> ...]] [--includeObjects includeObject1 includeObject2 ...] [--relativePath <relativePath>] [--repository <repository>] [--resourceName <resourceName>] [--scmType <git>] [--syncType <fromScm|toScm>]

Example

ectool createScmSync 'default' 'testScmSync1' \ --branch 'main' \ --configurationName 'my-git-config' \ --scmType 'git' \ --syncType 'fromScm' \ --repository 'Repo' \ --resourceName 'local' \ --destinationDir 'c:\tmp'

deleteScmSync

Deletes a source code synchronization object.

Arguments

Argument Name Type Description

projectName

String

(Required) The name of the CloudBees CD/RO project that must be unique among all projects.

scmSyncName

String

(Required) The name of the scmSync object to delete.

Response

No response.

ec-perl usage

$<object>->deleteScmSync(<projectName>, <ScmSyncName>);

Example

$cmdr->deleteScmSync('default' 'testScmSync1');

ectool usage

Usage: deleteScmSync<projectName> <ScmSyncName>

Example

ectool deleteScmSync 'default' 'testScmSync1'

getScmSync

Retrieve a source code synchronization object by name.

Arguments

Argument Name Type Description

projectName

String

(Required) The name of the CloudBees CD/RO project that must be unique among all projects.

scmSyncName

String

(Required) The name of the scmSync object to get.

Response

<response requestId="1" nodeId="192.168.1.217"> <scmSync> <scmSyncId>e8f820df-3dab-11ec-9379-12f00530b5d8</scmSyncId> <scmSyncName>testScmSync1</scmSyncName> <branch>main</branch> <configurationName>my-git-config</configurationName> <configurationProjectName>Default</configurationProjectName> <createTime>2021-11-04T20:15:09.892Z</createTime> <destinationDir>c:\tmp</destinationDir> <gitWebhookRepository>Repo</gitWebhookRepository> <lastModifiedBy>admin</lastModifiedBy> <modifyTime>2021-11-04T20:15:09.892Z</modifyTime> <owner>admin</owner> <projectName>Default</projectName> <propertySheetId>e8f820e1-3dab-11ec-9379-12f00530b5d8</propertySheetId> <repository>Repo</repository> <resourceName>local</resourceName> <scmType>git</scmType> <syncType>fromScm</syncType> <tracked>1</tracked> <triggerEnabled>0</triggerEnabled> </scmSync> </response>

ec-perl usage

$<object>->getScmSync(<projectName>, <scmSyncName>);

Example

$cmdr->getScmSync('default' 'testScmSync1');

ectool usage

Usage: getScmSync<projectName> <ScmSyncName>

Example

ectool getScmSync 'default' 'testScmSync1'

getScmSyncs

Retrieve all source code synchronization objects for the specified project.

Arguments

Arguments

Argument Name Type Description

projectName

String

(Required) The name of the CloudBees CD/RO project that must be unique among all projects.

Response

<response requestId="1" nodeId="192.168.1.217"> <scmSync> <scmSyncId>e8f820df-3dab-11ec-9379-12f00530b5d8</scmSyncId> <scmSyncName>testScmSync1</scmSyncName> <branch>main</branch> <configurationName>my-git-config</configurationName> <configurationProjectName>Default</configurationProjectName> <createTime>2021-11-04T20:15:09.892Z</createTime> <destinationDir>c:\tmp</destinationDir> <gitWebhookRepository>Repo</gitWebhookRepository> <lastModifiedBy>admin</lastModifiedBy> <modifyTime>2021-11-04T20:15:09.892Z</modifyTime> <owner>admin</owner> <projectName>Default</projectName> <propertySheetId>e8f820e1-3dab-11ec-9379-12f00530b5d8</propertySheetId> <repository>Repo</repository> <resourceName>local</resourceName> <scmType>git</scmType> <syncType>fromScm</syncType> <tracked>1</tracked> <triggerEnabled>0</triggerEnabled> </scmSync> <scmSync> ... </scmSync> </response>

ec-perl usage

$<object>->getScmSyncs(<projectName>, {<optionals>});

Example

$cmdr->getScmSyncs("default");

ectool usage

Usage: getScmSyncs <projectName>

Example

ectool getScmSyncs 'default'

modifyScmSync

Modify an existing source code synchronization object.

Argument Name Type Description

projectName

String

(Required) The name of the CloudBees CD/RO project that must be unique among all projects.

scmSyncName

String

(Required) The name of this scmSync object.

branch

String

The name of the branch in the repository specified with the repository parameter.

clearExcludeObjects

Boolean

<0|1|true|false>

Whether or not to clear exclude objects for this object.

clearIncludeObjects

Boolean

<0|1|true|false>

Whether or not to clear include objects for this object.

configurationName

String

The EC-Git plugin configuration name. Refer to Create plugin configurations for details.

configurationProjectName

String

The configuration project name.

description

String

Comment text describing this object that is not interpreted at all by CloudBees CD/RO.

destinationDir

String

Destination directory on the agent where local SCM repository is located.

excludeObjects

List

List of object paths to exclude from synchronization.

exportParameters

List

Comma separated list of import parameters.

importParameters

List

Comma separated list of import parameters.

includeObjects

List

List of object paths to include in synchronization.

newName

String

New name for the existing scmSync object that is being renamed.

relativePath

String

Relative path.

repository

String

The name of the repository containing scmSync assets.

resourceName

String

Resource name

scmType

String

The type of SCM. Currently, git is the only supported type.

syncType

String

The type of SCM synchronization. The only supported value is fromScm.

triggerEnabled

Boolean

<0|1|true|false>

Set to true if the trigger is configured and enabled. Otherwise, set to false. Default is false|0.

Response

<response requestId="1" nodeId="192.168.1.217"> <scmSync> <scmSyncId>e8f820df-3dab-11ec-9379-12f00530b5d8</scmSyncId> <scmSyncName>testScmSync1</scmSyncName> <branch>next</branch> <configurationName>my-git-config</configurationName> <configurationProjectName>Default</configurationProjectName> <createTime>2021-11-04T20:15:09.892Z</createTime> <destinationDir>c:\tmp</destinationDir> <gitWebhookRepository>Repo</gitWebhookRepository> <lastModifiedBy>admin</lastModifiedBy> <modifyTime>2021-11-04T20:15:09.892Z</modifyTime> <owner>admin</owner> <projectName>Default</projectName> <propertySheetId>e8f820e1-3dab-11ec-9379-12f00530b5d8</propertySheetId> <repository>Repo</repository> <resourceName>local</resourceName> <scmType>git</scmType> <syncType>fromScm</syncType> <tracked>1</tracked> <triggerEnabled>0</triggerEnabled> </scmSync> </response>

ec-perl

$<object>->modifyScmSync(<projectName>, <scmSyncName>, {<optionals>});

Example

$ec->modifyScmSync('default' 'testScmSync1', {branch => 'next', configurationName => 'my-git-config', scmType => 'git', syncType => 'fromScm', repository => 'Repo', resourceName => 'local', destinationDir => 'c:\tmp'});

ectool usage

Usage: modifyScmSync <projectName> <scmSyncName> [--branch <branch>] [--clearExcludeObjects <0|1|true|false>] [--clearIncludeObjects <0|1|true|false>] [--configurationName <configurationName>] [--configurationProjectName <configurationProjectName>] [--description <description>] [--destinationDir <destinationDir>] [--excludeObjects excludeObject1 excludeObject2 ...] [--exportParameter exportParameter1 exportParameter2 ...] [--importParameter <var1>=<val1> [<var2>=<val2> ...]] [--includeObjects includeObject1 includeObject2 ...] [--newName <newName>] [--relativePath <relativePath>] [--repository <repository>] [--resourceName <resourceName>] [--scmType <git>] [--syncType <fromScm|toScm>] [--triggerEnabled <0|1|true|false>]

Example

ectool createScmSync 'default' 'testScmSync1' \ --branch 'main' \ --configurationName 'my-git-config' \ --scmType 'git' \ --syncType 'fromScm' \ --repository 'Repo' \ --resourceName 'local' \ --destinationDir 'c:\tmp'

runScmSync

Run the specified source code synchronization object.

Arguments

Argument Name Type Description

projectName

String

(Required) The name of the CloudBees CD/RO project that must be unique among all projects.

scmSyncName

String

(Required) The name of the scmSync object to get.

parsedWebhookData

String

JSON with parsed webhook data to be set on a pipeline/release/procedure run.

webhookData

String

The webhook data to be set on the pipeline/release/procedure run.

webhookHeaders

String

The webhook headers in JSON format to be set on the pipeline/release/procedure run.

Response

<response requestId="1" nodeId="192.168.1.217"> <jobId>cdfde653-3db0-11ec-a9da-12f00530b5d8</jobId> </response>

ec-perl usage

$<object>->runScmSync(<projectName>, <scmSyncName>,{<optionals>});

Example

$cmdr->runScmSync ('default' 'testScmSync1' {webhookData => "test", webhookHeaders => "Test", parsedWebhookData => "\"{\"branch\": \"main\"}\""});

ectool usage

Usage: runScmSync <projectName> <scmSyncName> [--parsedWebhookData <parsedWebhookData>] [--webhookData <webhookData>] [--webhookHeaders <webhookHeaders>]

Example

ectool runScmSync 'default' 'testScmSync1' \ --webhookData "test" \ --webhookHeaders "test" \ --parsedWebhookData "{\"branch\":\"main\"}"