Mirroring a Repository

In DevOps, you can mirror a code repository from GitHub, GitLab, or Bitbucket Cloud.

Mirroring allows you to mirror repositories to and from external sources. You can mirror branches and commits between repositories.

Before using an external repository in DevOps, you must create a connection to the repository. DevOps supports connection to GitHub, GitLab, and Bitbucket Cloud. To integrate with these third-party code repositories, you have to create a personal access token (PAT) in GitHub or GitLab and store the PAT in an Oracle Cloud Infrastructure (OCI) vault. For more information, see Build Source Integration. To integrate with Bitbucket Cloud, you have to create a username and app password and store the password in an OCI vault. See Generating an App Password for Bitbucket Cloud.

An authentication (auth) token is required for each user who uses Git to interact with the code repositories in Oracle Cloud.

Required IAM Policy

Each service in OCI integrates with Identity and Access Management (IAM) for authentication and authorization. For creating dynamic groups and policies for code repositories and external connections, see Code Repository Policies. For more details, see DevOps IAM Policies.

For accessing DevOps using the Oracle Cloud Console, REST API, and CLI, see Accessing DevOps.

Using the Console

Before you mirror a repository, you must have a DevOps project.

  1. Open the navigation menu and click Developer Services. Under DevOps, click Projects.
  2. Select a project and click Code Repositories on the left-side menu.
  3. Click Mirror Repository.
  4. Select a connection to an external repository.
  5. For Bitbucket Cloud connection, select a workspace in the repository.
  6. Select a repository.
  7. Select a schedule for synchronizing the repositories. Available options are:
    • Once: The repository is synchronized once after the mirrored repository is created.
    • Default: The repositories are automatically synchronized every 15 minutes after the mirrored repository is created.
    • Custom: Select how often the repositories are synchronized after the mirrored repository is created.
  8. To complete the mirroring process, click Mirror Repository.
To access your mirrored repository:
  1. Open the navigation menu and click Developer Services. Under DevOps, click Projects.
  2. Select a project and click Code Repositories on the left-side menu.
  3. Select a mirrored repository.
  4. You can perform the following actions on the repository, as needed. These options are available in the left-side menu of the repository details page:
    • To view and access all the files and folders in your repository, click Files. Last commit and update details are also available.
    • To view and access all the commits pertaining to the code repository, click Commit. Details such as commit date and author are provided. You can filter the commits by author and date. Each commit is assigned a unique ID, which you can use to track the changes.
    • To compare file changes and commit changes between any two branches in your repository, click Compare. Choose a source and target branch to compare.
    • To view and access all the available branches in your repository, click Branches.
    • To view the various tags that point to specific points in the commits, click Git Tags.
    • To monitor the status of all the operations in progress, click Work Requests.

To clone your code repository, see Cloning a Repository.

Using the CLI

To mirror a repository, run the mirror command:

oci devops repository mirror --repository-id

To get all the commands for repository:

oci devops repository -h

To get all the commands for mirror:

oci devops repository mirror -h

Synchronizing a Repository

The mirrored repository can be synchronized as needed or based on a defined time interval.

  1. Open the navigation menu and click Developer Services. Under DevOps, click Projects.
  2. Select a project and click Code Repositories on the left-side menu.
  3. Click the Actions menu for a mirrored repository that you want to synchronize and select Synchronize now.
    The request to synchronize the repository is successfully submitted. You can check the progress in the work request.
  4. To edit the mirroring interval for scheduled synchronization, click the Actions menu for a mirrored repository and select Edit mirroring interval.
  5. Select a scheduling type. Available options are:
    • None: The repository is not automatically synchronized unless performed manually.
    • Default: The repository is automatically synchronized every 15 minutes.
    • Custom: Select how often the repository has to be synchronized.
  6. Save the changes.
  7. (Optional) To add tags to a repository, click the Actions menu and select Add Tags.

    Tagging is a metadata system that lets you organize and track the resources in your tenancy.

    If you have permission to create a resource, you also have permission to add free-form tags to it.

    To add a defined tag, you must have permission to use the tag namespace.

    For more information, see Resource Tags.