From 81d81b39b1dac5a4f038202354cb4989c06fa9d0 Mon Sep 17 00:00:00 2001 From: Dan Sun Date: Sun, 24 Apr 2022 23:34:36 -0400 Subject: [PATCH] Add cherry pick script and document cherrypick process (#2153) * Add cherry pick script Signed-off-by: Dan Sun * Run tests on all branches Signed-off-by: Dan Sun * Add doc for cherry picking Signed-off-by: Dan Sun * fix fmt Signed-off-by: Dan Sun --- .github/workflows/go.yml | 2 +- .github/workflows/python-test.yml | 2 +- hack/cherry-pick.sh | 60 +++++++++++++++++++ .../serving/v1alpha1/zz_generated.deepcopy.go | 1 + pkg/apis/serving/v1beta1/openapi_generated.go | 13 ---- .../serving/v1beta1/zz_generated.deepcopy.go | 1 + .../reconcilers/knative/ksvc_reconciler.go | 2 +- .../v1beta1/inferenceservice/utils/utils.go | 2 +- release/RELEASE_PROCESS.md | 11 ++++ 9 files changed, 77 insertions(+), 17 deletions(-) create mode 100755 hack/cherry-pick.sh diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e876368ff81..72237fc13c3 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -4,7 +4,7 @@ on: push: branches: [ master ] pull_request: - branches: [ master ] + branches: [] jobs: diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 7c954e38c86..5921e1fc2f3 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -4,7 +4,7 @@ on: push: branches: [ master ] pull_request: - branches: [ master ] + branches: [] jobs: flake8-lint: runs-on: ubuntu-latest diff --git a/hack/cherry-pick.sh b/hack/cherry-pick.sh new file mode 100755 index 00000000000..f16dc5cf964 --- /dev/null +++ b/hack/cherry-pick.sh @@ -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-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 diff --git a/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go index 5bbf1d2408c..9cde5b1ea01 100644 --- a/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/pkg/apis/serving/v1beta1/openapi_generated.go b/pkg/apis/serving/v1beta1/openapi_generated.go index ff08cc9491a..8842699130c 100644 --- a/pkg/apis/serving/v1beta1/openapi_generated.go +++ b/pkg/apis/serving/v1beta1/openapi_generated.go @@ -664,7 +664,6 @@ func schema_pkg_apis_serving_v1alpha1_SupportedModelFormat(ref common.ReferenceC }, }, }, - }, }, } @@ -3340,7 +3339,6 @@ func schema_pkg_apis_serving_v1beta1_ExplainerExtensionSpec(ref common.Reference }, }, }, - }, }, Dependencies: []string{ @@ -4460,7 +4458,6 @@ func schema_pkg_apis_serving_v1beta1_LightGBMSpec(ref common.ReferenceCallback) }, }, }, - }, }, Dependencies: []string{ @@ -4545,7 +4542,6 @@ func schema_pkg_apis_serving_v1beta1_ModelFormat(ref common.ReferenceCallback) c }, }, }, - }, }, } @@ -5170,7 +5166,6 @@ func schema_pkg_apis_serving_v1beta1_ONNXRuntimeSpec(ref common.ReferenceCallbac }, }, }, - }, }, Dependencies: []string{ @@ -5443,7 +5438,6 @@ func schema_pkg_apis_serving_v1beta1_PMMLSpec(ref common.ReferenceCallback) comm }, }, }, - }, }, Dependencies: []string{ @@ -5715,7 +5709,6 @@ func schema_pkg_apis_serving_v1beta1_PaddleServerSpec(ref common.ReferenceCallba }, }, }, - }, }, Dependencies: []string{ @@ -6438,7 +6431,6 @@ func schema_pkg_apis_serving_v1beta1_PredictorExtensionSpec(ref common.Reference }, }, }, - }, }, Dependencies: []string{ @@ -7294,7 +7286,6 @@ func schema_pkg_apis_serving_v1beta1_SKLearnSpec(ref common.ReferenceCallback) c }, }, }, - }, }, Dependencies: []string{ @@ -7616,7 +7607,6 @@ func schema_pkg_apis_serving_v1beta1_TFServingSpec(ref common.ReferenceCallback) }, }, }, - }, }, Dependencies: []string{ @@ -7889,7 +7879,6 @@ func schema_pkg_apis_serving_v1beta1_TorchServeSpec(ref common.ReferenceCallback }, }, }, - }, }, Dependencies: []string{ @@ -8642,7 +8631,6 @@ func schema_pkg_apis_serving_v1beta1_TritonSpec(ref common.ReferenceCallback) co }, }, }, - }, }, Dependencies: []string{ @@ -8915,7 +8903,6 @@ func schema_pkg_apis_serving_v1beta1_XGBoostSpec(ref common.ReferenceCallback) c }, }, }, - }, }, Dependencies: []string{ diff --git a/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go b/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go index e3b59a89c3d..8bafae4a6de 100644 --- a/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/pkg/controller/v1beta1/inferenceservice/reconcilers/knative/ksvc_reconciler.go b/pkg/controller/v1beta1/inferenceservice/reconcilers/knative/ksvc_reconciler.go index e3dcf76926a..0602556d00b 100644 --- a/pkg/controller/v1beta1/inferenceservice/reconcilers/knative/ksvc_reconciler.go +++ b/pkg/controller/v1beta1/inferenceservice/reconcilers/knative/ksvc_reconciler.go @@ -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 diff --git a/pkg/controller/v1beta1/inferenceservice/utils/utils.go b/pkg/controller/v1beta1/inferenceservice/utils/utils.go index 0d1a8f34d75..9a55be48bf6 100644 --- a/pkg/controller/v1beta1/inferenceservice/utils/utils.go +++ b/pkg/controller/v1beta1/inferenceservice/utils/utils.go @@ -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 } diff --git a/release/RELEASE_PROCESS.md b/release/RELEASE_PROCESS.md index c30940d4ed0..b3373af35e5 100644 --- a/release/RELEASE_PROCESS.md +++ b/release/RELEASE_PROCESS.md @@ -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. +