This plugin helps you mirror external git repository to Harness Code Repository
Example
kind: pipeline
name: default
steps:
- steps:
name: mirror_repo
image: plugins/mirror_plugin
settings:
anonymous: false
source_token: pat.token
source_url: https://github.com/octocat/Hello-World.git
target_token: pat.token.target
target_url: https://git.harness.io/accountId/orgId/projectId/repo_name.git
reference: refs/head/main
Properties
anonymous
booleanoptionalFlag to skip passing source token if the source repo is public
Default: false
source_token
stringoptionalAccess token for the source repo.
Secret recommendedDefault: none
source_url
stringrequiredThe https-format clone URL for the source repo.
Default: none
target_token
stringrequiredAccess token for the target repo.
Secret recommendedDefault: none
target_url
stringrequiredThe https-format clone URL for the target repo.
Default: none
reference
stringrequiredThe full reference path to sync from source to target, such as 'refs/heads/main' for branches and 'refs/tags/v.1.2.3' for tags
Default: none
reference_sha_old
stringoptionalThe previous value of the 'reference' on the source repo. For example, on a branch update, the 'referenceShaOld' is the old SHA of the branch before the update. If provided, this value's usage depends on the change on the reference If the reference was deleted and the old SHA is provided, the reference is deleted on the target repo only if has the same value on the target repo. If the old SHA isn't provided, the reference is deleted on the target repo without any further checks. If the reference was updated, the old SHA is used to update the reference by either fast forward or force update if the reference has the same value on the target repo. For example, after force pushing changes to the source repo, fast forward to source isn't possible. Providing the old SHA ensures mirroring overwrites the target only if the reference in the target repo has the same value as the source repo's reference before the force push. If the old SHA isn't provided, only fast forward updates of a reference are possible and force updates fail to sync.
Default: none
sync_delete
booleanoptionalIndicates if deletion of a branch or tag reference on the source repo should be synced to the target repo. Set to true to delete branches/tags in the target repo when they are deleted in the source repo. Set to false to block such deletions from being mirrored in the target. Default is false. This applies to branch and tag deletions only. Deleting files is considered a reference update, which is not impacted by this flag.
Default: false