Skip to content

Commit 64219d9

Browse files
committed
Apply migration from 0.17.0 to 0.18.0
=== v0.18.0 ========================================================= Script URL: https://raw.githubusercontent.com/frequenz-floss/frequenz-repo-config-python/v0.18.0/cookiecutter/migrate.py ======================================================================== Removing unused cross-arch testing files... Removed .github/containers/nox-cross-arch Removed .github/containers/test-installation Removed empty .github/containers Updated CONTRIBUTING.md: removed 'Cross-Arch Testing' section ======================================================================== Updating cookiecutter replay file... Updated .cookiecutter-replay.json: added `private_repo=no` replay data ======================================================================== Updating generated CI workflows... ======================================================================== Updating auxiliary GitHub workflows... Updated .github/workflows/black-migration.yaml: use explicit Dependabot migration iteration Updated .github/workflows/repo-config-migration.yaml: use explicit Dependabot migration iteration ======================================================================== Normalizing GitHub Action hashes... Updated .github/workflows/ci-pr.yaml: normalized GitHub Action hashes Updated .github/workflows/ci.yaml: normalized GitHub Action hashes ======================================================================== Updating issue template configuration... Skipped .github/ISSUE_TEMPLATE/config.yml: already up to date ======================================================================== Setting up the gRPC migration workflow... Updated .github/dependabot.yml: replaced old 'grpc' group with grpc-compatible / grpcio-major / protobuf-major; added grpc exclude-patterns to patch Updated .github/workflows/auto-dependabot.yaml: skip the new grpc Dependabot groups Created .github/workflows/grpc-migration.yaml Ruleset 'Protect version branches' already requires the grpc check ======================================================================== Fixing nox test path typo in CONTRIBUTING.md... Updated CONTRIBUTING.md: fixed nox 'test/' -> 'tests/' typo ======================================================================== Adjusting CONTRIBUTING.md release section for repo privacy... Skipped CONTRIBUTING.md: public repository, no change needed ======================================================================== Excluding submodules from black for API projects... Updated pyproject.toml: excluded submodules/ from black via extend-exclude ======================================================================== Setting up the isort migration workflow... Created .github/workflows/isort-migration.yaml Updated .github/workflows/auto-dependabot.yaml: skip individual isort bump PRs Updated .github/dependabot.yml: added 'isort' to exclude-patterns of patch and minor ======================================================================== Excluding submodules from isort for API projects... Updated pyproject.toml: added isort skip_glob for submodules/ ======================================================================== ✅ Migration script finished successfully ✅ Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
1 parent 5b05f79 commit 64219d9

14 files changed

Lines changed: 239 additions & 108 deletions

.cookiecutter-replay.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"keywords": "cloud, microgrid",
99
"github_org": "frequenz-floss",
1010
"license": "MIT",
11+
"private_repo": "no",
1112
"author_name": "Frequenz Energy-as-a-Service GmbH",
1213
"author_email": "floss@frequenz.com",
1314
"python_package": "frequenz.api.reporting",
@@ -35,6 +36,10 @@
3536
"MIT",
3637
"Proprietary"
3738
],
39+
"private_repo": [
40+
"{{ 'yes' if cookiecutter.license == 'Proprietary' else 'no' }}",
41+
"{{ 'no' if cookiecutter.license == 'Proprietary' else 'yes' }}"
42+
],
3843
"author_name": "Frequenz Energy-as-a-Service GmbH",
3944
"author_email": "floss@frequenz.com",
4045
"python_package": "{{cookiecutter | python_package}}",

.github/containers/nox-cross-arch/arm64-ubuntu-20.04-python-3.11.Dockerfile

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/containers/nox-cross-arch/entrypoint.bash

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/containers/test-installation/Dockerfile

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ updates:
2929
exclude-patterns:
3030
# pydoclint has shipped breaking changes in patch updates often
3131
- "pydoclint"
32+
# These need a migration script to fix Dependabot not updating the
33+
# runtime dependencies
34+
- "grpcio"
35+
- "grpcio-tools"
36+
- "protobuf"
37+
- "isort"
3238
minor:
3339
update-types:
3440
- "minor"
@@ -48,6 +54,7 @@ updates:
4854
- "protobuf"
4955
- "pydoclint"
5056
- "pytest-asyncio"
57+
- "isort"
5158
# We group repo-config updates as it uses optional dependencies that are
5259
# considered different dependencies otherwise, and will create one PR for
5360
# each if we don't group them.
@@ -63,10 +70,28 @@ updates:
6370
# We group grpcio and protobuf updates together, as they need special
6471
# handling on the pyproject.toml file because of the protobuf/grpcio
6572
# build/runtime cross-version guarantees
66-
grpc:
73+
# We group grpcio and protobuf updates together, as they need special
74+
# handling on the pyproject.toml file because of the protobuf/grpcio
75+
# build/runtime cross-version guarantees and wrong dependabot handling
76+
# of build/runtime dependencies.
77+
grpc-compatible:
78+
update-types:
79+
- "patch"
80+
- "minor"
81+
patterns:
82+
- "grpcio"
83+
- "grpcio-tools"
84+
- "protobuf"
85+
# For major updates we split it up. It was observed in the past that
86+
# grpcio releases lag behind protobuf releases, and they are not
87+
# compatible with a major protobuf update for a while, so we shouldn't
88+
# block the update of one with the other.
89+
grpcio-major:
6790
patterns:
6891
- "grpcio"
6992
- "grpcio-tools"
93+
protobuf-major:
94+
patterns:
7095
- "protobuf"
7196

