Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c75d772c
Unverified
Commit
c75d772c
authored
Oct 12, 2018
by
k8s-ci-robot
Committed by
GitHub
Oct 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #69574 from dims/cherry_pick_pull-should-work-across-repos
cherry_pick_pull should work for non-k/k repos
parents
8751c1e5
ecb1a731
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
cherry_pick_pull.sh
hack/cherry_pick_pull.sh
+14
-9
No files found.
hack/cherry_pick_pull.sh
View file @
c75d772c
...
@@ -16,22 +16,26 @@
...
@@ -16,22 +16,26 @@
# Checkout a PR from GitHub. (Yes, this is sitting in a Git tree. How
# Checkout a PR from GitHub. (Yes, this is sitting in a Git tree. How
# meta.) Assumes you care about pulls from remote "upstream" and
# meta.) Assumes you care about pulls from remote "upstream" and
# checks them
s
out to a branch named:
# checks them out to a branch named:
# automated-cherry-pick-of-<pr>-<target branch>-<timestamp>
# automated-cherry-pick-of-<pr>-<target branch>-<timestamp>
set
-o
errexit
set
-o
errexit
set
-o
nounset
set
-o
nounset
set
-o
pipefail
set
-o
pipefail
declare
-r
KUBE_ROOT
=
"
$(
dirname
"
${
BASH_SOURCE
}
"
)
/.."
REPO_ROOT
=
"
$(
git rev-parse
--show-toplevel
)
"
cd
"
${
KUBE_ROOT
}
"
declare
-r
REPO_ROOT
cd
"
${
REPO_ROOT
}
"
declare
-r
STARTINGBRANCH
=
$(
git symbolic-ref
--short
HEAD
)
STARTINGBRANCH
=
$(
git symbolic-ref
--short
HEAD
)
declare
-r
REBASEMAGIC
=
"
${
KUBE_ROOT
}
/.git/rebase-apply"
declare
-r
STARTINGBRANCH
declare
-r
REBASEMAGIC
=
"
${
REPO_ROOT
}
/.git/rebase-apply"
DRY_RUN
=
${
DRY_RUN
:-
""
}
DRY_RUN
=
${
DRY_RUN
:-
""
}
REGENERATE_DOCS
=
${
REGENERATE_DOCS
:-
""
}
REGENERATE_DOCS
=
${
REGENERATE_DOCS
:-
""
}
UPSTREAM_REMOTE
=
${
UPSTREAM_REMOTE
:-
upstream
}
UPSTREAM_REMOTE
=
${
UPSTREAM_REMOTE
:-
upstream
}
FORK_REMOTE
=
${
FORK_REMOTE
:-
origin
}
FORK_REMOTE
=
${
FORK_REMOTE
:-
origin
}
MAIN_REPO_ORG
=
${
MAIN_REPO_ORG
:-$(
git remote get-url
"
$UPSTREAM_REMOTE
"
|
awk
-F
'[@:./]'
'NR==1{print $4}'
)}
MAIN_REPO_NAME
=
${
MAIN_REPO_NAME
:-$(
git remote get-url
"
$UPSTREAM_REMOTE
"
|
awk
-F
'[@:./]'
'NR==1{print $5}'
)}
if
[[
-z
${
GITHUB_USER
:-}
]]
;
then
if
[[
-z
${
GITHUB_USER
:-}
]]
;
then
echo
"Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"
echo
"Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"
...
@@ -140,7 +144,7 @@ Cherry pick of ${PULLSUBJ} on ${rel}.
...
@@ -140,7 +144,7 @@ Cherry pick of ${PULLSUBJ} on ${rel}.
${
numandtitle
}
${
numandtitle
}
EOF
EOF
hub pull-request
-F
"
${
prtext
}
"
-h
"
${
GITHUB_USER
}
:
${
NEWBRANCH
}
"
-b
"kubernetes
:
${
rel
}
"
hub pull-request
-F
"
${
prtext
}
"
-h
"
${
GITHUB_USER
}
:
${
NEWBRANCH
}
"
-b
"
${
MAIN_REPO_ORG
}
:
${
rel
}
"
}
}
git checkout
-b
"
${
NEWBRANCHUNIQ
}
"
"
${
BRANCH
}
"
git checkout
-b
"
${
NEWBRANCHUNIQ
}
"
"
${
BRANCH
}
"
...
@@ -149,7 +153,8 @@ cleanbranch="${NEWBRANCHUNIQ}"
...
@@ -149,7 +153,8 @@ cleanbranch="${NEWBRANCHUNIQ}"
gitamcleanup
=
true
gitamcleanup
=
true
for
pull
in
"
${
PULLS
[@]
}
"
;
do
for
pull
in
"
${
PULLS
[@]
}
"
;
do
echo
"+++ Downloading patch to /tmp/
${
pull
}
.patch (in case you need to do this again)"
echo
"+++ Downloading patch to /tmp/
${
pull
}
.patch (in case you need to do this again)"
curl
-o
"/tmp/
${
pull
}
.patch"
-sSL
"http://pr.k8s.io/
${
pull
}
.patch"
curl
-o
"/tmp/
${
pull
}
.patch"
-sSL
"https://github.com/
${
MAIN_REPO_ORG
}
/
${
MAIN_REPO_NAME
}
/pull/
${
pull
}
.patch"
echo
echo
echo
"+++ About to attempt cherry pick of PR. To reattempt:"
echo
"+++ About to attempt cherry pick of PR. To reattempt:"
echo
"
$
git am -3 /tmp/
${
pull
}
.patch"
echo
"
$
git am -3 /tmp/
${
pull
}
.patch"
...
@@ -211,8 +216,8 @@ if [[ -n "${DRY_RUN}" ]]; then
...
@@ -211,8 +216,8 @@ if [[ -n "${DRY_RUN}" ]]; then
exit
0
exit
0
fi
fi
if
git remote
-v
|
grep
^
${
FORK_REMOTE
}
|
grep
kubernetes/kubernetes
.git
;
then
if
git remote
-v
|
grep
^
${
FORK_REMOTE
}
|
grep
${
MAIN_REPO_ORG
}
/
${
MAIN_REPO_NAME
}
.git
;
then
echo
"!!! You have
${
FORK_REMOTE
}
configured as your
kubernetes/kubernetes
.git"
echo
"!!! You have
${
FORK_REMOTE
}
configured as your
${
MAIN_REPO_ORG
}
/
${
MAIN_REPO_NAME
}
.git"
echo
"This isn't normal. Leaving you with push instructions:"
echo
"This isn't normal. Leaving you with push instructions:"
echo
echo
echo
"+++ First manually push the branch this script created:"
echo
"+++ First manually push the branch this script created:"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment