Skip to content

Commit 9175fa9

Browse files
authored
Merge pull request #2205 from yue9944882/cherrypick-release-15-2197
Cherrypick #2197 to release-15
2 parents 25e2656 + 1e567bb commit 9175fa9

File tree

4 files changed

+91
-17
lines changed

4 files changed

+91
-17
lines changed

.github/workflows/generate.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Generate
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
kubernetesBranch:
7+
type: string
8+
required: true
9+
description: 'The remote kubernetes release branch to fetch openapi spec. .e.g. "release-1.23"'
10+
11+
12+
jobs:
13+
generate:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Java
17+
uses: actions/checkout@v3
18+
- name: Setup Java
19+
uses: actions/setup-java@v2
20+
with:
21+
distribution: 'temurin'
22+
java-version: 8.0.x
23+
- name: Checkout Gen
24+
uses: actions/checkout@v3
25+
with:
26+
path: gen
27+
repository: kubernetes-client/gen
28+
token: ${{ secrets.PAT_TOKEN }}
29+
- name: Generate Branch Name
30+
run: |
31+
SUFFIX=$(openssl rand -hex 4)
32+
echo "BRANCH=automated-generate-$SUFFIX" >> $GITHUB_ENV
33+
- name: Get Project Version
34+
run: |
35+
echo "PROJECT_VERSION=$(mvn -q \
36+
-Dexec.executable="echo" \
37+
-Dexec.args='${project.version}' \
38+
--non-recursive \
39+
org.codehaus.mojo:exec-maven-plugin:1.6.0:exec)" >> $GITHUB_ENV
40+
- name: Generate Openapi
41+
run: |
42+
pushd gen/openapi
43+
cat <<"EOF"> settings
44+
# Kubernetes branch to get the OpenAPI spec from.
45+
export KUBERNETES_BRANCH="${{ github.event.inputs.kubernetesBranch }}"
46+
47+
# client version for packaging and releasing. It can
48+
# be different than SPEC_VERSION.
49+
export CLIENT_VERSION=${{ env.PROJECT_VERSION }}
50+
51+
# Name of the release package
52+
export PACKAGE_NAME="io.kubernetes.client.openapi"
53+
EOF
54+
55+
bash java.sh ../../kubernetes/ settings
56+
popd
57+
rm -rf gen
58+
- name: Generate Fluent
59+
run: |
60+
# Only install the generated openapi module because the higher modules' compile
61+
# may fail due to api-changes.
62+
mvn -Pfluent-gen -pl kubernetes -am clean install
63+
pushd fluent-gen
64+
bash -x generate.sh
65+
popd
66+
- name: Formatter
67+
run: |
68+
mvn spotless:apply
69+
- name: Commit and push
70+
run: |
71+
# Commit and push
72+
git config user.email "k8s.ci.robot@gmail.com"
73+
git config user.name "Kubernetes Prow Robot"
74+
git checkout -b "$BRANCH"
75+
git add .
76+
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}'
77+
git push origin "$BRANCH"
78+
- name: Pull Request
79+
uses: repo-sync/pull-request@v2
80+
with:
81+
source_branch: ${{ env.BRANCH }}
82+
destination_branch: ${{ github.ref_name }}
83+
github_token: ${{ secrets.GITHUB_TOKEN }}
84+
pr_title: "Automated Generate from openapi ${{ github.event.inputs.kubernetesBranch }}"
85+
86+
87+
88+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/target/
1212
target/
1313
**/.factorypath
14+
gen/**
1415

1516
# Mobile Tools for Java (J2ME)
1617
.mtj.tmp/

fluent-gen/README.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,9 @@
44
Start from a totally clean environment (eg. a clean VM if you can), clone everything.
55

66
## Step one
7-
Comment out the existing fluent module from the pom.xml
8-
9-
```xml
10-
...
11-
<!--
12-
<module>fluent</module>
13-
<module>spring</module>
14-
<module>e2e</module>
15-
<module>examples</module>
16-
-->
17-
...
18-
```
7+
`mvn -Pfluent-gen install`
198

209
## Step two
21-
`mvn install`
22-
23-
## Step three
2410
```
2511
cd fluent-gen; ./generate.sh
2612
```

fluent-gen/generate.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
# TODO: Incorporate this into the pom.xml
44

55
rm -r ../fluent/src/main/java/io
6-
mvn clean
7-
mvn compile
6+
mvn -Pfluent-gen clean compile
87
mv target/generated-sources/annotations/io ../fluent/src/main/java/io

0 commit comments

Comments
 (0)