Skip to content

Commit ca1fe81

Browse files
committed
sync openapi model generate workflow with master
Signed-off-by: Min Jin <[email protected]>
1 parent 1133f4f commit ca1fe81

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

.github/workflows/generate.yml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@ on:
77
type: string
88
required: true
99
description: 'The remote kubernetes release branch to fetch openapi spec. .e.g. "release-1.23"'
10-
10+
dry_run:
11+
type: boolean
12+
required: true
13+
default: false
14+
description: Dry run, will not send a PR
15+
skip_patches:
16+
type: boolean
17+
required: true
18+
default: false
19+
description: If true, skip patching code after generation
1120

1221
permissions:
1322
contents: read
23+
pull-requests: write
1424

1525
jobs:
1626
generate:
@@ -59,37 +69,46 @@ jobs:
5969
export PACKAGE_NAME="io.kubernetes.client.openapi"
6070
EOF
6171
62-
USE_SINGLE_PARAMETER=false OPENAPI_GENERATOR_COMMIT=v4.3.1 bash java.sh ../../kubernetes/ settings
72+
USE_SINGLE_PARAMETER=true bash java.sh ../../kubernetes/ settings
6373
popd
6474
rm -rf gen
75+
git config user.email "[email protected]"
76+
git config user.name "Kubernetes Publisher"
77+
git checkout -b "$BRANCH"
78+
git add .
79+
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}'
80+
- name: Apply Manual Diffs
81+
if: ${{ github.event.inputs.skip_patches != 'true' }}
82+
run: |
83+
ls scripts/patches/*.diff | xargs git apply
84+
git add .
85+
git commit -s -m 'Applied patches under scripts/patches/*.diff'
6586
- name: Generate Fluent
6687
run: |
6788
# Only install the generated openapi module because the higher modules' compile
6889
# may fail due to api-changes.
69-
mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Pfluent-gen -pl kubernetes -am clean install
90+
mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
91+
-Dmaven.test.skip=true \
92+
-Pfluent-gen \
93+
-pl kubernetes -am clean install
7094
pushd fluent-gen
7195
bash -x generate.sh
7296
popd
7397
- name: Formatter
7498
run: |
7599
mvn spotless:apply
76100
- name: Commit and push
101+
if: ${{ github.event.inputs.dry_run != 'true' }}
77102
run: |
78103
# Commit and push
79-
git config user.email "[email protected]"
80-
git config user.name "Kubernetes Prow Robot"
81-
git checkout -b "$BRANCH"
82104
git add .
83-
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}'
105+
git commit -s -m 'Format and fluent-gen from ${{ github.event.inputs.kubernetesBranch }}'
84106
git push origin "$BRANCH"
85107
- name: Pull Request
108+
if: ${{ github.event.inputs.dry_run != 'true' }}
86109
uses: repo-sync/pull-request@v2
87110
with:
88111
source_branch: ${{ env.BRANCH }}
89112
destination_branch: ${{ github.ref_name }}
90113
github_token: ${{ secrets.GITHUB_TOKEN }}
91114
pr_title: "Automated Generate from openapi ${{ github.event.inputs.kubernetesBranch }}"
92-
93-
94-
95-

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Validate Input
2424
run: |
2525
echo "${{ github.ref_type }}" | perl -ne 'die unless m/^branch$/'
26-
echo "${{ github.ref_name }}" | perl -ne 'die unless m/^release-legacy-\d+$/'
26+
echo "${{ github.ref_name }}" | perl -ne 'die unless m/^release-legacy-.+$/'
2727
echo "${{ github.event.inputs.releaseVersion }}" | perl -ne 'die unless m/^\d+\.\d+\.\d+-legacy$/'
2828
echo "${{ github.event.inputs.nextDevelopmentVersion }}" | perl -ne 'die unless m/^\d+\.\d+\.\d+-legacy-SNAPSHOT$/'
2929
- name: Checkout

0 commit comments

Comments
 (0)