Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Automated release of 20.11.0a1 upstream release 20.0 1635352326 #1609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# v20.0.0-snapshot
# v20.11.0a1

Kubernetes API Version: v1.20.11

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ supported versions of Kubernetes clusters.
- [client 17.y.z](https://pypi.org/project/kubernetes/17.17.0/): Kubernetes 1.16 or below (+-), Kubernetes 1.17 (✓), Kubernetes 1.18 or above (+-)
- [client 18.y.z](https://pypi.org/project/kubernetes/18.20.0/): Kubernetes 1.17 or below (+-), Kubernetes 1.18 (✓), Kubernetes 1.19 or above (+-)
- [client 19.y.z](https://pypi.org/project/kubernetes/19.15.0/): Kubernetes 1.18 or below (+-), Kubernetes 1.19 (✓), Kubernetes 1.20 or above (+-)
- [client 20.y.z](https://pypi.org/project/kubernetes/20.11.0/): Kubernetes 1.19 or below (+-), Kubernetes 1.20 (✓), Kubernetes 1.21 or above (+-)

> See [here](#homogenizing-the-kubernetes-python-client-versions) for an explaination of why there is no v13-v16 release.

Expand Down Expand Up @@ -131,6 +132,7 @@ between client-python versions.
| 18.0 | Kubernetes main repo, 1.18 branch | ✓ |
| 19.0 Alpha/Beta | Kubernetes main repo, 1.19 branch | ✗ |
| 19.0 | Kubernetes main repo, 1.19 branch | ✓ |
| 20.0 Alpha/Beta | Kubernetes main repo, 1.20 branch | ✓ |

> See [here](#homogenizing-the-kubernetes-python-client-versions) for an explaination of why there is no v13-v16 release.

Expand Down
69 changes: 60 additions & 9 deletions devel/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,64 @@ report issues. Typically, there is a single alpha or beta release, but if there
are a higher than expected number of issues there can be multiple releases
(e.g, a2 or b2).

## 1. Update submodules
## Automated release

### 1. (Optional) Update submodules

Update submodules by referring to this [link](https://github.com/kubernetes-client/python/blob/master/devel/submodules.md#update-submodule). Commit the changes and open a pull request.

### 2. Run the release script and send a PR
Generate a Github personal access token following instruction
[link](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)

```
export GITHUB_TOKEN=t # github-personal-access-token
export MINOR_VERSION=x
export PATCH_VERSION=y # The latest patch version for the minor version. Not required for snapshot.
```
To create a snapshot:
```
$ KUBERNETES_BRANCH=release-1.${MINOR_VERSION} CLIENT_VERSION=${MINOR_VERSION}.0.0-snapshot DEVELOPMENT_STATUS="3 - Alpha" scripts/release.sh
```
To create an a1 release:
```
$ KUBERNETES_BRANCH=release-1.${MINOR_VERSION} CLIENT_VERSION=${MINOR_VERSION}.${PATCH_VERSION}.0a1 DEVELOPMENT_STATUS="3 - Alpha" scripts/release.sh
```
To create a b1 release:
```
$ KUBERNETES_BRANCH=release-1.${MINOR_VERSION} CLIENT_VERSION=${MINOR_VERSION}.${PATCH_VERSION}.0b1 DEVELOPMENT_STATUS="4 - Beta" scripts/release.sh
```
To create a stable release:
```
$ KUBERNETES_BRANCH=release-1.${MINOR_VERSION} CLIENT_VERSION=${MINOR_VERSION}.${PATCH_VERSION}.0 DEVELOPMENT_STATUS="5 - Production/Stable" scripts/release.sh
```
Checkout the generated local branch (named "automated-release-of-xxx") to
continue with the remaining steps.

### 3. README (not required for snapshots)

Update the compatibility matrix and maintenance status in the README file.

### 4. Submit pull request

For snapshots, create a PR against the master repo.

For actual releases, create:
- a PR against the release branch
- a second PR against the master branch to cherrypick the CHANGELOG and README
changes.

### 5. (Repo admin) Create release branch

After merging a new snapshot, create a release branch from the master branch.

## (Deprecated) Manual release

### 1. Update submodules

Update submodules by referring to this [link](https://github.com/kubernetes-client/python/blob/master/devel/submodules.md#update-submodule). Commit the changes and open a pull request.

## 2. Create or update release branch
### 2. Create or update release branch

The release branch name should have release-x.x format. All minor and pre-releases
should be on the same branch. To update an existing branch with master (only for
Expand All @@ -36,7 +89,7 @@ git pull -X theirs upstream master
You may need to fix some conflicts. For auto-generated files, you can commit
either version. They will be updated to the current version in the next step.

## 3. Update release tags
### 3. Update release tags

Release tags are in the "scripts/constants.py" file. These are the constants you
may need to update:
Expand Down Expand Up @@ -73,7 +126,7 @@ apply the manual fixes.***
git push upstream $RELEASE_BRANCH
```

## 4. Hot issues
### 4. Hot issues

Use the `scripts/apply-hotfixes.sh` script to apply the fixes below in one step.
**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.**
Expand All @@ -99,19 +152,19 @@ For more details, see [#974](https://github.com/kubernetes-client/python/issues/

5. Add tests for the default `Configuration` behavior (ref: https://github.com/kubernetes-client/python/pull/1303 and https://github.com/kubernetes-client/python/pull/1285). The commit [1ffa61d0650e4c93e0d7f0becd2c54797eafd407](https://github.com/kubernetes-client/python/pull/1285/commits/1ffa61d0650e4c93e0d7f0becd2c54797eafd407) should be cherry-picked.

## 5. CHANGELOG
### 5. CHANGELOG

Make sure the change logs are up to date [here](https://github.com/kubernetes-client/python/blob/master/CHANGELOG.md).
If they are not, follow commits added after the last release and update/commit
the change logs to master.

Then based on the release, follow one of next two steps.

## 6. README
### 6. README

Update the compatibility matrix and maintenance status in the README file.

## Submit pull request
### Submit pull request

Typically after the you've completed steps 2-6 above you can push your changes
open a pull request against `kubernetes-client:release-x.y`
Expand Down Expand Up @@ -220,6 +273,4 @@ deactivate
rm -rf .release
```

TODO: Convert steps in this document to an (semi-) automated script.

ref: https://packaging.python.org/distributing/
2 changes: 1 addition & 1 deletion kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ No description provided (generated by Openapi Generator https://github.com/opena
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: release-1.20
- Package version: 20.0.0-snapshot
- Package version: 20.11.0a1
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

__project__ = 'kubernetes'
# The version is auto-updated. Please do not edit.
__version__ = "20.0.0-snapshot"
__version__ = "20.11.0a1"

import kubernetes.client
import kubernetes.config
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from __future__ import absolute_import

__version__ = "20.0.0-snapshot"
__version__ = "20.11.0a1"

# import apis into sdk package
from kubernetes.client.api.well_known_api import WellKnownApi
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/20.0.0-snapshot/python'
self.user_agent = 'OpenAPI-Generator/20.11.0a1/python'
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: release-1.20\n"\
"SDK Package Version: 20.0.0-snapshot".\
"SDK Package Version: 20.11.0a1".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
14 changes: 14 additions & 0 deletions scripts/apply-hotfixes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,18 @@ else
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 Succesfully 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"
2 changes: 1 addition & 1 deletion scripts/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
KUBERNETES_BRANCH = "release-1.20"

# client version for packaging and releasing.
CLIENT_VERSION = "20.0.0-snapshot"
CLIENT_VERSION = "20.11.0a1"

# Name of the release package
PACKAGE_NAME = "kubernetes"
Expand Down
52 changes: 30 additions & 22 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,31 @@ if [[ $CLIENT_VERSION != *"snapshot"* ]]; then
git pull -X theirs upstream master --no-edit

# Collect release notes from master branch
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.md"
release-notes --dependencies=false --org kubernetes-client --repo python --start-sha $start_sha --end-sha $end_sha --output $output
sed -i 's/(\[\#/(\[kubernetes-client\/python\#/g' $output

IFS_backup=$IFS
IFS=$'\n'
sections=($(grep "^### " $output))
IFS=$IFS_backup
for section in "${sections[@]}"; do
# ignore section titles and empty lines; replace newline with liternal "\n"
master_release_notes=$(sed -n "/$section/,/###/{/###/!p}" $output | sed -n "{/^$/!p}" | sed ':a;N;$!ba;s/\n/\\n/g')
util::changelog::write_changelog v$CLIENT_VERSION "$section" "$master_release_notes"
done
git add .
if ! git diff-index --quiet --cached HEAD; then
util::changelog::update_release_api_version $CLIENT_VERSION $CLIENT_VERSION $new_k8s_api_version
git add .
git commit -m "update changelog with release notes from master branch"
if [[ $(git log ${remote_branch}..upstream/master | grep ^commit) ]]; then
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"
release-notes --dependencies=false --org kubernetes-client --repo python --start-sha $start_sha --end-sha $end_sha --output $output
# Collect release notes from the output if non-empty
if [ -s $output ]; then
sed -i 's/(\[\#/(\[kubernetes-client\/python\#/g' $output

IFS_backup=$IFS
IFS=$'\n'
sections=($(grep "^### " $output))
IFS=$IFS_backup
for section in "${sections[@]}"; do
# ignore section titles and empty lines; replace newline with liternal "\n"
master_release_notes=$(sed -n "/$section/,/###/{/###/!p}" $output | sed -n "{/^$/!p}" | sed ':a;N;$!ba;s/\n/\\n/g')
util::changelog::write_changelog v$CLIENT_VERSION "$section" "$master_release_notes"
done
git add . # Allows us to check if there are any staged release note changes
if ! git diff-index --quiet --cached HEAD; then
util::changelog::update_release_api_version $CLIENT_VERSION $CLIENT_VERSION $new_k8s_api_version
git add . # Include the API version update before we commit
git commit -m "update changelog with release notes from master branch"
fi
fi
fi
fi

Expand All @@ -180,9 +185,12 @@ git commit -am "update version constants for $CLIENT_VERSION release"
# TODO(roycaihw): not all Kubernetes API changes modify the OpenAPI spec.
# Download the patch and skip if the spec is not modified. Also we want to
# look at other k/k sections like "deprecation"
if [[ $CLIENT_VERSION == *"snapshot"* ]]; then
# Update "Kubernetes API Version" if we are generating a snapshot
if [[ $old_client_version == *"snapshot"* ]]; then
# If the old client version was a snapshot, update the changelog in place
util::changelog::update_release_api_version $CLIENT_VERSION $old_client_version $new_k8s_api_version
else
# Otherwise add a new section in the changelog
util::changelog::update_release_api_version $CLIENT_VERSION $CLIENT_VERSION $new_k8s_api_version
fi
release_notes=$(util::kube_changelog::get_api_changelog "$KUBERNETES_BRANCH" "$old_k8s_api_version")
if [[ -n "$release_notes" ]]; then
Expand Down
32 changes: 18 additions & 14 deletions scripts/update-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,24 @@ git submodule update --remote
# download release notes
start_sha=$(git diff | grep "^-Subproject commit " | sed 's/-Subproject commit //g')
end_sha=$(git diff | grep "^+Subproject commit " | sed 's/+Subproject commit //g')
output="/tmp/python-base-relnote.md"
output="/tmp/python-base-relnote-$(date +%s).md"
release-notes --dependencies=false --org kubernetes-client --repo python-base --start-sha $start_sha --end-sha $end_sha --output $output
sed -i 's/(\[\#/(\[kubernetes-client\/python-base\#/g' $output
if [ -s $output ]; then
sed -i 's/(\[\#/(\[kubernetes-client\/python-base\#/g' $output

# update changelog
IFS_backup=$IFS
IFS=$'\n'
sections=($(grep "^### " $output))
IFS=$IFS_backup
for section in "${sections[@]}"; do
# ignore section titles and empty lines; replace newline with liternal "\n"
release_notes=$(sed -n "/$section/,/###/{/###/!p}" $output | sed -n "{/^$/!p}" | sed ':a;N;$!ba;s/\n/\\n/g')
util::changelog::write_changelog "$TARGET_RELEASE" "$section" "$release_notes"
done
# update changelog
IFS_backup=$IFS
IFS=$'\n'
sections=($(grep "^### " $output))
IFS=$IFS_backup
for section in "${sections[@]}"; do
# ignore section titles and empty lines; replace newline with liternal "\n"
release_notes=$(sed -n "/$section/,/###/{/###/!p}" $output | sed -n "{/^$/!p}" | sed ':a;N;$!ba;s/\n/\\n/g')
util::changelog::write_changelog "$TARGET_RELEASE" "$section" "$release_notes"
done

rm -f $output
echo "Successfully updated CHANGELOG for submodule."
rm -f $output
echo "Successfully updated CHANGELOG for submodule."
else
echo "No CHANGELOG for submodule."
fi
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Do not edit these constants. They will be updated automatically
# by scripts/update-client.sh.
CLIENT_VERSION = "20.0.0-snapshot"
CLIENT_VERSION = "20.11.0a1"
PACKAGE_NAME = "kubernetes"
DEVELOPMENT_STATUS = "3 - Alpha"

Expand Down