From 5fa2e3f9d3ce903d65c9ff08b9426799180b4263 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Thu, 18 Aug 2022 18:12:47 -0400 Subject: [PATCH] Fix release script master includes patches that are re-patched during the release process. This patch removes them. Remove rest-client patch The patch no longer applies because it has already been committed. Signed-off-by: Austin Macdonald --- scripts/apply-hotfixes.sh | 72 ++++++++-------------------------- scripts/release.sh | 4 +- scripts/rest_client_patch.diff | 17 -------- scripts/update-client.sh | 7 ---- 4 files changed, 20 insertions(+), 80 deletions(-) delete mode 100644 scripts/rest_client_patch.diff diff --git a/scripts/apply-hotfixes.sh b/scripts/apply-hotfixes.sh index 42a247c381..7367c23ec3 100755 --- a/scripts/apply-hotfixes.sh +++ b/scripts/apply-hotfixes.sh @@ -24,58 +24,20 @@ then exit 1 fi -# Patching commit for custom client behavior -# UPDATE: The commit being cherry-picked is updated since the the client generated in 1adaaecd0879d7315f48259ad8d6cbd66b835385 -# differs from the initial hotfix -# Ref: https://github.com/kubernetes-client/python/pull/995/commits/9959273625b999ae9a8f0679c4def2ee7d699ede -git cherry-pick -n 88397bcc5b3b348a41dbf641367756b86552d362 -if [ $? -eq 0 ] -then - echo Successfully patched changes for custom client behavior -else - echo Failed to patch changes for custom client behavior - git restore --staged . - exit 1 -fi - -# Patching commits for enabling from kubernetes import apis -# UPDATE: The commit being cherry-picked is updated to include both the commits as one -# Ref: https://github.com/kubernetes-client/python/blob/0976d59d6ff206f2f428cabc7a6b7b1144843b2a/kubernetes/client/apis/__init__.py -git cherry-pick -n 56ab983036bcb5c78eee91483c1e610da69216d1 -if [ $? -eq 0 ] -then - echo Successfully patched changes for enabling from kubernetes import apis -else - echo Failed to patch changes for enabling from kubernetes import apis - git restore --staged . - exit 1 -fi; - -# Patching commits for Client Context Manager -# UPDATE: OpenAPI generator v4.3.0 has the context manager as a functionality. Cherry-picking just the tests for completeness. -# Ref: https://github.com/kubernetes-client/python/pull/1073 -git cherry-pick -n 13dffb897617f87aaaee247095107d7011e002d5 -if [ $? -eq 0 ] -then - echo Successfully patched changes for Client Context Manager -else - echo Failed to patch changes for Client Context Manager - git restore --staged . - exit 1 -fi; - -# Patching commit for no_proxy support -# UPDATE: The commit being cherry-picked is updated kubernetes/client/ unless OpenAPI generator v5.3.1 involved (offinical support of no_proxy feature). -# Ref: https://github.com/kubernetes-client/python/pull/1579/commits/95a893cd1c34de11a4e3893dd1dfde4a0ca30bdc and conversations in the PR. -git cherry-pick -n 95a893cd1c34de11a4e3893dd1dfde4a0ca30bdc -if [ $? -eq 0 ] -then - echo Successfully patched changes for no_proxy support -else - echo Failed to patch changes for no_proxy support - git restore --staged . - exit 1 -fi; - - -git commit -m "Apply hotfixes" +# TODO(if you need to patch, I've left this for you as an example) +# # Patching commit for custom client behavior +# # UPDATE: The commit being cherry-picked is updated since the the client generated in 1adaaecd0879d7315f48259ad8d6cbd66b835385 +# # differs from the initial hotfix +# # Ref: https://github.com/kubernetes-client/python/pull/995/commits/9959273625b999ae9a8f0679c4def2ee7d699ede +# git cherry-pick -n 88397bcc5b3b348a41dbf641367756b86552d362 +# if [ $? -eq 0 ] +# then +# echo Successfully patched changes for custom client behavior +# else +# echo Failed to patch changes for custom client behavior +# git restore --staged . +# exit 1 +# fi +# +# +# # git commit -m "Apply hotfixes" diff --git a/scripts/release.sh b/scripts/release.sh index 55b8a321ad..559aaa1f49 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -112,7 +112,7 @@ trap return_to_kansas EXIT remote_branch=upstream/master if [[ $CLIENT_VERSION != *"snapshot"* ]]; then - remote_branch=upstream/release-"${CLIENT_VERSION%%.*}".0 + remote_branch=origin/release-"${CLIENT_VERSION%%.*}".0 fi echo "+++ Updating remotes..." git remote update upstream origin @@ -141,6 +141,8 @@ if [[ $CLIENT_VERSION != *"snapshot"* ]]; then # Collect release notes from master branch if [[ $(git log ${remote_branch}..upstream/master | grep ^commit) ]]; then + echo "HEYOOOOOO" + echo ${remote_branch}..upstream/master start_sha=$(git log ${remote_branch}..upstream/master | grep ^commit | tail -n1 | sed 's/commit //g') end_sha=$(git log ${remote_branch}..upstream/master | grep ^commit | head -n1 | sed 's/commit //g') output="/tmp/python-master-relnote-$(date +%s).md" diff --git a/scripts/rest_client_patch.diff b/scripts/rest_client_patch.diff deleted file mode 100644 index 2a6c0bca93..0000000000 --- a/scripts/rest_client_patch.diff +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/kubernetes/client/rest.py b/kubernetes/client/rest.py -index 65fbe95..e174317 100644 ---- a/kubernetes/client/rest.py -+++ b/kubernetes/client/rest.py -@@ -152,6 +152,10 @@ class RESTClientObject(object): - if query_params: - url += '?' + urlencode(query_params) -- if re.search('json', headers['Content-Type'], re.IGNORECASE): -+ if (re.search('json', headers['Content-Type'], re.IGNORECASE) or -+ headers['Content-Type'] == 'application/apply-patch+yaml'): -+ if headers['Content-Type'] == 'application/json-patch+json': -+ if not isinstance(body, list): -+ headers['Content-Type'] = \ -+ 'application/strategic-merge-patch+json' - request_body = None - if body is not None: - request_body = json.dumps(body) diff --git a/scripts/update-client.sh b/scripts/update-client.sh index 0145dd0298..a6eba9c619 100755 --- a/scripts/update-client.sh +++ b/scripts/update-client.sh @@ -66,10 +66,3 @@ sed -i'' "s/^CLIENT_VERSION = .*/CLIENT_VERSION = \\\"${CLIENT_VERSION}\\\"/" "$ sed -i'' "s/^__version__ = .*/__version__ = \\\"${CLIENT_VERSION}\\\"/" "${CLIENT_ROOT}/__init__.py" sed -i'' "s/^PACKAGE_NAME = .*/PACKAGE_NAME = \\\"${PACKAGE_NAME}\\\"/" "${SCRIPT_ROOT}/../setup.py" sed -i'' "s,^DEVELOPMENT_STATUS = .*,DEVELOPMENT_STATUS = \\\"${DEVELOPMENT_STATUS}\\\"," "${SCRIPT_ROOT}/../setup.py" - -# This is a terrible hack: -# first, this must be in gen repo not here -# second, this should be ported to swagger-codegen -echo ">>> patching client..." -git apply "${SCRIPT_ROOT}/rest_client_patch.diff" -echo ">>> Done."