forge

Renovate Configuration: Centralized vs. Per-Repository

This document compares two approaches for configuring Renovate: centralized configuration and per-repository configuration. Both approaches have distinct advantages and drawbacks, and the best choice depends on your team’s needs and the structure of your repositories.


Centralized Configuration

Centralized configuration allows you to define Renovate settings in one place, which applies across multiple repositories. This method is ideal for teams that need consistent behavior across repositories, reducing the need for repeated configuration and simplifying maintenance.

Example: Centralized Configuration

{
    "packageRules": [
        {
            "matchDatasources": [
                "terraform-provider"
            ],
            "registryUrls": [
                "https://registry.opentofu.org"
            ],
            "postUpgradeTasks": {
                "commands": [
                    "./scripts/update-terraform-docs.sh"
                ],
                "fileFilters": [
                    "modules/**/*"
                ],
                "executionMode": "update"
            }
        }
    ]
}

Benefits of Centralized Configuration

Limitations of Centralized Configuration


Per-Repository Configuration

Per-repository configuration allows each repository to have its own renovate.json file with custom settings. This approach is beneficial when individual repositories require unique tasks, scripts, or behaviors that can’t be generalized.

Example: Per-Repository Configuration

{
    "packageRules": [
        {
            "matchDatasources": [
                "terraform-provider"
            ],
            "registryUrls": [
                "https://registry.opentofu.org"
            ],
            "postUpgradeTasks": {
                "commands": [
                    "./scripts/update-terraform-docs.sh"
                ],
                "fileFilters": [
                    "modules/**/*"
                ],
                "executionMode": "update"
            }
        }
    ]
}

Benefits of Per-Repository Configuration

Limitations of Per-Repository Configuration


Trade-offs: Centralized vs. Per-Repository Configuration

Aspect Centralized Configuration Per-Repository Configuration
Maintenance Easier to maintain due to a single configuration. Requires maintaining separate files for each repository.
Flexibility Less flexible, as all repositories share the same behavior. Highly flexible, allowing for tailored behavior per repository.
Consistency Ensures consistent behavior across repositories. Potential for inconsistencies across repositories.
Scalability Scales well for repositories with similar requirements. More difficult to scale due to the need for individual configurations.

When to Use Centralized Configuration

When to Use Per-Repository Configuration


Conclusion

Carefully consider the structure of your repositories and your team’s workflows to decide which configuration approach aligns best with your needs.