Skip to content

Commit e1232d4

Browse files
authored
Migrate to self-hosted renovate (#4010)
In order to properly run renovate with python dependencies that require system packages (see [failure](#4432 (comment))) we have to run renovate as [self-hosted](https://docs.renovatebot.com/examples/self-hosting/) and embed the dependencies needed in the renovate runner to be able to run `uv sync`. A breakdown of how this works: - `containers/Containerfile.renovate`: Inherits from upstream [renovate image](https://github.com/renovatebot/renovate/blob/main/tools/docker/Dockerfile) aka ghcr.io/renovatebot/renovate - `build-and-publish-renovate.yml`: Whenever the file above is updated or if run manually, this workflow build the container as `renovate-tmt:latest` and publishes it to this repo's [github container respository](https://github.com/teemtee/tmt/pkgs/container/renovate-tmt) - `renovate.yml`: Using the container above, this workflow basically runs renovate itself using the `renovate-config.json` for the runner, after which it is equivalent with the hosted renovate - In order for Github Actions to be run on PRs created by a different github action, a token other than `${github.token}` must be used. In this case a Github app will be created and owned at the teemtee organization which is then fed into `actions/create-github-app-token` to get the final token that renovate would be using. See [renovatebot/github-action example](https://github.com/renovatebot/github-action?tab=readme-ov-file#example-with-github-app) for more explanation Besides the workflow above, to make sure everything is working correctly this PR reconfigures `renovate.json` as well: - Simplify the `Documentation Dependencies` flow. Something is probably still missing to properly make the PRs for these, but will continue this work afterwards - Drop the hatch devDependencies - Enable the python dependency update for everything. This probably needs more fine-tuning probably with [`lockFileMaintenance`](https://docs.astral.sh/uv/guides/integration/dependency-bots/#renovate) --------- Signed-off-by: Cristian Le <git@lecris.dev>
1 parent 3091c54 commit e1232d4

5 files changed

Lines changed: 101 additions & 17 deletions

File tree

.github/renovate-config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"configValidationError": true,
3+
"prHourlyLimit": 0,
4+
"onboarding": false,
5+
"platform": "github",
6+
"repositories": [
7+
"teemtee/tmt"
8+
]
9+
}

.github/renovate.json

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
44
"config:recommended",
5-
"schedule:weekly",
65
":enablePreCommit",
76
":semanticCommitsDisabled"
87
],
@@ -36,29 +35,17 @@
3635
"matchManagers": ["pre-commit"]
3736
},
3837
{
39-
"description": "Disable all python dependencies. Specific matchers will be used.",
40-
"matchManagers": ["pep621"],
41-
"enabled": false
38+
"description": "Python dependencies with lockfile",
39+
"groupName": "Locked dependencies",
40+
"matchManagers": ["pep621"]
4241
},
4342
{
4443
"description": "Group documentation dependencies together",
4544
"groupName": "Documentation Dependencies",
4645
"matchManagers": ["pep621"],
4746
"matchDepTypes": ["project.optional-dependencies"],
4847
"enabled": true,
49-
"matchPackageNames": [
50-
"/renku-sphinx-theme/",
51-
"/sphinx/",
52-
"/readthedocs-sphinx-ext/",
53-
"/docutils/"
54-
]
55-
},
56-
{
57-
"description": "Group hatch dev dependencies together",
58-
"groupName": "hatch dev Dependencies",
59-
"matchManagers": ["pep621"],
60-
"matchDepTypes": ["tool.hatch.envs.dev"],
61-
"enabled": true
48+
"matchJsonata": ["managerData.depGroup = 'docs'"]
6249
}
6350
]
6451
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build and publish renovate image
2+
on:
3+
push:
4+
paths:
5+
- containers/Containerfile.renovate
6+
branches: [main]
7+
workflow_dispatch:
8+
inputs:
9+
ref:
10+
description: Committish to build and publish
11+
required: true
12+
13+
permissions: {}
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
packages: write
20+
steps:
21+
- uses: actions/checkout@v6
22+
with:
23+
ref: ${{ inputs.ref }}
24+
- uses: redhat-actions/buildah-build@v2
25+
with:
26+
image: renovate-tmt
27+
containerfiles: ./containers/Containerfile.renovate
28+
- uses: redhat-actions/push-to-registry@v2
29+
with:
30+
image: renovate-tmt
31+
tags: latest
32+
registry: ghcr.io/teemtee
33+
username: ${{ github.actor }}
34+
password: ${{ github.token }}

.github/workflows/renovate.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Renovate
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- containers/Containerfile.renovate
8+
- .github/workflows/renovate.yml
9+
- .github/workflows/build-and-publish-renovate.yml
10+
schedule:
11+
# Weekly on Friday
12+
- cron: 0 0 * * 5
13+
14+
# Note that the real permissions are being handled by actions/create-github-app-token,
15+
# this only affects the other steps like actions/checkout
16+
permissions: {}
17+
18+
jobs:
19+
renovate:
20+
environment: renovate
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v6
24+
- name: Get GitHub App token
25+
id: token
26+
uses: actions/create-github-app-token@v3
27+
with:
28+
client-id: ${{ secrets.RENOVATE_BOT_CLIENT_ID }}
29+
private-key: ${{ secrets.RENOVATE_BOT_PRIVATE_KEY }}
30+
owner: ${{ github.repository_owner }}
31+
- uses: renovatebot/github-action@v44.2.0
32+
with:
33+
configurationFile: .github/renovate-config.json
34+
token: '${{ steps.token.outputs.token }}'
35+
renovate-image: ghcr.io/teemtee/renovate-tmt
36+
renovate-version: latest
37+
env:
38+
LOG_LEVEL: ${{ runner.debug == '1' && 'debug' || 'info' }}

containers/Containerfile.renovate

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM ghcr.io/renovatebot/renovate:42
2+
3+
# Changing user to root and back to run the apt-get commands
4+
USER root
5+
6+
# hadolint ignore=DL3008,DL3015
7+
RUN apt-get update && \
8+
apt-get install -y \
9+
libvirt-dev \
10+
libkrb5-dev \
11+
libpq-dev && \
12+
rm -rf /var/lib/apt/lists/*
13+
14+
# Changing back to the user defined in the original renovate image
15+
# Last known source location: https://github.com/renovatebot/renovate/blob/main/tools/docker/Dockerfile
16+
USER 12021

0 commit comments

Comments
 (0)