Skip to content

Commit 8bce89e

Browse files
authored
Merge pull request #4380 from kubernetes-client/copilot/fix-protobuf-automation-issue
Add protocol buffer generation automation to maintain sync with upstream Kubernetes
2 parents 59ad9c9 + 2b0d645 commit 8bce89e

40 files changed

+315779
-229568
lines changed

.github/workflows/generate.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,22 @@ jobs:
7373
7474
USE_SINGLE_PARAMETER=true bash java.sh ../../kubernetes/ settings
7575
popd
76-
rm -rf gen
7776
git config user.email "k8s-publishing-bot@users.noreply.github.com"
7877
git config user.name "Kubernetes Publisher"
7978
git checkout -b "$BRANCH"
8079
git add .
8180
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}'
81+
- name: Generate Proto
82+
run: |
83+
pushd gen/proto
84+
# Download proto dependencies for the specified Kubernetes branch
85+
bash dependencies.sh "${{ github.event.inputs.kubernetesBranch }}"
86+
# Generate Java proto classes
87+
bash generate.sh java ../../proto/src/main/java/
88+
popd
89+
rm -rf gen
90+
git add proto/
91+
git commit -s -m 'Automated proto generation from ${{ github.event.inputs.kubernetesBranch }}'
8292
- name: Apply Manual Diffs
8393
if: ${{ github.event.inputs.skip_patches != 'true' }}
8494
run: |

proto/README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,43 @@
11
# Generating proto files
22

3+
## Automated Generation
4+
5+
Protocol buffer files are automatically generated as part of the regular code generation workflow when a new Kubernetes release is published. This happens through the GitHub Actions workflow defined in `.github/workflows/generate.yml`.
6+
7+
To trigger proto generation manually along with OpenAPI generation:
8+
9+
1. Go to the [Generate workflow](https://github.com/kubernetes-client/java/actions/workflows/generate.yml) in GitHub Actions
10+
2. Click "Run workflow"
11+
3. Specify the Kubernetes branch (e.g., "release-1.30" or "master")
12+
4. The workflow will automatically:
13+
- Generate OpenAPI client code
14+
- Generate protocol buffer classes
15+
- Apply any necessary patches
16+
- Generate fluent API
17+
- Create a pull request with all changes
18+
19+
## Manual Generation
20+
21+
For local development or testing, you can generate proto files manually using the provided script:
22+
23+
```sh
24+
cd /path/to/kubernetes-client-java
25+
KUBERNETES_BRANCH=master bash scripts/update-proto.sh
26+
```
27+
28+
You can specify a different Kubernetes branch/tag:
29+
30+
```sh
31+
KUBERNETES_BRANCH=release-1.30 bash scripts/update-proto.sh
32+
```
33+
34+
## Using the kubernetes-client/gen Repository Directly
35+
36+
Alternatively, you can use the kubernetes-client/gen repository directly:
37+
338
```sh
439
git clone https://github.com/kubernetes-client/gen
540
cd gen/proto
6-
./generate.sh java ${PATH_TO_JAVA_CLIENT_ROOT}/java/proto/src/main/java/
41+
bash dependencies.sh master # or specify a different branch
42+
bash generate.sh java ${PATH_TO_JAVA_CLIENT_ROOT}/proto/src/main/java/
743
`````````````````````````````````

0 commit comments

Comments
 (0)