Skip to content

Commit ccf4fe6

Browse files
committed
UPSTREAM: <carry>: Update openshift-hack/rebase.sh, REBASE.openshift.md
1 parent cb701a7 commit ccf4fe6

2 files changed

Lines changed: 33 additions & 28 deletions

File tree

REBASE.openshift.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,8 @@ The following repositories have been already bumped as well:
360360
361361
<URLs to api/client-go/library-go/apiserver-library-go/operators>
362362
363-
Followup work has been assigned to appropriate teams
364-
through bugzillas linked in the code. Please treat
365-
them as the highest priority after landing the bump.
363+
A Jira ticket has been opened for the rebase process.
364+
It has been linked to the pull request.
366365
367366
Finally, this means we are blocking ALL PRs to our
368367
kubernetes fork.
@@ -518,19 +517,18 @@ The above steps are available as a script that will merge and rebase along the h
518517
resolution and at the end will create a PR for you.
519518

520519
Here are the steps:
521-
1. Create a new BugZilla with the respective OpenShift version to rebase (Target Release stays ---),
522-
Prio&Severity to High with a proper description of the change logs.
523-
See [BZ2021468](https://bugzilla.redhat.com/show_bug.cgi?id=2021468) as an example.
520+
1. Create a new Jira ticket under OCPBUGS with the respective OpenShift version to rebase,
521+
Target Backport Version to the previous minor version + .z
524522
2. It's best to start off with a fresh fork of [openshift/kubernetes](https://github.com/openshift/kubernetes/). Stay on the master branch.
525523
3. This script requires `jq`, `git`, `podman` and `bash`, `gh` is optional.
526524
4. In the root dir of that fork run:
527525
```
528-
openshift-hack/rebase.sh --k8s-tag=v1.25.2 --openshift-release=release-4.12 --bugzilla-id=2003027
526+
openshift-hack/rebase.sh --k8s-tag=v1.25.2 --openshift-release=release-4.12 --jira-id=OCPBUGS-90150
529527
```
530528

531529
where `k8s-tag` is the [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes/) release tag, the `openshift-release`
532-
is the OpenShift release branch in [openshift/kubernetes](https://github.com/openshift/kubernetes/) and the `bugzilla-id` is the
533-
BugZilla ID created in step (1).
530+
is the OpenShift release branch in [openshift/kubernetes](https://github.com/openshift/kubernetes/) and the `jira-id` is the
531+
Jira ticket number created in step (1).
534532

535533
5. In case of conflicts, it will ask you to step into another shell to resolve those. The script will continue by committing the resolution with `UPSTREAM: <drop>`.
536534
6. At the end, there will be a "rebase-$VERSION" branch pushed to your fork.

openshift-hack/rebase.sh

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
#
1212
# The usage is described in /Rebase.openshift.md.
1313

14-
# validate input args --k8s-tag=v1.21.2 --openshift-release=release-4.8 --bugzilla-id=2003027
14+
# validate input args --k8s-tag=v1.21.2 --openshift-release=release-4.8 --jira-id=OCPBUGS-91759
1515
k8s_tag=""
1616
openshift_release=""
17-
bugzilla_id=""
17+
jira_id=""
1818

1919
usage() {
2020
echo "Available arguments:"
2121
echo " --k8s-tag (required) Example: --k8s-tag=v1.21.2"
2222
echo " --openshift-release (required) Example: --openshift-release=release-4.8"
23-
echo " --bugzilla-id (optional) creates new PR against openshift/kubernetes:${openshift-release}: Example: --bugzilla-id=2003027"
23+
echo " --jira-id (optional) Include Jira ticket in PR title: Example: --jira-id=OCPBUGS-1234"
2424
}
2525

2626
for i in "$@"; do
@@ -33,8 +33,8 @@ for i in "$@"; do
3333
openshift_release="${i#*=}"
3434
shift
3535
;;
36-
--bugzilla-id=*)
37-
bugzilla_id="${i#*=}"
36+
--jira-id=*)
37+
jira_id="${i#*=}"
3838
shift
3939
;;
4040
*)
@@ -61,7 +61,7 @@ fi
6161
echo "Processed arguments are:"
6262
echo "--k8s_tag=${k8s_tag}"
6363
echo "--openshift_release=${openshift_release}"
64-
echo "--bugzilla_id=${bugzilla_id}"
64+
echo "--jira_id=${jira_id}"
6565

6666
# prerequisites (check git, podman, ... is present)
6767
if ! command -v git &>/dev/null; then
@@ -98,9 +98,13 @@ git fetch upstream --tags -f
9898
git remote add openshift git@github.com:openshift/kubernetes.git
9999
git fetch openshift
100100

