Code Repository Settings

Configure repository settings.

    1. Open the navigation menu and click Developer Services. Under DevOps, click Projects.
    2. Select a project and from the left-side menu, click Code Repositories.
    3. Select a code repository and then click the Settings link on the left-side menu.
      Note

      Only admins can view or update the repository settings.
    4. Following repository settings can be configured:
      1. Merge check: Specify conditions that must be satisfied before a PR is allowed to merge to a target branch. Select the Build status check checkbox to validate if the last build from each triggered pipeline run was successful and there aren't any builds in-progress. This check is applicable if you have configured to trigger the build run when you commit the changes to a code repository.
      2. Merge strategy: Configure a list of merge strategies that are provided to users when they merge a PR. Available merge strategies to configure are:
        1. Merge commit (Enabled by default): Merge commit is created, even if the source branch is up-to-date with the target branch.

        2. Fast-forward: Merge commit is created if the source branch is out of date with the target branch. Else, the target branch is updated to the latest commit on the source branch.

        3. Fast-forward only: The merge request is rejected, if the source branch is out of date with the target branch. Else, the target branch is updated to the latest commit on the source branch.

        4. Rebase and fast-forward: Source branch changes are committed onto the target branch, creating a new commit. The new commits are fast-forwarded, which doesn't impact the pull request branch.

        5. Squash: All commits are combined to form a single commit on the target branch.

        6. Squash, fast-forward only: The merge request is rejected, if the source branch is out of date with the target branch. Else, all commits are combined to form a single commit on the target branch.

        7. Rebase and merge: Source branch changes are committed onto the target branch, creating a new commit. A merge commit is created to update the target branch, which doesn't impact the pull request branch.

      3. Approval rules: Defaults from the project settings but can be overriden. Click Add approval rule to define new rules. Enter rule name, select approvers, target branch or commit Id, and specifiy the minimum number of approvals required. You can define upto 30 rules for a repository.
      4. Branch protection: Define rules that restrict certain operations on a target branch. Click Add branch protection and select a target branch to protect. Following options are available:
        1. Pull request merge only: The target branch let changes only from a pull request to be merged. All other merges are rejected. This option is selected by default.
        2. Read only: User can't merge any changes to the target branch. They only have read access.
  • To update repository settings, run the update-repository-settings command:

    oci devops repository update-repository-settings --repository-id --merge-checks --approval-rules --merge-settings

    To delete repository settings, run the delete-repository-settings command:

    oci devops repository delete-repository-settings --repository-id

    To get repository settings, run the get-repository-settings command:

    oci devops repository get-repository-settings --repository-id

    To get repository notification preference, run the get-repository-notification-preference command

    oci devops repository get-repository-notification-preference --principal-id --repository-id

    To update repository notification preference, run the update-repository-notification-preference command:

    oci devops repository update-repository-notification-preference --notification-preference --principal-id --repository-id

    To create or update a protected branch, run the create-or-update command:

    oci devops protected-branch create-or-update --branch-name --protection-levels --repository-id

    To delete a protected branch, run the delete command:

    oci devops protected-branch delete --branch-name --repository-id

    To list protected branches, run the list-protected-branches command:

    oci devops protected-branch list-protected-branches --repository-id --limit --name --page --page-size --sort-by --sort-order
  • To retrieve a repository setting details, use the GetRepositorySettings operation.

    To update a repository setting details, use the UpdateRepositorySettings operation.

    To delete a repository settings, use the DeleteRepositorySettings operation.