7297
- package-ecosystem: "github-actions"

.github/workflows/auto-dependabot.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ jobs:
2323
if: >
2424
github.actor == 'dependabot[bot]' &&
2525
!contains(github.event.pull_request.title, 'the repo-config group') &&
26-
!contains(github.event.pull_request.title, 'Bump black from ')
26+
!contains(github.event.pull_request.title, 'the grpc-compatible group') &&
27+
!contains(github.event.pull_request.title, 'the grpcio-major group') &&
28+
!contains(github.event.pull_request.title, 'the protobuf-major group') &&
29+
!contains(github.event.pull_request.title, 'Bump black from ') &&
30+
!contains(github.event.pull_request.title, 'Bump isort from ')
2731
runs-on: ubuntu-slim
2832
steps:
2933
- name: Generate GitHub App token

.github/workflows/black-migration.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
# Read/update pull request metadata and labels.
6767
permission-pull-requests: write
6868
- name: Migrate
69-
uses: frequenz-floss/gh-action-dependabot-migrate@b389f72f9282346920150a67495efbae450ac07b # v1.1.0
69+
uses: frequenz-floss/gh-action-dependabot-migrate@27763fb5eb56476d91abe00132e8a0614171f92f # v1.2.0
7070
with:
7171
migration-script: |
7272
import os
@@ -81,6 +81,7 @@ jobs:
8181
subprocess.run([sys.executable, "-Im", "black", "."], check=True)
8282
token: ${{ steps.create-app-token.outputs.token }}
8383
auto-merge-on-changes: "false"
84+
version-iteration: "false"
8485
sign-commits: "true"
8586
auto-merged-label: "tool:auto-merged"
8687
migrated-label: "tool:black:migration:executed"

.github/workflows/ci-pr.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Setup Git
24-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
24+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
2525

2626
- name: Fetch sources
2727
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -57,15 +57,15 @@ jobs:
5757
runs-on: ubuntu-24.04
5858
steps:
5959
- name: Setup Git
60-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
60+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
6161

6262
- name: Fetch sources
6363
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6464
with:
6565
submodules: true
6666

6767
- name: Setup Python
68-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
68+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
6969
with:
7070
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
7171
dependencies: .[dev-mkdocs]

.github/workflows/ci.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
steps:
3535
- name: Setup Git
36-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
36+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
3737

3838
- name: Fetch sources
3939
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -106,15 +106,15 @@ jobs:
106106

107107
steps:
108108
- name: Setup Git
109-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
109+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
110110

111111
- name: Fetch sources
112112
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
113113
with:
114114
submodules: true
115115

116116
- name: Setup Python
117-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
117+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
118118
with:
119119
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
120120
dependencies: build
@@ -145,7 +145,7 @@ jobs:
145145

146146
steps:
147147
- name: Setup Git
148-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
148+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
149149

