37
37
# - for generated file, resolve conflict by committing the master version
38
38
# - abort if a snapshot doesn't exists
39
39
# - generate client change, abort if API change is detected
40
- # - CHANGELOG: latest snapshot becomes the release
40
+ # - CHANGELOG: latest snapshot becomes the release, create a new snapshot
41
+ # section that reflect the master branch state
41
42
# - README: add the release to README
42
43
# - an extra PR to update CHANGELOG and README in master
43
44
#
44
45
# Difference between 1&2: API change release notes
45
46
#
46
- # TODO:
47
- # - additionally, validate the branch
48
- # - send the PR(s) automatically
47
+ # TODO(roycaihw):
48
+ # - add user input validation
49
+ # - add function input validaiton (release/version strings start with 'v' or not)
50
+ # - automatically send a PR; provide useful links for review
51
+ # - master branch diff: https://github.com/kubernetes-client/python/compare/commit1..commit2
52
+ # - python base diff: https://github.com/kubernetes-client/python-base/compare/commit1..commit2
53
+ # - Kubernetes changelog, e.g. https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.18.md
54
+ # - add debug log
49
55
#
50
56
# Usage:
51
57
@@ -58,16 +64,56 @@ declare -r repo_root
58
64
cd " ${repo_root} "
59
65
60
66
source scripts/util/changelog.sh
67
+ source scripts/util/kube_changelog.sh
61
68
62
- # KUBERNETES_BRANCH=${KUBERNETES_BRANCH:-$(python "${SCRIPT_ROOT}/constants.py" KUBERNETES_BRANCH)}
63
- # CLIENT_VERSION=${CLIENT_VERSION:-$(python "${SCRIPT_ROOT}/constants.py" CLIENT_VERSION)}
64
- # DEVELOPMENT_STATUS=${DEVELOPMENT_STATUS:-$(python "${SCRIPT_ROOT}/constants.py" DEVELOPMENT_STATUS)}
65
- KUBERNETES_BRANCH=" release-1.18"
66
- CLIENT_VERSION=" 18.0.0-snapshot"
67
- DEVELOPMENT_STATUS=" 3 - Alpha"
68
-
69
- # validate inputs
69
+ old_client_version=$( python3 " scripts/constants.py" CLIENT_VERSION)
70
+ old_k8s_api_version=$( util::changelog::get_k8s_api_version " v$old_client_version " )
71
+ KUBERNETES_BRANCH=${KUBERNETES_BRANCH:- $(python3 " scripts/constants.py" KUBERNETES_BRANCH)}
72
+ CLIENT_VERSION=${CLIENT_VERSION:- $(python3 " scripts/constants.py" CLIENT_VERSION)}
73
+ DEVELOPMENT_STATUS=${DEVELOPMENT_STATUS:- $(python3 " scripts/constants.py" DEVELOPMENT_STATUS)}
70
74
71
75
# get Kubernetes API Version
72
- old_api_version=" 1.17.13"
73
- new_api_version=" "
76
+ new_k8s_api_version=$( util::kube_changelog::find_latest_patch_version $KUBERNETES_BRANCH )
77
+ echo " Old Kubernetes API Version: $old_k8s_api_version "
78
+ echo " New Kubernetes API Version: $new_k8s_api_version "
79
+
80
+ sed -i " s/^KUBERNETES_BRANCH =.*$/KUBERNETES_BRANCH = \" $KUBERNETES_BRANCH \" /g" scripts/constants.py
81
+ sed -i " s/^CLIENT_VERSION =.*$/CLIENT_VERSION = \" $CLIENT_VERSION \" /g" scripts/constants.py
82
+ sed -i " s/^DEVELOPMENT_STATUS =.*$/DEVELOPMENT_STATUS = \" $DEVELOPMENT_STATUS \" /g" scripts/constants.py
83
+ git commit -am " update version constants for $CLIENT_VERSION release"
84
+
85
+ util::changelog::update_release_api_version $CLIENT_VERSION $old_client_version $new_k8s_api_version
86
+
87
+ # get API change release notes since $old_k8s_api_version.
88
+ # NOTE: $old_k8s_api_version may be one-minor-version behind $KUBERNETES_BRANCH, e.g.
89
+ # KUBERNETES_BRANCH=release-1.19
90
+ # old_k8s_api_version=1.18.17
91
+ # when we bump the minor version for the snapshot in the master branch. We
92
+ # don't need to collect release notes in release-1.18, because any API
93
+ # change in 1.18.x (x > 17) must be a cherrypick that is already included in
94
+ # release-1.19.
95
+ release_notes=$( util::kube_changelog::get_api_changelog " $KUBERNETES_BRANCH " " $old_k8s_api_version " )
96
+ if [[ -n " $release_notes " ]]; then
97
+ util::changelog::write_changelog v$CLIENT_VERSION " ### API Change" " $release_notes "
98
+ fi
99
+
100
+ git commit -m " update changelog"
101
+
102
+ # run client generator
103
+ scripts/update-client.sh
104
+
105
+ rm -r kubernetes/test/
106
+ git add .
107
+ git commit -m " temporary generated commit"
108
+ scripts/apply-hotfixes.sh
109
+ git reset HEAD~2
110
+ # custom object API is hosted in gen repo. Commit API change separately for
111
+ # easier review
112
+ if [[ -z " $( git diff kubernetes/client/api/custom_objects_api.py) " ]]; then
113
+ git add kubernetes/client/api/custom_objects_api.py
114
+ git commit -m " generated client change for custom_objects"
115
+ fi
116
+ git add kubernetes/docs kubernetes/client/api/ kubernetes/client/models/ kubernetes/swagger.json.unprocessed scripts/swagger.json
117
+ git commit -m " generated API change"
118
+ git add .
119
+ git commit -m " generated client change"
0 commit comments