Repository governance

更新时间:
复制 MD 格式

Apsara DevOps helps you manage code repositories and standardize your development process. It provides custom repository templates and supports repository standards. These tools enable you to quickly create new repositories that meet specific project standards. You can also enforce strict controls on branch naming and merge operations. This topic describes these two features and explains how to use them to improve team collaboration and project quality.

Repository templates

Repository templates allow you to quickly create new repositories from predefined or custom templates. This helps you reuse existing project structures, code, and branch models. This speeds up project startup and maintains a consistent technology stack. For large organizations, unified standards can significantly reduce communication costs and technical debt.

System templates

The system provides built-in templates for many common programming languages and technology frameworks, such as Spring, Node.js Express, Android, and iOS. You can select a suitable template to initialize a new repository as needed.

Custom templates

In addition to using system templates, you can create custom templates based on your own engineering standards. This is especially important for enterprises that want to strictly enforce internal coding standards or have unique business logic.

For more information, see Repository templates.

Repository standards

Repository standards are designed to enforce constraints on branch naming conventions and merge rules. This ensures that branch management and merge activities within the repository meet enterprise governance requirements. This is crucial for maintaining repository health and improving the efficiency of code reviews. In addition, proper standard configuration can help prevent potential security vulnerabilities.

Set repository standards

Repository administrators can configure repository standards for more granular permission management and flow control. Follow these steps to enable and configure repository standards:

  1. Go to the Settings page of the target repository and select **Repository Standards**. This is a premium feature. You must upgrade to the Premium Edition to use it. Click **Enable Repository Standards**.

  2. Then, select a predefined scheme, such as the GitLab branch standard or the Gitflow branch standard, or create a custom scheme. For a custom scheme, specify the branch type, naming pattern, roles allowed to create branches, and a description. You can also define merge rules between source and destination branches.

  3. The changes take effect immediately and apply to all subsequent branch creations and merge request submissions.

Repository guidelines

After you enable repository standards, automatic compliance checks are triggered when you perform the following two common operations:

  • Create a branch: When a developer tries to create a new branch, the system checks if the name adheres to the configured naming conventions. Any non-compliant attempt is blocked, and a clear prompt is displayed.

  • Create a merge request: Similarly, before a new merge request is created, the system verifies that the request meets the predefined merge path requirements. This restriction does not apply retroactively to existing merge requests in the history.

For more information, see Repository standards.

In summary, repository templates and repository standards help enterprises ensure code quality and security, promote efficient team collaboration, and maintain flexibility.