101-
#git checkout --track "openshift/$openshift_release"
101+
git checkout --track "openshift/$openshift_release"
102102
git pull openshift "$openshift_release"
103103

104+
if [ -z "$(git tag -l "$k8s_tag")" ]; then
105+
echo "No such tag exists in upstream for: $k8s_tag"
106+
exit 1
107+
fi
104108
git merge "$k8s_tag"
105109
# shellcheck disable=SC2181
106110
if [ $? -eq 0 ]; then
@@ -125,25 +129,30 @@ fi
125129

126130
# openshift-hack/images/hyperkube/Dockerfile.rhel still has FROM pointing to old tag
127131
# we need to remove the prefix "v" from the $k8s_tag to stay compatible
128-
sed -i -E "s/(io.openshift.build.versions=\"kubernetes=)(1.[1-9]+.[1-9]+)/\1${k8s_tag:1}/" openshift-hack/images/hyperkube/Dockerfile.rhel
132+
podman run --rm -v "$(pwd):/workspace:Z" alpine:latest \
133+
sed -i -E "s/(io.openshift.build.versions=\"kubernetes=)(1.[1-9]+.[1-9]+)/\1${k8s_tag:1}/" \
134+
/workspace/openshift-hack/images/hyperkube/Dockerfile.rhel
129135
go_mod_go_ver=$(grep -E 'go 1\.[1-9][0-9]?' go.mod | sed -E 's/go (1\.[1-9][0-9]?)/\1/' | cut -d '.' -f 1,2) # Need to handle mod versions like 1.23 and 1.23.4; our release images only have major.minor
130-
tag="rhel-8-release-golang-${go_mod_go_ver}-openshift-${openshift_release#release-}"
131-
132-
# update openshift go.mod dependencies
133-
sed -i -E "/=>/! s/(\tgithub.com\/openshift\/[a-z|-]+) (.*)$/\1 $openshift_release/" go.mod
136+
tag=$(grep "^ tag:" .ci-operator.yaml | head -n1 | sed -E 's/.*: (.*)/\1/')
134137

135138
echo "> go mod tidy && hack/update-vendor.sh"
136139
podman run -it --rm -v "$(pwd):/go/k8s.io/kubernetes:Z" \
137140
--workdir=/go/k8s.io/kubernetes \
138141
"registry.ci.openshift.org/openshift/release:$tag" \
139-
go mod tidy && hack/update-vendor.sh
142+
/bin/bash -c "go mod tidy && hack/update-vendor.sh"
140143

141144
# shellcheck disable=SC2181
142145
if [ $? -ne 0 ]; then
143146
echo "updating the vendor folder failed, is any dependency missing?"
144147
exit 1
145148
fi
146149

150+
echo "> make clean to remove stale _output directory"
151+
podman run -it --rm -v "$(pwd):/go/k8s.io/kubernetes:Z" \
152+
--workdir=/go/k8s.io/kubernetes \
153+
"registry.ci.openshift.org/openshift/release:$tag" \
154+
make clean
155+
147156
podman run -it --rm -v "$(pwd):/go/k8s.io/kubernetes:Z" \
148157
--workdir=/go/k8s.io/kubernetes \
149158
"registry.ci.openshift.org/openshift/release:$tag" \
@@ -158,18 +167,16 @@ git push origin "$openshift_release:$remote_branch"
158167
XY=$(echo "$k8s_tag" | sed -E "s/v(1\.[0-9]+)\.[0-9]+/\1/")
159168
ver=$(echo "$k8s_tag" | sed "s/\.//g")
160169
link="https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-$XY.md#$ver"
161-
if [ -n "${bugzilla_id}" ]; then
170+
if [ -n "${jira_id}" ]; then
162171
if command -v gh &>/dev/null; then
163172
XY=$(echo "$k8s_tag" | sed -E "s/v(1\.[0-9]+)\.[0-9]+/\1/")
164173
ver=$(echo "$k8s_tag" | sed "s/\.//g")
165174
link="https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-$XY.md#$ver"
166175

167-
# opens a web browser, because we can't properly create PRs against remote repositories with the GH CLI (yet):
168-
# https://github.com/cli/cli/issues/2691
169176
gh pr create \
170-
--title "Bug $bugzilla_id: Rebase $k8s_tag" \
177+
--title "$jira_id: Rebase $k8s_tag in $openshift_release" \
171178
--body "CHANGELOG $link" \
172-
--web
173-
179+
--base "$openshift_release" \
180+
--head "$remote_branch"
174181
fi
175182
fi

0 commit comments

Comments
 (0)