Repository mirroring is a feature in Code Studio. With this feature, you can synchronize your Code Studio git repository with an external repository managed by another git provider.
Similar to any mirroring activity, a repository can be mirrored in two directions:
Currently, Code Studio only supports mirroring out to another git repository. However, it is possible to facilitate the process of mirroring another repository into Code Studio using an existing, non-Code Studio CI/CD solution.
This method of mirroring Code Studio out to another repository is also called a “push.”
Repository mirroring is configured in the Settings of your Code Studio account, which requires administrative permissions to access. These permissions are available with the Owner role in Code Studio. For more information, see Code Studio user roles.
To set up mirroring Code Studio out to another repository:
Log in to your target repository.
This is the target repository where you will mirror your Code Studio project.
Generate an access token.
You will later use this token instead of your password.
Click Mirror repository.
Verify that the Mirrored repositories table displays your repository.
Click Sync, which is the circular arrows icon to the far right of the table.
Verify that the mirroring process is functioning.
Repository mirroring is now configured. Any commits made into your Code Studio repository are now automatically mirrored or pushed out to your external repository.
For a complete tutorial on this configuration, see Code Studio: Repository Mirroring.
The following is an example for mirroring a Bitbucket repository into Code Studio. This methodology can be adapted for use with most git and CI/CD providers.
You must authenticate Code Studio with BitBucket if you want Code Studio to pull code from a private BitBucket repository. You can use multiple ways for authentication. Acquia recommends you to follow this tutorial.
After you set up your Code Studio account and configure your workflow, complete the following instructions to set up repository mirroring with BitBucket:
bitbucket-pipelines.yml file.Push the yml file to Bitbucket.
This runs the pipeline and fails.
gitcode.acquia.com.Click Add key.
The system adds the key.
Review the following yml file example and adjust the code to your needs:
Any subsequent commits and creation/deletion of a branch are mirrored to Code Studio.
This only mirrors git history. It does not mirror any metadata generated in BitBucket such as issues and comments in PRs.
clone:
depth: full
pipelines:
default:
- step:
script:
- git branch
- git push --force [email protected]:<CLIENT_GROUP>/<ACQUIA_PROJECT> $BITBUCKET_BRANCHbitbucket-pipelines.yml file.Commit the file.
A pipeline process starts. This time it should succeed.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
clone:
depth: full
pipelines:
default:
- step:
script:
- git branch
- git push --force [email protected]:<CLIENT_GROUP>/<ACQUIA_PROJECT> $BITBUCKET_BRANCHbitbucket-pipelines.yml file.Commit the file.
A pipeline process starts. This time it should succeed.
If this content did not answer your questions, try searching or contacting our support team for further assistance.