32 Commits

Author SHA1 Message Date
Dawid Mędrek
2385afa1c7 scripts/pull_github_pr.sh: Update instructions for creating token
The interface of Jenkins has changed, and the instructions for creating
a token are out-of-date. This commit updates them.

Closes scylladb/scylladb#28054
2026-01-09 17:45:00 +02:00
Pavel Emelyanov
855b91ec20 scripts: Make PR merging check more granular
Currently we have 3 explicit checks, and some of them are configurable:
- Jenkins job being stable. Can be disabled with --force
- Whether submodule update is happenning. It's not allowed by default, and
  should be enabled with --allow-submodule option
- Target branch checking (recently merged #27249). Happens unconditionally

This PR unifies all checks in two ways.

First, each restriction can be lifted with --allow-foo options. The existing
--allow-submodule stays and two options are added:

- --allow-unstable to skip jenkins job check (like --force works now)
- --allow-any-branch to skip target branch check

Second, the --force option lifts all the known restrictions.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>

Closes scylladb/scylladb#27294
2025-12-09 13:58:21 +02:00
Pavel Emelyanov
943350fd35 scripts: Add target branch checking in PR merging script
Sometimes (though rarely) I call this script on mis-matching PR and
current branch. E.g. trying to merge master PR into stable next, or
2025.X PR into next-2025.Y (X != Y). Typically merge fails, but it's
good to catch it early.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>

Closes scylladb/scylladb#27249
2025-11-26 12:10:16 +02:00
Tomasz Grabiec
284c73d466 scripts: pull_github_pr.sh: Fix auth problem detection
Before the patch, the script printed:

parse error: Invalid numeric literal at line 2, column 0

Closes scylladb/scylladb#26818
2025-10-31 18:32:58 +03:00
Pavel Emelyanov
ed1c049c3b scripts: Add usage to pull_github_pr script
If mis-used, the script says

   error: unrecognized option: ..., see ./scripts/pull_github_pr.sh -h for usage

but if using the suggested -h option it prints just the same.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>

Closes scylladb/scylladb#26378
2025-10-07 10:28:35 +03:00
Avi Kivity
6daa6178b1 scripts: pull_github_pr.sh: reject unintended submodule changes
It is easy for submodule changes to slip through during rebase (if
the developer uses the terrible `git add -u`  command) and
for a maintainer to miss it (if they don't go over each change after
a rebase).

Protect against such mishaps by checking if a submodule was updated
(or .gitmodules itself was changes) and aborting the operation.

If the pull request title contains "submodule", assume the operation
was intended.

Allow bypassing the check with --allow-submodule.

Closes scylladb/scylladb#25418
2025-08-10 11:48:34 +03:00
Dawid Pawlik
b284961a95 scripts: fetch the name of the author of the PR
The `pull_github_pr.sh` script has been fetching the username
from the owner of the source branch.
The owner of the branch is not always the author of the PR.
For example the branch might come from a fork managed by organization
or group of people.
This lead to having the author in merge commits refered to as `null`
(if the name was not set for the group) or it mentioned a name
not belonging to the author of the patch.

Instead looking for the owner of the source branch, the script should
look for the name of the PR's author.

Closes scylladb/scylladb#25363
2025-08-06 16:45:38 +03:00
Botond Dénes
33e383c557 scripts/pull_github_pr.sh: add argument parsing
Instead of hardcoding PR_NUM=$1 and FORCE=$2. This current setup is
not very flexible and one gets no feedback if the arguments are
incorrect or not recognized.

Add proper position-independent argument parsing using a classic while
case loop.

Closes scylladb/scylladb#23623
2025-04-17 11:49:15 +03:00
Avi Kivity
cf72c31617 treewide: improve bash error reporting
bash error handling and reporting is atrocious. Without -e it will
just ignore errors. With -e it will stop on errors, but not report
where the error happened (apart from exiting itself with an error code).

Improve that with the `trap ERR` command. Note that this won't be invoked
on intentional error exit with `exit 1`.

We apply this on every bash script that contains -e or that it appears
trivial to set it in. Non-trivial scripts without -e are left unmodified,
since they might intentionally invoke failing scripts.

Closes scylladb/scylladb#22747
2025-02-10 18:28:52 +03:00
Avi Kivity
bef015da0d Revert ".github/scripts/auto-backport.py: validate backport candidate with Fixes prefix"
This reverts commit 8414cd743e. It prevents
pulling pull requests that do have "Fixes" references.
2024-11-18 12:29:22 +02:00
Yaron Kaikov
8414cd743e .github/scripts/auto-backport.py: validate backport candidate with Fixes prefix
Adding `Fixes` validation to a PR when backport labels were added. When the auto backport process triggers (after promotion), we will ensure each PR with backport/x.y label also has in the PR body a `Fixes` reference to an issue

Adding also this validation to `pull_github_pr.sh` per @denesb request,

Fixes: https://github.com/scylladb/scylladb/issues/20021

Closes scylladb/scylladb#21563
2024-11-15 06:51:02 +02:00
Yaron Kaikov
ab964bcd5a [script/pull_github_pr.sh] Check Gating status before merging
Maintainers use scripts/pull_github_pr.sh from scylladb.git when merging PRs and before pushing to the next. We want to prevent merges from piling up on top of unstable builds. This change will check Gating's current status and notify the maintainers

Related to scylladb/scylla-pkg#3644

Closes scylladb/scylladb#20742
2024-10-01 14:46:29 +03:00
Pavel Emelyanov
c17d353718 Revert "[script/pull_github_pr.sh] Check Gating status before merging"
This reverts commit fac682df7e.

Again, this patch broke maintainer workflows, it needs even more care.
2024-09-27 19:12:18 +03:00
Yaron Kaikov
fac682df7e [script/pull_github_pr.sh] Check Gating status before merging
Maintainers use scripts/pull_github_pr.sh from scylladb.git when merging PRs and before pushing to the next. We want to prevent merges from piling up on top of unstable builds. This change will check Gating's current status and notify the maintainers

Related to scylladb/scylla-pkg#3644

Closes scylladb/scylladb#20742
2024-09-26 08:44:06 +03:00
Botond Dénes
24ac408a08 Revert "[script/pull_github_pr.sh] Check Gating status before merging"
This reverts commit ec0bb42b45.

This patch broke maintainer workflows, it needs more work before it can
land.
2024-09-24 16:53:02 +03:00
Yaron Kaikov
ec0bb42b45 [script/pull_github_pr.sh] Check Gating status before merging
Maintainers use scripts/pull_github_pr.sh from scylladb.git when merging PRs and before pushing to the next. We want to prevent merges from piling up on top of unstable builds. This change will check Gating's current status and notify the maintainers

Related to https://github.com/scylladb/scylla-pkg/issues/3644

Closes scylladb/scylladb#20742
2024-09-24 08:39:47 +03:00
Avi Kivity
4eb4ac4634 scripts: pull_gitgub_pr.sh: absolutize project reference
pull_gitgub_pr.sh adds a "Closes #xyz" tag so github can close
the pull request after next promotion. Convert it to an absolute
refefence (scylladb/scylladb#xyz) so the commit can be cherry-picked
into another repository without the reference dangling.

Closes #15424
2023-09-15 19:29:50 +03:00
Avi Kivity
a7099132cc scripts/pull_github_pr.sh: optionally authenticate
This helps overcome rate limits for unauthenticated requests,
preventing maintainers from getting much-needed rest.

Closes #13210
2023-03-19 15:16:02 +02:00
Avi Kivity
719724e4df scripts: pull_github_pr.sh: support recovering from a failed cherry-pick
If a single-patch pull request fails cherry-picking, it's still possible
to recover it (if it's a simple conflict). Give the maintainer the option
by opening a subshell and instructing them to either complete the cherry-pick
or abort it.

Closes #10949
2022-07-04 09:26:45 +03:00
Piotr Sarna
ddf83f6ddc scripts: make pull_github_pr.sh more universally usable
After 93b765f655, our pull_github_pr.sh script tries to detect
a non-orthodox remote repo name, but it also adds an assumption
which breaks on some configurations (by some I mean mine).
Namely, the script tries to parse the repo name from the upstream
branch, assuming that current HEAD actually points to a branch,
which is not the way some users (by some I mean me) work with
remote repositories. Therefore, to make the script also work
with detached HEAD, it now has two fallback mechanisms:
1. If parsing @{upstream} failed, the script tries to parse
   master@{upstream}, under the assumption that the master branch
   was at least once used to track the remote repo.
2. If that fails, `origin/master` is used as last resort solution.

This patch allows some users (guess who) to get back to using
scripts/pull_github_pr.sh again without using a custom patched version.

Closes #10773
2022-06-13 08:15:40 +03:00
Beni Peled
3abe4a2696 Adjust scripts/pull_github_pr.sh to check tests status
Closes #10263

Closes #10264
2022-05-11 14:46:30 +02:00
Nadav Har'El
ca700bf417 scripts/pull_github_pr.sh: clean up after failed cherry-pick
When pull_github_pr.sh uses git cherry-pick to merge a single-patch
pull request, this cherry-pick can fail. A typical example is trying
to merge a patch that has actually already been merged in the past,
so cherry-pick reports that the patch, after conflict resolution,
is empty.

When cherry-pick fails, it leaves the working directory in an annoying
mid-cherry-pick state, and today the user needs to manually call
"git cherry-pick --abort" to return to the normal state. The script
should it automatically - so this is what we do in this patch.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
2022-05-09 17:23:34 +03:00
Avi Kivity
93b765f655 scripts/pull_github_pr.sh: don't guess git remote name
The script assumes the remote name is "origin", a fair
assumption, but not universally true. Read it from configuration
instead of guessing it.

Closes #9423
2021-10-04 12:32:39 +03:00
Pavel Emelyanov
85d86cc85f scripts: Fix origin repo URL parsing
It assumes that the origin URL is git@ one while it can be
the https:// one as well.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
Message-Id: <20211001082116.7214-1-xemul@scylladb.com>
2021-10-01 13:22:06 +02:00
Nadav Har'El
cee0340c89 scripts/pull_github_pr.sh: do not hard-code project name
The current pull_github_pr.sh hard-codes the project name "scylladb/scylla".
Let's determine it automaticaly, from the git origin url.

This will allow using exactly the same script in other Scylla subprojects,
e.g., Seastar.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20210318142624.1794419-1-nyh@scylladb.com>
2021-06-06 19:18:49 +03:00
Nadav Har'El
e1c42f2bb3 scripts/pull_github_pr.sh: show titles of more than 20 patches
The script pull_github_pr.sh uses git merge's "--log" option to put in
the merge commit the list of titles of the individual patches being
merged in. This list is useful when later searching the log for the merge
which introduced a specific feature.

Unfortunately, "--log" defaults to cutting off the list of commit titles
at 20 lines. For most merges involving fewer than 20 commits, this makes
no difference. But some merges include more than 20 commits, and get
a truncated list, for no good reason. If someone worked hard to create a
patch set with 40 patches, the last thing we should be worried about is
that the merge commit message will be 20 lines longer.

Unfortunately, there appears to be no way to tell "--log" to not limit
the length at all. So I chose an arbitrary limit of 1000. I don't think
we ever had a patch set in Scylla which exceeded that limit. Yet :-)

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20200924114403.817893-1-nyh@scylladb.com>
2020-09-24 14:51:58 +03:00
Nadav Har'El
a2cc599a2a scripts/pull_github_pr.sh: some nicer messages
The script scripts/pull_github_pr.sh begins by fetching some information
from github, which can cause a noticable wait that the user doesn't
understand - so in this patch we add a couple of messages on what is
happening in the beginning of the script.

Moreover, if an invalid pull-request number is given, the script used
to give mysterious errors when incorrect commands ran using the name
"null" - in this patch we recognize this case and print a clear "Not Found"
error message.

Finally, the PR_REPO variable was never used, so this patch removes it.

Message-Id: <20200923151905.674565-1-nyh@scylladb.com>
2020-09-23 20:53:23 +03:00
Avi Kivity
a63a00b0ea scripts/pull_pr: don't pollute local branch namespace
Currently, scripts/pull_pr pollutes the local branch namespace
by creating a branch and never deleting it. This can be avoided
by using FETCH_HEAD, a temporary name automatically assigned by
git to fetches with no destination.
2020-09-23 15:47:51 +03:00
Avi Kivity
a81b731a1a scripts: pull_pr.sh: resolve pull request user name
Convert the github handle to a real name.

Closes #7247
2020-09-17 08:27:00 +02:00
Avi Kivity
4456645f97 scripts: pull_pr.sh: auto-close pull request after merge
Add a "Closes #$PR_NUM" annotation at the end of the commit
message to tell github to close the pull request, preventing
manual work and/or dangling pull requests.

Closes #7245
2020-09-16 10:23:34 +02:00
Pekka Enberg
c807c903ab pull_github_pr.sh: Use "cherry-pick" for single-commit pull requests
Improve the "pull_github_pr.sh" to detect the number of commits in a
pull request, and use "git cherry-pick" to merge single-commit pull
requests.
Message-Id: <20200713093044.96764-1-penberg@scylladb.com>
2020-07-13 17:14:44 +03:00
Piotr Sarna
e8871181eb scripts: add a script for pulling GitHub pull requests
In order to avoid the UI merge button which tends to
mess up commit authors, a simple script for pulling
a PR from GitHub is added.
Example usage:
 $ git fetch; git checkout origin/next
 $ ./scripts/pull_github_pr.sh 6007

Message-Id: <1fa79c8be47b5660fc24a81fc0ab381aa26d98af.1584014944.git.sarna@scylladb.com>
2020-03-12 21:37:05 +01:00