Skip to content

Commit 61ab79f

Browse files
Automaatkumahq[bot]
authored andcommitted
feat(tools): move to Mise from our custom scripts (#14027)
Introducing [Mise](https://mise.jdx.dev) to Kuma. We already use Mise in projects like `kuma-website` or `kuma-counter-demo`. - With mise we can streamline tools installation for different Kuma versions, which replaces our custom scripts and `make dev/tools` target. - While switching branches for example from release to master mise will automatically enable specified versions of tools which removes need of reinstalling everything always and reduces mistakes while working with older branches - We can now easily update tools version with [Renovate](https://docs.renovatebot.com/modules/manager/mise/) which was now not possible, and we almost never updated them - Mise action cache works much better than our custom cache with `make dev/tools` which will speed up CI a little bit Right now, we don't have any extra dependencies than we have in Kuma but adding them would be easy as you can have multiple config files that mise will merge: https://mise.jdx.dev/configuration.html#configuration - I've previously moved clang-format to separate action so that we don't need to install it on CI. We can safely disable this with `MISE_DISABLE_TOOLS: "clang-format,golangci-lint,skaffold"`. Thanks to this installation of tools take 1 minute at most without cache - we now use GITHUB_TOKEN to avoid rate limit issues we hit on master last time we merged this. Fix: #11770 <!-- > Changelog: skip --> <!-- Uncomment the above section to explicitly set a [`> Changelog:` entry here](https://github.com/kumahq/kuma/blob/master/CONTRIBUTING.md#submitting-a-patch)? --> --------- Signed-off-by: Marcin Skalski <[email protected]>
1 parent 110c317 commit 61ab79f

34 files changed

+4617
-290
lines changed

.github/workflows/_build_publish.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ env:
4040
GH_USER: "github-actions[bot]"
4141
GH_EMAIL: "<41898282+github-actions[bot]@users.noreply.github.com>"
4242
GH_REPO: "charts"
43+
GITHUB_TOKEN: ${{ github.token }}
44+
MISE_DISABLE_TOOLS: "clang-format,golangci-lint,skaffold"
4345
jobs:
4446
build-binaries:
4547
timeout-minutes: 40
@@ -53,13 +55,17 @@ jobs:
5355
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
5456
with:
5557
go-version-file: go.mod
58+
<<<<<<< HEAD
5659
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
5760
with:
5861
path: |
5962
${{ env.CI_TOOLS_DIR }}
6063
key: ${{ runner.os }}-${{ runner.arch }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }}
6164
restore-keys: |
6265
${{ runner.os }}-${{ runner.arch }}-devtools
66+
=======
67+
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
68+
>>>>>>> a10cd165d (feat(tools): move to Mise from our custom scripts (#14027))
6369
- run: |
6470
make build
6571
- run: |
@@ -107,6 +113,7 @@ jobs:
107113
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
108114
with:
109115
go-version-file: go.mod
116+
<<<<<<< HEAD
110117
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
111118
with:
112119
path: |
@@ -116,6 +123,9 @@ jobs:
116123
${{ runner.os }}-${{ runner.arch }}-devtools
117124
- run: |
118125
make dev/tools
126+
=======
127+
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
128+
>>>>>>> a10cd165d (feat(tools): move to Mise from our custom scripts (#14027))
119129
- id: image_meta
120130
run: |
121131
echo "Extracting image meta for ${{ matrix.image }}"
@@ -229,6 +239,7 @@ jobs:
229239
go-version-file: go.mod
230240
cache-dependency-path: |
231241
go.sum
242+
<<<<<<< HEAD
232243
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
233244
with:
234245
path: |
@@ -238,6 +249,9 @@ jobs:
238249
${{ runner.os }}-${{ runner.arch }}-devtools
239250
- run: |
240251
make dev/tools
252+
=======
253+
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
254+
>>>>>>> a10cd165d (feat(tools): move to Mise from our custom scripts (#14027))
241255
- name: package-helm-chart
242256
id: package-helm
243257
env:

.github/workflows/_e2e.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
3434
with:
3535
go-version-file: go.mod
36+
<<<<<<< HEAD
3637
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
3738
with:
3839
path: |
@@ -42,6 +43,12 @@ jobs:
4243
${{ runner.os }}-${{ runner.arch }}-devtools
4344
- run: |
4445
make dev/tools
46+
=======
47+
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
48+
env:
49+
GITHUB_TOKEN: ${{ github.token }}
50+
MISE_DISABLE_TOOLS: "clang-format,golangci-lint,skaffold"
51+
>>>>>>> a10cd165d (feat(tools): move to Mise from our custom scripts (#14027))
4552
- name: "Free up disk space for the Runner"
4653
run: |
4754
echo "Disk usage before cleanup"

.github/workflows/_test.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
2727
with:
2828
go-version-file: go.mod
29+
<<<<<<< HEAD
2930
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
3031
with:
3132
path: |
@@ -35,6 +36,12 @@ jobs:
3536
${{ runner.os }}-${{ runner.arch }}-devtools
3637
- run: |
3738
make dev/tools
39+
=======
40+
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
41+
env:
42+
GITHUB_TOKEN: ${{ github.token }}
43+
MISE_DISABLE_TOOLS: "clang-format,golangci-lint,skaffold"
44+
>>>>>>> a10cd165d (feat(tools): move to Mise from our custom scripts (#14027))
3845
- run: |
3946
make test
4047
gen_e2e_matrix:

.github/workflows/build-test-distribute.yaml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,25 @@ jobs:
4848
with:
4949
go-version-file: go.mod
5050
cache: false
51+
<<<<<<< HEAD
5152
- uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
53+
=======
54+
- name: Set GOMEMLIMIT dynamically based on available memory
55+
id: set-gomemlimit
56+
run: |
57+
# Get total memory in bytes
58+
set -e
59+
mem_total_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
60+
mem_total_bytes=$((mem_total_kb * 1024))
61+
gomemlimit=$((mem_total_bytes * 9 / 10))
62+
echo "GOMEMLIMIT=${gomemlimit}" >> $GITHUB_ENV
63+
echo "Setting GOMEMLIMIT to $(numfmt --to=iec $gomemlimit)"
64+
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
65+
env:
66+
GITHUB_TOKEN: ${{ github.token }}
67+
MISE_DISABLE_TOOLS: "clang-format,golangci-lint,skaffold"
68+
- uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
69+
>>>>>>> a10cd165d (feat(tools): move to Mise from our custom scripts (#14027))
5270
with:
5371
args: --fix=false --verbose
5472
version: v1.60.3
@@ -57,15 +75,6 @@ jobs:
5775
uses: jidicula/clang-format-action@4726374d1aa3c6aecf132e5197e498979588ebc8 # v4.15.0
5876
with:
5977
clang-format-version: '13'
60-
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
61-
with:
62-
path: |
63-
${{ env.CI_TOOLS_DIR }}
64-
key: ${{ runner.os }}-${{ runner.arch }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }}
65-
restore-keys: |
66-
${{ runner.os }}-${{ runner.arch }}-devtools
67-
- run: |
68-
make dev/tools
6978
- run: |
7079
make clean
7180
- run: |
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: "Merge release to master"
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: false
6+
on:
7+
push:
8+
branches: ["release-*"]
9+
workflow_dispatch: {}
10+
permissions:
11+
contents: read
12+
jobs:
13+
release:
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
with:
18+
ref: "master"
19+
fetch-depth: 0
20+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
21+
with:
22+
go-version-file: go.mod
23+
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
24+
env:
25+
GITHUB_TOKEN: ${{ github.token }}
26+
MISE_DISABLE_TOOLS: "clang-format,golangci-lint,skaffold"
27+
- run: |
28+
git config --global user.email "110050114+kumahq[bot]@users.noreply.github.com"
29+
git config --global user.name "kumahq[bot]"
30+
- id: latest-branch
31+
run: |
32+
echo "branch=$(make dev/print-latest-release-branch)" >> $GITHUB_OUTPUT
33+
- run: |
34+
if [[ "refs/heads/${{ steps.latest-branch.outputs.branch }}" == "${{ github.ref }}" ]]; then
35+
make dev/merge-release
36+
fi
37+
- id: commit-changes
38+
run: |
39+
git status
40+
# "git merge HEAD" is the way to check if merge is in progress
41+
if git merge HEAD &> /dev/null; then
42+
echo "skipping commit"
43+
echo "changes=skipped" >> $GITHUB_OUTPUT
44+
else
45+
echo "commit changes"
46+
git commit -s -m "chore(merge): ${{ steps.latest-branch.outputs.branch }} branch to master"
47+
echo "changes=committed" >> $GITHUB_OUTPUT
48+
fi
49+
- name: Generate GitHub app token
50+
id: github-app-token
51+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
52+
with:
53+
app-id: ${{ secrets.APP_ID }}
54+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
55+
- name: "Create Pull Request"
56+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
57+
if: steps.commit-changes.outputs.changes == 'committed'
58+
with:
59+
commit-message: "chore(merge): ${{ steps.latest-branch.outputs.branch }} branch to master"
60+
signoff: true
61+
branch: chore/merge-release-to-master
62+
base: master
63+
delete-branch: true
64+
title: "chore(merge): ${{ steps.latest-branch.outputs.branch }} branch to master"
65+
draft: false
66+
token: ${{ steps.github-app-token.outputs.token }}
67+
committer: kumahq[bot] <110050114+kumahq[bot]@users.noreply.github.com>
68+
author: kumahq[bot] <110050114+kumahq[bot]@users.noreply.github.com>
69+
body: |
70+
**Do NOT squash on merging.** Allow merge commit first in the [repository settings](https://github.com/${{ github.repository }}/settings).
71+
72+
Generated by [action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})

.github/workflows/pr-comments.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
4848
with:
4949
go-version-file: go.mod
50+
<<<<<<< HEAD
5051
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
5152
with:
5253
path: |
@@ -65,6 +66,28 @@ jobs:
6566
run: |
6667
make test UPDATE_GOLDEN_FILES=true
6768
make test/transparentproxy UPDATE_GOLDEN_FILES=true
69+
=======
70+
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
71+
env:
72+
GITHUB_TOKEN: ${{ github.token }}
73+
MISE_DISABLE_TOOLS: "clang-format,golangci-lint,skaffold"
74+
# Automatically update code formatting if /format is in the comment
75+
- name: "Auto-format code"
76+
if: contains(github.event.comment.body, '/format')
77+
run: make clean/generated check
78+
continue-on-error: true
79+
80+
# Update all golden files except transparent proxy tests if /golden_files is in the comment
81+
- name: "Update golden files (excluding transparent proxy)"
82+
if: contains(github.event.comment.body, '/golden_files')
83+
run: make test UPDATE_GOLDEN_FILES=true
84+
85+
# Update only transparent proxy golden files if /golden_files_tproxy is in the comment
86+
- name: "Update transparent proxy golden files"
87+
if: contains(github.event.comment.body, '/golden_files_tproxy')
88+
run: make test/transparentproxy UPDATE_GOLDEN_FILES=true
89+
90+
>>>>>>> a10cd165d (feat(tools): move to Mise from our custom scripts (#14027))
6891
- name: commit and push fixes
6992
env:
7093
GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }}

.github/workflows/transparentproxy-tests.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
2020
with:
2121
go-version-file: go.mod
22+
<<<<<<< HEAD
2223
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
2324
with:
2425
path: |
@@ -28,6 +29,12 @@ jobs:
2829
${{ runner.os }}-${{ runner.arch }}-devtools
2930
- run: |
3031
make dev/tools
32+
=======
33+
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
34+
env:
35+
GITHUB_TOKEN: ${{ github.token }}
36+
MISE_DISABLE_TOOLS: "clang-format,golangci-lint,skaffold"
37+
>>>>>>> a10cd165d (feat(tools): move to Mise from our custom scripts (#14027))
3138
- name: "Enable IPv6 for Docker and enable necessary kernel modules for ip6tables"
3239
run: |
3340
cat <<'EOF' | sudo tee /etc/docker/daemon.json

DEVELOPER.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ make help
3333

3434
### Installing dev tools
3535

36-
We packaged the remaining dependencies into one target:
36+
We use [mise](https://mise.jdx.dev) to manage dev tools for Kuma. To install you can run:
3737

3838
```bash
39-
make dev/tools
39+
make install
4040
```
4141

42-
You can install each commands individually if you prefer.
42+
or use mise directly
4343

44-
ATTENTION: By default, development tools will be installed at `$HOME/.kuma-dev/bin`. Remember to include this directory
45-
into your `PATH`, e.g. by adding `export PATH=$HOME/.kuma-dev/bin:$PATH` line to the `$HOME/.bashrc` file or `$HOME/.zshrc` if using zsh.
46-
This can be overridden by setting the env var `CI_TOOLS_DIR`, but it isn't recommended.
44+
```bash
45+
mise install
46+
```
4747

4848
## Code checks
4949

0 commit comments

Comments
 (0)