150150
- name: Print environment (debug)
151151
run: env
@@ -171,7 +171,7 @@ jobs:
171171
> pyproject.toml
172172
173173
- name: Setup Python
174-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
174+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
175175
with:
176176
python-version: ${{ matrix.python }}
177177
dependencies: dist/*.whl
@@ -204,15 +204,15 @@ jobs:
204204
runs-on: ubuntu-24.04
205205
steps:
206206
- name: Setup Git
207-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
207+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
208208

209209
- name: Fetch sources
210210
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
211211
with:
212212
submodules: true
213213

214214
- name: Setup Python
215-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
215+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
216216
with:
217217
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
218218
dependencies: .[dev-mkdocs]
@@ -244,15 +244,15 @@ jobs:
244244
contents: write
245245
steps:
246246
- name: Setup Git
247-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
247+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
248248

249249
- name: Fetch sources
250250
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
251251
with:
252252
submodules: true
253253

254254
- name: Setup Python
255-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
255+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
256256
with:
257257
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
258258
dependencies: .[dev-mkdocs]
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Automatic grpc/protobuf build/runtime sync for Dependabot PRs
2+
#
3+
# The template's `pyproject.toml` pins `protobuf`, `grpcio` and `grpcio-tools`
4+
# in `[build-system].requires` as *exact* versions, and also declares
5+
# `protobuf` and `grpcio` in `[project].dependencies` with a `>= <build-pin>`
6+
# lower bound. The lower bound must always match the exact pin, because the
7+
# protobuf cross-version runtime guarantee requires the runtime to be at
8+
# least the version used at generation time:
9+
# https://protobuf.dev/support/cross-version-runtime-guarantee/
10+
#
11+
# Dependabot correctly bumps `[build-system].requires`, but it does not bump
12+
# the matching `>=` floor in `[project].dependencies`. This workflow runs
13+
# after a Dependabot grpc/protobuf group PR, rewrites the `>=` floor to match
14+
# the new build pins, and pushes the fix-up commit back onto the PR branch.
15+
#
16+
# The companion auto-dependabot workflow skips the `grpc-compatible`,
17+
# `grpcio-major` and `protobuf-major` groups so those PRs are handled
18+
# exclusively by this migration workflow.
19+
#
20+
# XXX: !!! SECURITY WARNING !!!
21+
# pull_request_target has write access to the repo, and can read secrets.
22+
# This is required because Dependabot PRs are treated as fork PRs: the
23+
# GITHUB_TOKEN is read-only and secrets are unavailable with a plain
24+
# pull_request trigger. The action mitigates the risk by:
25+
# - Never executing code from the PR (the migration script is fetched
26+
# from the repo-config branch configured below, not taken from the PR).
27+
# - Gating migration steps on github.actor == 'dependabot[bot]' AND the
28+
# PR title.
29+
# - Running checkout with persist-credentials: false and isolating
30+
# push credentials from the migration script environment.
31+
# For more details read:
32+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
33+
34+
name: gRPC Migration
35+
36+
on:
37+
merge_group: # To allow using this as a required check for merging
38+
pull_request_target:
39+
types: [opened, synchronize, reopened, labeled, unlabeled]
40+
41+
permissions:
42+
# Commit the sync-up to the PR branch.
43+
contents: write
44+
# Create and normalize migration state labels.
45+
issues: write
46+
# Read/update pull request metadata and comments.
47+
pull-requests: write
48+
49+
jobs:
50+
grpc-migration:
51+
name: Fix gRPC/protobuf runtime floors
52+
# Skip if it was triggered by the merge queue. We only need the workflow to
53+
# be executed to meet the "Required check" condition for merging, but we
54+
# don't need to actually run the job, having the job present as Skipped is
55+
# enough.
56+
if: |
57+
github.event_name == 'pull_request_target' &&
58+
github.actor == 'dependabot[bot]' &&
59+
(contains(github.event.pull_request.title, 'the grpc-compatible group') ||
60+
contains(github.event.pull_request.title, 'the grpcio-major group') ||
61+
contains(github.event.pull_request.title, 'the protobuf-major group'))
62+
runs-on: ubuntu-24.04
63+
steps:
64+
- name: Generate token
65+
id: create-app-token
66+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
67+
with:
68+
app-id: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_ID }}
69+
private-key: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_PRIVATE_KEY }}
70+
# Push the sync-up commit to the PR branch.
71+
permission-contents: write
72+
# Create and normalize migration state labels.
73+
permission-issues: write
74+
# Read/update pull request metadata and labels.
75+
permission-pull-requests: write
76+
- name: Migrate
77+
uses: frequenz-floss/gh-action-dependabot-migrate@27763fb5eb56476d91abe00132e8a0614171f92f # v1.2.0
78+
with:
79+
script-url-template: >- # v0.18.0
80+
https://raw.githubusercontent.com/frequenz-floss/frequenz-repo-config-python/529d30b554392e6d8b66e84e92c04ac9cd170da7/cookiecutter/scripts/dependabot-grpc-fixer.py
81+
token: ${{ steps.create-app-token.outputs.token }}
82+
version-iteration: "false"
83+
sign-commits: "true"
84+
auto-merged-label: "tool:auto-merged"
85+
migrated-label: "tool:grpc:migration:executed"
86+
intervention-pending-label: "tool:grpc:migration:intervention-pending"
87+
intervention-done-label: "tool:grpc:migration:intervention-done"

0 commit comments

Comments
 (0)