Skip to content

add update-submodule script #1419

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
merged 3 commits into from
Apr 21, 2021

Conversation

roycaihw
Copy link
Member

@roycaihw roycaihw commented Apr 20, 2021

I'm working on adding scripts to automate the release process. This one updates python-base submodule and collects the release notes.

Example output in master branch:

$ scripts/update-submodule.sh
Submodule path 'kubernetes/base': checked out 'f38221ce0039b71152963edfc3012576368bdfee'
INFO Using output format: markdown
INFO Gathering release notes
INFO Starting to process commit 1 of 11 (9.09%): f38221ce0039b71152963edfc3012576368bdfee
INFO Starting to process commit 2 of 11 (18.18%): fc5b7302b161697ed6fbdf0c5aa85a119768255a
INFO Starting to process commit 3 of 11 (27.27%): e514f69dff7dc090716a233d16b62f87fcdb5b3d
INFO Starting to process commit 4 of 11 (36.36%): 10ae4760b53a917116ae7525a7bbc94f35632cfb
INFO Starting to process commit 5 of 11 (45.45%): db50d0292eb52ac1162d9eb324662c600c5ea6e3
INFO Starting to process commit 6 of 11 (54.55%): 90399663f378b33227f723d3f0c1677965b6d96b
INFO Starting to process commit 7 of 11 (63.64%): fb425a3bec5e5597ff44e810241699ba57377046
INFO Starting to process commit 8 of 11 (72.73%): ed98daeae96c6dc4f245421497c390c009dcec72
INFO Starting to process commit 9 of 11 (81.82%): 93aa318705b93dbd39a61177bb8d4df9db0dddc4
INFO Starting to process commit 10 of 11 (90.91%): 2ea3efbc628597ed3ed2bf3c16e684727addd75b
INFO Starting to process commit 11 of 11 (100.00%): 060cac10e53169c904e0d50b7448233829019e35
INFO PR #233 seems to contain a release note
INFO PR #234 seems to contain a release note
INFO PR #231 seems to contain a release note
INFO PR #231 seems to contain a release note
INFO PR #234 seems to contain a release note
INFO PR #233 seems to contain a release note
INFO finished gathering release notes in 1.285339237s
INFO Got 3 release notes, performing rendering
INFO Release notes written to file: /tmp/python-base-relnote.md
Writing the following release notes to CHANGELOG line 5:
### Feature
- Load_kube_config_from_dict() support define custom temp files path ([kubernetes-client/python-base#233](https://github.com/kubernetes-client/python-base/pull/233), [@onecer](https://github.com/onecer))

Writing the following release notes to CHANGELOG line 5:
### Bug or Regression
- Fix watch stream non-chunked response handling ([kubernetes-client/python-base#231](https://github.com/kubernetes-client/python-base/pull/231), [@dhague](https://github.com/dhague))
- Fixed a decoding error for BOOTMARK watch events ([kubernetes-client/python-base#234](https://github.com/kubernetes-client/python-base/pull/234), [@yliaog](https://github.com/yliaog))

Successfully updated CHANGELOG for submodule.
$ git diff
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 715967add..c18dfd600 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,13 @@

 Kubernetes API Version: 1.17.13

+### Bug or Regression
+- Fix watch stream non-chunked response handling ([kubernetes-client/python-base#231](https://github.com/kubernetes-client/python-base/pull/231), [@dhague](https://github.com/dhague))
+- Fixed a decoding error for BOOTMARK watch events ([kubernetes-client/python-base#234](https://github.com/kubernetes-client/python-base/pull/234), [@yliaog](https://github.com/yliaog))
+
+### Feature
+- Load_kube_config_from_dict() support define custom temp files path ([kubernetes-client/python-base#233](https://github.com/kubernetes-client/python-base/pull/233), [@onecer](https://github.com/onecer))
+
 **Important Information:**

 - The Kubernetes Python client versioning scheme has changed. The version numbers used till Kubernetes Python Client v12.y.z lagged behind the actual Kubernetes minor version numbers. From this release, the client is moving a version format `vY.Z.P` where `Y` and `Z` are respectively from the Kubernetes version `v1.Y.Z` and `P` would incremented due to changes on the Python client side itself. Ref: https://github.com/kubernetes-client/python/issues/1244
diff --git a/kubernetes/base b/kubernetes/base
index 060cac10e..f38221ce0 160000
--- a/kubernetes/base
+++ b/kubernetes/base
@@ -1 +1 @@
-Subproject commit 060cac10e53169c904e0d50b7448233829019e35
+Subproject commit f38221ce0039b71152963edfc3012576368bdfee

/cc @yliaog

@k8s-ci-robot k8s-ci-robot requested a review from yliaog April 20, 2021 05:33
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 20, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: roycaihw

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 20, 2021
```

Once updated, you should create a new PR to commit changes to the repository.
Create a commit "generated python-base update" and send a PR to the main repo.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not obvious what is 'main' repo, better to just use 'this repository'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

#
# Create a commit "generated python-base update" and send a PR to the main repo.
# NOTE: not all python-base changes are user-facing, and you may want to remove
# some of the non-user-facing release notes from CHANGELOG.md.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a release-note label in PR similar to k/k? then it's the matter of automatically collecting all those notes w/o any non user-facing notes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to use a release-note label. I'm going to add PR template to python-base and see if we can enable release-note-required in these repos.


# TODO(roycaihw): make the script send a PR by default (standalone mode), and
# have an option to make the script reusable by other release automations.
TARGET_RELEASE=${TARGET_RELEASE:-"v$(grep "^CLIENT_VERSION = \"" scripts/constants.py | sed "s/CLIENT_VERSION = \"//g" | sed "s/\"//g")"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so TARGET_RELEASE is an env var that can be set when running the script, better put it in the Usage: section above to make it clear.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

curl -o "/tmp/${pull}.patch" -sSL "${pull_url}.patch"
subject=$(grep -m 1 "^Subject" "/tmp/${pull}.patch" | sed -e 's/Subject: \[PATCH//g' | sed 's/.*] //')
pull_uid="$submodule_repo#${pull}"
release_note="- ${subject} [${pull_uid}](${pull_url})\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, release note is from subject here, better to have a release note section in PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

echo -e $release_notes

# update changelog
sed -i "${line_to_edit}i${release_notes}" CHANGELOG.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are 'breaking change', 'bug fix', 'new feature' etc sections in each release note section, looks that this script does not handle that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the script now uses https://github.com/kubernetes/release/tree/master/cmd/release-notes, which collects release notes from the PR description (will update PR template) and categories the release notes based on PR labels, e.g. kind/bug

# Usage:
# scripts/update-submodule.sh
#
# Create a commit "generated python-base update" and send a PR to the main repo.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't see it creates a commit for Release notes, and also it does not send a PR, does it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't. I added a TODO and made the comment clear that the user needs to manually create the commit and PR.

copied from k/k. We should add the same template to python-base
@yliaog
Copy link
Contributor

yliaog commented Apr 21, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 21, 2021
@k8s-ci-robot k8s-ci-robot merged commit 683ea36 into kubernetes-client:master Apr 21, 2021
@yliaog
Copy link
Contributor

yliaog commented Apr 21, 2021

/hold
please squash the commits

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 21, 2021
@roycaihw
Copy link
Member Author

The robot merged the PR first :(

/shrug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. ¯\_(ツ)_/¯ ¯\\\_(ツ)_/¯
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants