namely/docker-protoc

Add Renovate Bot to automatically update variables.sh

Closed this issue ยท 6 comments

As discussed in PR #277, you can add a Renovate Bot configuration, and use the Renovate Bot GitHub App to execute the configuration.

Here's some basic example config, how you could use the custom regex manager to automatically create PRs like I did for the gRPC-web dependency.

Example Renovate Configuration for `namely/docker-protoc`

You'd place this file in the root of the repository and name it renovate.json5.

{
  platform: "github",
  baseBranches: [
    "master"
  ],
  extends: [
    // A lot of default settings that you can extend can be found in the presets section: https://docs.renovatebot.com/presets-compatibility/
    ":ignoreModulesAndTests"
  ],
  enabledManagers: [
    // In this example I only enable the manager 'regex' here (see the matchManagers in the packageRules section below)
    // If you need more, see https://docs.renovatebot.com/modules/manager/
    "regex"
  ],
  "regexManagers": [
    {
      "fileMatch": [
        "variables.sh$"
      ],
      "matchStrings": [
        // named capturing group, must include 'currentValue' as the name
        "GRPC_WEB_VERSION=\\$\\{GRPC_WEB_VERSION:-(?<currentValue>[\\d.]*?)\\}\\n"
      ],
      // the name of the dependency in the package manager
      "depNameTemplate": "grpc-web",
      // which package manager should Renovate Bot look to find this dependency?
      "datasourceTemplate": "npm"
    },
    {
      "fileMatch": [
        "variables.sh$"
      ],
      "matchStrings": [
        "NODE_PROTOC_GEN_GRPC_WEB_VERSION=\\$\\{NODE_PROTOC_GEN_GRPC_WEB_VERSION:-(?<currentValue>[\\d.]*?)\\}\\n"
      ],
      "depNameTemplate": "grpc-web",
      // see data source identifiers here: https://docs.renovatebot.com/modules/datasource
      "datasourceTemplate": "npm"
    }
  ],
  packageRules: [
    // here you can define how dependency updates should be grouped in one or multiple PRs
    // what is defined below, means you'll get 2 PRs at max, containing all minor / patch updates in one PR
    // and all major updates in another PR
    {
      matchManagers: [
        "regex"
      ],
      matchPackagePatterns: [
        "*"
      ],
      matchUpdateTypes: [
        "minor",
        "patch"
      ],
      groupName: "protoc dependencies",
      groupSlug: "non-major-protoc"
    },
    {
      matchManagers: [
        "regex"
      ],
      matchPackagePatterns: [
        "*"
      ],
      matchUpdateTypes: [
        "major"
      ],
      groupName: "protoc major dependencies",
      groupSlug: "protoc"
    }
  ]
}

@ido-namely tagging you to continue our chat we had in PR #277

@ido-namely tagging you to continue our chat we had in PR #277

Thank you @trietsch, I appreciate it. I'll take a look

This is pretty cool - ido-namely#1

Awesome, seems like I had the regex pattern first time right ๐Ÿ˜
If you have other questions, feel free to ask them.

Awesome, seems like I had the regex pattern first time right ๐Ÿ˜ If you have other questions, feel free to ask them.

Hey @trietsch ,
I've been trying to play some more the the renovate configuration options and I was wondering if you can help me with configuring the grpc version.

The problem is that on the one hand we only keep the version up to the minor version, while we fetch new versions (from github release) which includes a patch version as well.

This is what I came up with so far but couldn't get it to work.

Thanks in advance and no worries if you don't have the time for it atm.

Hey @ido-namely , great that you're looking into Renovate bot :)
I'm actually afk for the next few weeks, but I had a quick glance at your renovate config and it looks like you're on the right path. The Renovate bot authors are very helpful in GitHub discussions. I propose to create a MWE and post a question over there.
If you haven't succeeded in the next coming weeks, I can have a look then. Good luck ๐Ÿคž