@@ -128,18 +128,41 @@ declare -r newbranchuniq
128128echo " +++ Creating local branch ${newbranchuniq} "
129129git checkout -b " ${newbranchuniq} " " ${remote_branch} "
130130
131- # If it's an actual release, pull master branch
132- if [[ $CLIENT_VERSION != * " snapshot" * ]]; then
133- git pull -X theirs upstream master
134- fi
135-
136131# Get Kubernetes API versions
137132old_client_version=$( python3 " scripts/constants.py" CLIENT_VERSION)
138133old_k8s_api_version=$( util::changelog::get_k8s_api_version " v$old_client_version " )
139134new_k8s_api_version=$( util::kube_changelog::find_latest_patch_version $KUBERNETES_BRANCH )
140135echo " Old Kubernetes API Version: $old_k8s_api_version "
141136echo " New Kubernetes API Version: $new_k8s_api_version "
142137
138+ # If it's an actual release, pull master branch
139+ if [[ $CLIENT_VERSION != * " snapshot" * ]]; then
140+ git pull -X theirs upstream master
141+
142+ # Collect release notes from master branch
143+ start_sha=$( git log upstream/release-19.0..upstream/master | grep ^commit | tail -n1 | sed ' s/commit //g' )
144+ end_sha=$( git log upstream/release-19.0..upstream/master | grep ^commit | head -n1 | sed ' s/commit //g' )
145+ output=" /tmp/python-master-relnote.md"
146+ release-notes --dependencies=false --org kubernetes-client --repo python --start-sha $start_sha --end-sha $end_sha --output $output
147+ sed -i ' s/(\[\#/(\[kubernetes-client\/python\#/g' $output
148+
149+ IFS_backup=$IFS
150+ IFS=$' \n '
151+ sections=($( grep " ^### " $output ) )
152+ IFS=$IFS_backup
153+ for section in " ${sections[@]} " ; do
154+ # ignore section titles and empty lines; replace newline with liternal "\n"
155+ master_release_notes=$( sed -n " /$section /,/###/{/###/!p}" $output | sed -n " {/^$/!p}" | sed ' :a;N;$!ba;s/\n/\\n/g' )
156+ util::changelog::write_changelog v$CLIENT_VERSION " $section " " $master_release_notes "
157+ done
158+ git add .
159+ if ! git diff-index --quiet --cached HEAD; then
160+ util::changelog::update_release_api_version $CLIENT_VERSION $CLIENT_VERSION $new_k8s_api_version
161+ git add .
162+ git commit -m " update changelog with release notes from master branch"
163+ fi
164+ fi
165+
143166# Update version constants
144167sed -i " s/^KUBERNETES_BRANCH =.*$/KUBERNETES_BRANCH = \" $KUBERNETES_BRANCH \" /g" scripts/constants.py
145168sed -i " s/^CLIENT_VERSION =.*$/CLIENT_VERSION = \" $CLIENT_VERSION \" /g" scripts/constants.py
0 commit comments