Skip to content

Commit 943e06c

Browse files
authored
Merge pull request #1103 from palnabarun/hotfix-process
Update the hotfix patch list and add a script to automate the patching process
2 parents 9f245de + 1d2417b commit 943e06c

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

devel/release.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ to add [this file](https://github.com/kubernetes-client/python/blob/0976d59d6ff2
1919
under `kubernetes/client/apis/` to ensure the package is backwards compatible.
2020
For more details, see [#974](https://github.com/kubernetes-client/python/issues/974)
2121

22+
3. Add ability to the client to be used as Context Manager [kubernetes-client/python#1073](https://github.com/kubernetes-client/python/pull/1073)
23+
2224
Commit the manual changes like this [PR](https://github.com/kubernetes-client/python/pull/995/commits) does,
2325
then create your PR for review.
2426

27+
Alternatively, you can use the `scripts/apply-hotfixes.sh` script to apply changes from the above functionalities. **As mentioned above the script should be run after finishing the section `Update release tags`. Also, ensure a clean working directory before applying the script**
28+
2529
## Change logs
2630
Make sure the change logs are up to date [here](https://github.com/kubernetes-client/python/blob/master/CHANGELOG.md).
2731
If they are not, follow commits added after the last release and update/commit

scripts/apply-hotfixes.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/sh
2+
3+
# Copyright 2020 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# Script to apply hotfixes after generating the client
18+
# More details: https://github.com/kubernetes-client/python/blob/master/devel/release.md#hot-issues
19+
20+
# Check if working directory is dirty
21+
if [ $(git status --porcelain | wc -l) -gt 0 ]
22+
then
23+
echo Your working directory is not clean. Please clean your working directory.
24+
exit 1
25+
fi
26+
27+
# Check if the current branch is a release branch (release-*)
28+
# If it is not a release branch, don't let the patch be applied
29+
GIT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
30+
if ! [[ $GIT_BRANCH =~ .*release-.* ]]; then
31+
echo Current branch: $GIT_BRANCH
32+
echo You are not in a release branch, e.g., release-11.0, release-10.0
33+
echo Please switch to a release branch to run this script.
34+
exit 1
35+
fi
36+
37+
# Patching commit for custom client behavior
38+
# Ref: https://github.com/kubernetes-client/python/pull/995/commits/9959273625b999ae9a8f0679c4def2ee7d699ede
39+
git cherry-pick -n 9959273625b999ae9a8f0679c4def2ee7d699ede
40+
if [ $? -eq 0 ]
41+
then
42+
echo Succesfully patched changes for custom client behavior
43+
else
44+
echo Failed to patch changes for custom client behavior
45+
git restore --staged .
46+
exit 1
47+
fi
48+
49+
# Patching commits for enabling from kubernetes import apis
50+
# Ref: https://github.com/kubernetes-client/python/blob/0976d59d6ff206f2f428cabc7a6b7b1144843b2a/kubernetes/client/apis/__init__.py
51+
git cherry-pick -n dee078639b5e848db73232397087a81f1a336510 b3164930dd1789dd66915acd6772f92f512cec47
52+
if [ $? -eq 0 ]
53+
then
54+
echo Succesfully patched changes for enabling from kubernetes import apis
55+
else
56+
echo Failed to patch changes for enabling from kubernetes import apis
57+
git restore --staged .
58+
exit 1
59+
fi;
60+
61+
# Patching commits for Client Context Manager
62+
# Ref: https://github.com/kubernetes-client/python/pull/1073
63+
git cherry-pick -n 18d21df367bf9ab5554635f5c6d107f2cf2206a5 13dffb897617f87aaaee247095107d7011e002d5
64+
if [ $? -eq 0 ]
65+
then
66+
echo Succesfully patched changes for Client Context Manager
67+
else
68+
echo Failed to patch changes for Client Context Manager
69+
git restore --staged .
70+
exit 1
71+
fi;
72+
73+
git commit -m "Apply hotfixes"

0 commit comments

Comments
 (0)