Setting up default Renovate configuration while allowing overriding of that configuration

Featured image for sharing metadata for article

I've written about how great Renovate is great for managing your dependencies across the toolchains you support, and giving you control over how the updates are made across your repositories.

Although it can be handy for teams owning repositories to have full control over their renovate.json and tweaking which rules are used, sometimes we also want to have some default configuration for teams that aren't "onboarded" to Renovate by having a renovate.json in their repo.

Let's say that we have the requirements:

  • we want to ensure that teams are keeping on top of their Docker and GitLab CI updates
  • we don't want to add a renovate.json to each repository with default configuration, and then keep it up-to-date
  • we want to allow teams to specify their own configuration to override / augment the defaults

We'll create a repository renovate-config in our organisation to store our shared configuration, and in it we'll start by defining the not-onboarded.json preset:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "github>some-org/renovate-config:base",
    "schedule:weekly"
  ],
  "enabledManagers": [
    "dockerfile",
    "docker-compose",
    "kubernetes",
    "gitlabci"
  ]
}

This inherits from base.json, which has some org-wide defaults:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "hostRules": [
    {
      "matchHost": "artifacts.example.com",
      "username": "svc_renovate",
      "password": "..."
    }
  ]
}

Then, when we're configuring Renovate using a config.js, we'll get:

module.exports = {
  requireConfig: "optional",
  onboarding: false,
  extends: [
    "github>some-org/renovate-config:not-onboarded",
  ],
}

This gives us the first two requirements, but how would a team override this to use the preset default.json:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "config:base",
    "github>some-org/renovate-config-presets:base"
  ]
}

Well, in the team's repo, they would create their renovate.json:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "github>some-org/renovate-config"
  ],
  "ignorePresets": [
    "github>some-org/renovate-config-presets:not-onboarded"
  ]
}

Note that you do need the ignorePresets in each repo's renovate.json instead of being able to put it in default.json, as found in this discussion.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #renovate.

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.