Skip to content

Commit 7bedfa1

Browse files
authored
Adds tools to bulk modify operator templating pull requests. (#26)
1 parent 839f0bc commit 7bedfa1

File tree

7 files changed

+103
-0
lines changed

7 files changed

+103
-0
lines changed

bulk-pr/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# PR Bulk Tools
2+
3+
This contains a selection of scripts that can be used to bulk manipulate similar PRs across a defined set of repositories.
4+
The requirement for PRs to be considered _similar_ for the purpose of these scripts is that the branch they are created from have the same name.
5+
6+
**WARNING:**
7+
These scripts do not contain much in the way of safety checks or security confirmations.
8+
You are expected to know what you are doing and should most probably conduct due diligence directly on the PRs before using these tools to approve them.
9+
10+
## Overview
11+
This section will give a brief overview of the tools contained in this repo.
12+
13+
The recommended workflow for PRs created by the operator templating is:
14+
15+
1. Run `pr_diff` and check for any unexpected changes
16+
2. Periodically run `pr_status` until all PRs show 0
17+
3. Run `pr_approve`
18+
19+
### Common parameters
20+
With the only exception of the `repos` script all scripts in this repository take the same parameter, which is the name of the branch the PRs you want to operate on was created from.
21+
22+
For example for a set of operator templating pull requests this will usually be in the form of `template_abd68ad` which is the fixed prefix `template_` followed by the short commit hash of the commit in the operator templating repo that it was based on.
23+
24+
### Configuration
25+
Configuration of all these tools is done in the `repos` script.
26+
This script doesn't take any parameters.
27+
It is sourced by all the other scripts and defines the list of operator repositories that should be included in bulk operations.
28+
29+
Edit this file if you want to exclude operators from bulk operations for some reason, or if new operators have been created that should be included.
30+
31+
## Scripts
32+
### pr_approve
33+
Approves all pull requests and adds a `bors r+` comment to start the bors merge process.
34+
35+
### pr_checks
36+
Shows all checks for all PRs and their current status.
37+
38+
Checks are shown per PR, hitting `q` switches to the next PR, Ctrl-C can be used to abort the entire script.
39+
40+
### pr_close
41+
Closes all PRs.
42+
43+
### pr_diffs
44+
Shows the diffs for all PRs, this can be useful to double check that no unexpected changes were queued in any repository by accident.
45+
46+
Diffs are shown per PR, hitting `q` switches to the next PR, Ctrl-C can be used to abort the entire script.
47+
48+
### pr_status
49+
Shows an abbreviated status of all PRs.
50+
51+
The displayed status per PR can have the following values:
52+
53+
| Status | Meaning |
54+
|--------|------------------------------------------------|
55+
| 0 | All checks were finished and successful |
56+
| 1 | One or more checks failed or are still running |

bulk-pr/pr_approve

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
source repos
3+
for product in "${products[@]}"; do
4+
gh pr review $1 --approve -R stackabletech/${product}-operator
5+
gh pr review $1 --comment -b "bors r+" -R stackabletech/${product}-operator
6+
done

bulk-pr/pr_checks

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
source repos
3+
for product in "${products[@]}"; do
4+
gh pr checks $1 -R stackabletech/${product}-operator
5+
done
6+

bulk-pr/pr_close

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
source repos
3+
for product in "${products[@]}"; do
4+
gh pr close $1 -R stackabletech/${product}-operator
5+
done

bulk-pr/pr_diffs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
source repos
3+
for product in "${products[@]}"; do
4+
gh pr diff $1 -R stackabletech/${product}-operator
5+
done
6+

bulk-pr/pr_status

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
source repos
3+
for product in "${products[@]}"; do
4+
gh pr checks $1 -R stackabletech/${product}-operator &> /dev/null
5+
status=$?
6+
echo ${product}: ${status}
7+
done
8+

bulk-pr/repos

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
products=(
3+
kafka
4+
opa
5+
regorule
6+
zookeeper
7+
trino
8+
druid
9+
hive
10+
hdfs
11+
nifi
12+
spark
13+
superset
14+
airflow
15+
hbase
16+
)

0 commit comments

Comments
 (0)