Skip to content

Commit ddcb1d2

Browse files
ido-namelyrenovate[bot]nycdotnet
authored
Enhance Renovate configuration (#314)
* Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update Dockerfile.tmpl * Update Dockerfile * Update variables.sh * Delete go.sum.tmpl * Update generate_gateway.sh * Update Dockerfile * Update renovate.json5 * Update renovate.json5 * Update renovate.json5 * Update Dockerfile * Update go.mod.tmpl * Update renovate.json5 * chore(deps): update dependency google.golang.org/grpc to v1.47.0 * Update Dockerfile.tmpl * Update renovate.json5 * Update variables.sh * Add readme for Renovate * readme fixes * Update .github/README.md Co-authored-by: Steve Ognibene <steve.ognibene@namely.com> * Update .github/README.md Co-authored-by: Steve Ognibene <steve.ognibene@namely.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Steve Ognibene <steve.ognibene@namely.com>
1 parent f8c9fff commit ddcb1d2

8 files changed

Lines changed: 167 additions & 608 deletions

File tree

.github/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Renovate Configuration
2+
3+
## What is Renovate?
4+
5+
[Renovate](https://www.mend.io/free-developer-tools/renovate/) is an open-source dependency manager.
6+
The `Renovate` Github app is configured to automatically open PRs in an attempt to update configured dependencies of different kinds.
7+
The configuration is managed in [renovate.json5](./renovate.json5).
8+
9+
## How does Renovate work?
10+
11+
`Renovate` is able to automatically identify dependencies of different kinds in different files and start opening PRs once a basic configuration file is found in the repo and the app is enabled. `Renovate` has a lot of different configuration options beyond the supported dependencies which are well documented [here](https://docs.renovatebot.com/).
12+
13+
However, in cases such as this repo where the dependencies are managed in proprietary files, additional configuration is required.
14+
15+
## How is Renovate used in this repo?
16+
17+
In this repo, we have a variety of dependencies pinned to specific versions, primarly to create reproducible, testable builds.\
18+
Most of these dependencies are installed in the built docker images and are referenced in [Dockerfile](../Dockerfile). However, their versions are set separately in [variables.sh](../variables.sh), which means most PRs opened by `Renovate` will attempt to update this file.
19+
Because it is a proprietary file, we leverage `Renovate`'s support of using Regular Expressions to find & replace dependencies versions.
20+
21+
The different sources used to find dependencies include `npm`, `Go`, and `Github Releases`.
22+
23+
### Dependencies PR grouping
24+
25+
One of great features of `Renovate` is the ability to group dependency updates into mutual PRs according to different criteria to avoid spamming the repo with too many PRs (1 PR per dependency).
26+
27+
In this repo, we have several groups configured according to specific dependencies and/or dependency types:
28+
29+
* Major/Minor (main) gRPC updates - these dependencies' updates will be opened in one PR. Merging PRs for this dependency group will be followed by releasing new major version in this repo.
30+
31+
* All other minor/patch dependency updates - Usually as long as the tests pass for this PR we should be able to merge & release a new patch version in this repo.
32+
33+
* Go gRPC Gateway module - This dependency is singled out since we cannot update it yet due to a breaking change. Once we do update it, we can move this dependency to the same group as the other non gRPC dependencies.
34+
35+
## How to keep maintaining Renovate in this repo?
36+
37+
If and when adding a new dependency, we should pin its version in `variables.sh` (if applicable), configure it
38+
in `Renovate`'s configuration file and ensure it is grouped correctly.

.github/renovate.json5

Lines changed: 79 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@
44
baseBranches: [
55
"master"
66
],
7+
constraints: {
8+
"go": "1.17"
9+
},
710
extends: [
811
// A lot of default settings that you can extend can be found in the presets section: https://docs.renovatebot.com/presets-compatibility/
9-
":ignoreModulesAndTests"
12+
"config:base"
1013
],
14+
ignorePaths: [],
1115
enabledManagers: [
1216
// Since we only update proprietry files (e.g variables.sh)we should use 'regex' here (see the matchManagers in the packageRules section below)
1317
// If you need more, see https://docs.renovatebot.com/modules/manager/
1418
"regex",
1519
"github-actions",
16-
"gomod"
20+
"gomod",
21+
"npm"
1722
],
23+
"gomod":{
24+
"fileMatch": ["(^|/)go.mod.tmpl$"]
25+
},
1826
regexManagers: [
1927
{
2028
fileMatch: [
@@ -47,25 +55,22 @@
4755
},
4856
{
4957
fileMatch: [
50-
"gwy/templates/go.mod.tmpl$"
58+
"variables.sh$"
5159
],
5260
matchStrings: [
53-
"google.golang.org/grpc\\s+(?<currentValue>.*?)\\n+"
61+
"GRPC_WEB_VERSION=\\$\\{GRPC_WEB_VERSION:-(?<currentValue>.*?)\\}\\n"
5462
],
55-
depNameTemplate: "grpc/grpc-go",
56-
datasourceTemplate: "github-releases",
57-
versioningTemplate: "regex:^v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$",
63+
depNameTemplate: "grpc-web",
64+
datasourceTemplate: "npm"
5865
},
5966
{
6067
fileMatch: [
6168
"variables.sh$"
6269
],
6370
matchStrings: [
64-
// notice we update the same version in two locations perhaps we don't need two separate variables?)
65-
"GRPC_WEB_VERSION=\\$\\{GRPC_WEB_VERSION:-(?<currentValue>.*?)\\}\\n",
6671
"NODE_PROTOC_GEN_GRPC_WEB_VERSION=\\$\\{NODE_PROTOC_GEN_GRPC_WEB_VERSION:-(?<currentValue>.*?)\\}\\n"
6772
],
68-
depNameTemplate: "grpc-web",
73+
depNameTemplate: "protoc-gen-grpc-web",
6974
datasourceTemplate: "npm"
7075
},
7176
{
@@ -79,33 +84,92 @@
7984
datasourceTemplate: "github-releases",
8085
extractVersionTemplate: "^v(?<version>\\d+\\.\\d+\\.\\d+)"
8186
},
87+
{
88+
fileMatch: [
89+
"variables.sh$"
90+
],
91+
matchStrings: [
92+
"GRPC_GATEWAY_VERSION=\\$\\{GRPC_GATEWAY_VERSION:-(?<currentValue>.*?)\\}\\n"
93+
],
94+
depNameTemplate: "github.com/grpc-ecosystem/grpc-gateway/v2",
95+
datasourceTemplate: "go",
96+
},
97+
{
98+
fileMatch: [
99+
"variables.sh$"
100+
],
101+
matchStrings: [
102+
"NODE_GRPC_TOOLS_NODE_PROTOC_TS_VERSION=\\$\\{NODE_GRPC_TOOLS_NODE_PROTOC_TS_VERSION:-(?<currentValue>.*?)\\}\\n"
103+
],
104+
depNameTemplate: "grpc_tools_node_protoc_ts",
105+
datasourceTemplate: "npm",
106+
},
107+
{
108+
fileMatch: [
109+
"variables.sh$"
110+
],
111+
matchStrings: [
112+
"NODE_GRPC_TOOLS_VERSION=\\$\\{NODE_GRPC_TOOLS_VERSION:-(?<currentValue>.*?)\\}\\n"
113+
],
114+
depNameTemplate: "grpc-tools",
115+
datasourceTemplate: "npm",
116+
},
117+
{
118+
fileMatch: [
119+
"^Dockerfile$"
120+
],
121+
matchStrings: [
122+
"GO111MODULE=on go get google\.golang\.org\/grpc@(?<currentValue>.*?)\\s*\\n"
123+
],
124+
depNameTemplate: "google.golang.org/grpc",
125+
datasourceTemplate: "go",
126+
}
82127
],
83128
packageRules: [
84129
// here you can define how dependency updates should be grouped in one or multiple PRs:
85130
// The following means that any major or minor updates to the specified packages will be grouped in one PR,
86131
// and we would like to cut a new major release for our docker image, e.g 1.42_X => 1.46_0
87132
{
88-
matchPackageNames: ["grpc/grpc", "grpc/grpc-java", "grpc/grpc-go"],
133+
matchPackageNames: ["grpc/grpc"],
89134
groupName: "gRPC Version",
90135
matchUpdateTypes: [
91136
"minor",
92137
"major"
93138
],
94139
groupSlug: "gRPC Major Upgrade"
95140
},
141+
{
142+
matchPackageNames: ["grpc/grpc-java", "google.golang.org/grpc"],
143+
groupName: "gRPC Version",
144+
matchUpdateTypes: [
145+
"minor",
146+
"major"
147+
],
148+
"stabilityDays": 10,
149+
groupSlug: "gRPC Major Upgrade"
150+
},
96151
// specifically for grpc-go, a patch version upgrade should be grouped with other misc dependencies, which you can find below.
97152
// This would most likely mean we want to bump the docker image version without bumping the gRPC version, e.g 1.42_0 => 1.42_1
98153
{
99-
matchPackageNames: ["grpc/grpc-go"],
154+
matchPackageNames: ["google.golang.org/grpc"],
100155
matchUpdateTypes: [
101156
"patch"
102157
],
103158
groupName: "Misc Non-major dependencies",
104159
groupSlug: "patch-dependencies"
105160
},
106-
//
107161
{
108-
matchPackageNames: ["grpc-web", "envoyproxy/protoc-gen-validate"],
162+
matchPackageNames: ["grpc-web", "protoc-gen-grpc-web", "envoyproxy/protoc-gen-validate"],
163+
matchUpdateTypes: [
164+
"minor",
165+
"patch"
166+
],
167+
groupName: "Misc Non-major dependencies",
168+
groupSlug: "minor-dependencies"
169+
},
170+
{
171+
matchDatasources: ["go", "npm"],
172+
excludePackageNames: ["github.com/grpc-ecosystem/grpc-gateway/v2", "google.golang.org/grpc"],
109173
matchUpdateTypes: [
110174
"minor",
111175
"patch"
@@ -114,7 +178,7 @@
114178
groupSlug: "minor-dependencies"
115179
},
116180
{
117-
matchPackageNames: ["grpc-web", "envoyproxy/protoc-gen-validate"],
181+
matchPackageNames: ["grpc-web", "protoc-gen-grpc-web", "envoyproxy/protoc-gen-validate"],
118182
matchUpdateTypes: [
119183
"major"
120184
],

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ RUN ( cd ./grpc-go/cmd/protoc-gen-go-grpc && go install . )
7474
# Go get go-related bins
7575
WORKDIR /tmp
7676
RUN set -e && \
77-
GO111MODULE=on go get google.golang.org/grpc@v$grpc_version
77+
GO111MODULE=on go get google.golang.org/grpc@v1.47.0
7878

7979
# install protoc-gen-grpc-gateway and protoc-gen-openapiv2
8080
RUN set -e && \
81-
GO111MODULE=on go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v${grpc_gateway_version} && \
82-
cd /go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@v${grpc_gateway_version}/protoc-gen-grpc-gateway && \
81+
GO111MODULE=on go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${grpc_gateway_version} && \
82+
cd /go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@${grpc_gateway_version}/protoc-gen-grpc-gateway && \
8383
go install .
8484

8585
RUN set -e && \
86-
GO111MODULE=on go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v${grpc_gateway_version} && \
87-
cd /go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@v${grpc_gateway_version}/protoc-gen-openapiv2 && \
86+
GO111MODULE=on go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${grpc_gateway_version} && \
87+
cd /go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@${grpc_gateway_version}/protoc-gen-openapiv2 && \
8888
go install .
8989

9090
RUN go get -u github.com/gogo/protobuf/protoc-gen-gogo
@@ -177,7 +177,7 @@ COPY --from=build /tmp/grpc_web_plugin /usr/local/bin/grpc_web_plugin
177177

178178
COPY --from=build /tmp/protoc-gen-scala /usr/local/bin/
179179

180-
COPY --from=build /go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@v${grpc_gateway_version}/protoc-gen-openapiv2/options /opt/include/protoc-gen-openapiv2/options/
180+
COPY --from=build /go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@${grpc_gateway_version}/protoc-gen-openapiv2/options /opt/include/protoc-gen-openapiv2/options/
181181

182182
COPY --from=build /go/pkg/mod/github.com/envoyproxy/protoc-gen-validate@v${go_envoyproxy_pgv_version}/ /opt/include/
183183

0 commit comments

Comments
 (0)