Skip to content

Commit

Permalink
Add cherry pick script and document cherrypick process (kubeflow#2153)
Browse files Browse the repository at this point in the history
* Add cherry pick script

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Run tests on all branches

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Add doc for cherry picking

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* fix fmt

Signed-off-by: Dan Sun <dsun20@bloomberg.net>
  • Loading branch information
yuzisun authored Apr 25, 2022
1 parent 7962f1c commit 81d81b3
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
branches: []

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
branches: []
jobs:
flake8-lint:
runs-on: ubuntu-latest
Expand Down
60 changes: 60 additions & 0 deletions hack/cherry-pick.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#
# Copyright 2022 The KServe Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

set -e

if [[ $# == "0" ]]; then
cat << EOF
requirements:
* Install gh, jq
* Run this script from kubeflow/pipelines repo
* You need permission to add labels to PRs
usage: ./cherry-pick.sh <PR-number> [PR-numbers]
for example: ./cherry-pick.sh 123 456 789
You can get the list of PRs waiting to be cherrypicked by:
1. Open https://github.com/kserve/kserve/pulls?q=is%3Apr+label%3Acherrypick-approved+-label%3Acherrypicked+is%3Amerged+sort%3Aupdated-asc+.
2. Open browser console (usually by pressing F12).
3. Paste the following command.
console.log(Array.from(document.querySelectorAll('[id^="issue_"][id*="_link"]')).map(el => /issue_(.*)_link/.exec(el.id)[1]).join(' '))
EOF
fi

add_label_request_body=$(mktemp)
echo '{"labels":["cherrypicked"]}' > $add_label_request_body

for pr in "$@"
do
echo "Cherry picking #$pr"
LABELS_JSON=$(gh api repos/kserve/kserve/issues/$pr/labels)
if echo "$LABELS_JSON" | grep cherrypick-approved >/dev/null; then
echo "PR #$pr has cherrypick-approved label"
else
echo "ERROR: PR #$pr does not have cherrypick-approved label"
exit 1
fi
if echo "$LABELS_JSON" | grep cherrypicked >/dev/null; then
echo "SKIPPED: PR #$pr has already been cherry picked"
continue
fi
MERGE_COMMIT_SHA=$(gh api repos/kserve/kserve/pulls/$pr | jq -r .merge_commit_sha)
echo "Merge commit SHA is $MERGE_COMMIT_SHA"
git cherry-pick $MERGE_COMMIT_SHA
# ref: https://docs.github.com/en/rest/reference/issues#add-labels-to-an-issue
# pull request can also use issue api for adding labels
echo "Adding cherrypicked label to PR $pr"
gh api repos/kserve/kserve/issues/$pr/labels -X POST --input $add_label_request_body >/dev/null
done
1 change: 1 addition & 0 deletions pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions pkg/apis/serving/v1beta1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/apis/serving/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func createKnativeService(componentMeta metav1.ObjectMeta,
lastRolledoutRevision := componentStatus.LatestRolledoutRevision

// Log component status and canary traffic percent
log.Info("revision status:", "LatestRolledoutRevision", componentStatus.LatestRolledoutRevision, "LatestReadyRevision", componentStatus.LatestReadyRevision, "LatestCreatedRevision", componentStatus.LatestCreatedRevision, "PreviousRolledoutRevision", componentStatus.PreviousRolledoutRevision, "CanaryTrafficPercent", componentExtension.CanaryTrafficPercent)
log.Info("revision status:", "LatestRolledoutRevision", componentStatus.LatestRolledoutRevision, "LatestReadyRevision", componentStatus.LatestReadyRevision, "LatestCreatedRevision", componentStatus.LatestCreatedRevision, "PreviousRolledoutRevision", componentStatus.PreviousRolledoutRevision, "CanaryTrafficPercent", componentExtension.CanaryTrafficPercent)

trafficTargets := []knservingv1.TrafficTarget{}
// Split traffic when canary traffic percent is specified
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/v1beta1/inferenceservice/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func UpdateImageTag(container *v1.Container, runtimeVersion *string, isvcConfig
if len(re.FindString(image)) == 0 {
container.Image = image + ":" + *runtimeVersion
} else {
container.Image = re.ReplaceAllString(image, ":" + *runtimeVersion)
container.Image = re.ReplaceAllString(image, ":"+*runtimeVersion)
}
return
}
Expand Down
11 changes: 11 additions & 0 deletions release/RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,14 @@ It's generally a good idea to search the repo for control-f for strings of the o
5. Once everything has settled, tag and push the release with `git tag $VERSION` and `git push upstream $VERSION`.
6. KServe python sdk and images are published from github actions.
7. Upload kserve install manifests to github release artifacts.

## Cherry pick to release branch
After the release-X.Y release branch is cut, pull requests(PRs) merged to master will be only get merged in the next minor release X.(Y+1).0

If you want your PR released eariler in a patch release X.Y.(Z+1)
- The PR must be merged to master
- The PR should be a bug fix
- The PR should be cherry picked to corresponding release branch release-X.Y:
Contributors should ask OWNERs who approved the PR to add a `cherrypick-approved` label if you want the PR cherry picked to release branch. Run `hack/cherry-pick.sh` script to cherry pick the
PRs and it runs `git cherry-pick` for each merged commit and add `cherrypicked` label on the PR. Once PR is cherry picked push to remote branch to create a PR to release branch.

0 comments on commit 81d81b3

Please sign in to comment.