Commit Graph

226 Commits

Author SHA1 Message Date
d6a8d397da Fix formatting for merge failed message (#95234)
Fixes formatting so that the merge rule shows up on a different line than the "Raised by" text

Follow up to https://github.com/pytorch/pytorch/pull/94932

New version
<img width="433" alt="image" src="https://user-images.githubusercontent.com/4468967/220441349-ac99096d-590a-42c1-b995-4a23b2d9b810.png">
Pull Request resolved: https://github.com/pytorch/pytorch/pull/95234
Approved by: https://github.com/huydhn
2023-02-22 18:11:22 +00:00
da98053c6d Fix bug where a github api failure would prevent the label check from failing (#95098)
Fix bug where a github api failure would prevent the check from failing even if we already saw that labels were needed.

Also adds more debugging info to the rate limit exceeded error since it's weird to see an error claiming the rate limit has exceeded when the "Used" amount is way below the limit.  I suspect these happen when the request arrived just before the rate reset time, but the response was generated right after the reset time, hence the apparently tiny "used" amounts

Example run where the check should have failed, but passed instead:
https://github.com/pytorch/pytorch/actions/runs/4200205209/jobs/7285979824
Pull Request resolved: https://github.com/pytorch/pytorch/pull/95098
Approved by: https://github.com/huydhn
2023-02-21 18:42:12 +00:00
a863d5e37c Hide failing merge rule's name in the internal debugging section (#94932)
Fixes https://github.com/pytorch/test-infra/issues/1081

The merge rule name is not helpful to most readers, and most of the time it's just "superuser."  Move this to a less prominent place in the "Details for Dev Infra team" section
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94932
Approved by: https://github.com/huydhn
2023-02-16 04:20:10 +00:00
7c3fc2c7f0 Revert "Issue-88098: extract utils from check labels (#94597)"
This reverts commit 2c76838d7ff96cc7aa3a30cae54fded70e0bccc5.

Reverted https://github.com/pytorch/pytorch/pull/94597 on behalf of https://github.com/jeanschmidt due to reverting due internal breakages https://fburl.com/sandcastle/3ukij9xp
2023-02-13 20:19:50 +00:00
2c76838d7f Issue-88098: extract utils from check labels (#94597)
Fixes #88098

This is a mirror of the same PR (https://github.com/Goldspear/pytorch/pull/2) that has been reviewed in my fork (due to it's a stacked PR).

======================
## Context

This is the 2nd of the 3 PRs to address issue-88098.

## What Changed
1. Extract comment related utils from trymerge.py to github_utils.py
2. Extract label related utils from trymerge.py and check_labels.py to label_utils.py

## Tests
* pytorch-dummy repo [trymerge run ](https://github.com/Goldspear/pytorch-dummy/actions/runs/4118944174)merged the test PR [OK](https://github.com/Goldspear/pytorch-dummy/pull/2).

## Note to Reviewers
Due to higher degree of complexity involved to extract GitHubPR class, it's worth having a separate issue to handle that part of refactoring. This issue only focusing on refactoring where necessary to ship the functional diff.

* 1st PR: https://github.com/pytorch/pytorch/pull/94179
* 2nd PR: this one
* 3rd PR: https://github.com/Goldspear/pytorch/pull/3

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94597
Approved by: https://github.com/ZainRizvi
2023-02-12 12:18:53 +00:00
230c4fe93d [GHF] Fix pushDate handling (#94364)
Merge commits does not have a merge date, which is also clear from [GraphQL schema](https://docs.github.com/en/graphql/reference/objects#commit).
Modify return signature of `GitHubPR.last_pushed_at`, print warning when one can not be queried and add regression test.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94364
Approved by: https://github.com/huydhn
2023-02-08 05:52:03 +00:00
e9533767af trymerge to ignore certain failures (#91134)
For any failure in dr ci listed as "flaky" or "broken trunk" (aka anything not "new failures"), these get marked as "ok to fail".

If there are a small number (currently set to 3) ok to fail jobs, merge can still continue.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91134
Approved by: https://github.com/huydhn, https://github.com/malfet, https://github.com/seemethere
2023-02-07 17:19:57 +00:00
7fb2ac2bd5 Revert "trymerge to ignore certain failures (#91134)"
This reverts commit 8b7bd5dffccf342cacae510d6c5a6ca2665770b7.

Reverted https://github.com/pytorch/pytorch/pull/91134 on behalf of https://github.com/seemethere due to Breaks internal `github-export-checks` see failure: https://fburl.com/sandcastle/ggqj29pz
2023-02-04 08:08:32 +00:00
8b7bd5dffc trymerge to ignore certain failures (#91134)
For any failure in dr ci listed as "flaky" or "broken trunk" (aka anything not "new failures"), these get marked as "ok to fail".

If there are a small number (currently set to 3) ok to fail jobs, merge can still continue.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91134
Approved by: https://github.com/huydhn, https://github.com/malfet
2023-02-03 20:56:39 +00:00
7a621c443b [GHF] Fix ghstack branches in sync logic (#93298)
Test plan:
```python
from git_utils import are_ghstack_branches_in_sync,GitRepo
repo=GitRepo("/Users/nshulga/git/pytorch/pytorch")
are_ghstack_branches_in_sync(repo, "gh/SS-JIA/206/head")
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/93298
Approved by: https://github.com/clee2000, https://github.com/ZainRizvi
2023-01-30 21:00:51 +00:00
550983e39d Revert "Move check_label ci to mergebot (#92309)"
This reverts commit 190f7803f5d90d027f331eaf48ef5fa63f14737a.

As it broke revert workflow, see https://github.com/pytorch/pytorch/actions/runs/3963235531/jobs/6790838677
2023-01-19 15:33:10 -08:00
190f7803f5 Move check_label ci to mergebot (#92309)
Fixes #88098

### What Changed
* Moved `check_label.py` logic into `trymerge.py`
* Refactored relevant unittests
* ~~Dropped~~ Refactored `check_label.py` ci job

### Tests
`python .github/scripts/test_trymerge.py`
`python .github/scripts/test_check_labels.py`
`make lint & lintrunner -a`

### Notes to reviewers
This PR replaces the [original PR](https://github.com/pytorch/pytorch/pull/92225) to workaround the sticky EasyCLA failure mark on its first commit.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/92309
Approved by: https://github.com/ZainRizvi
2023-01-19 22:31:32 +00:00
34353a402e [mergebot] Flatten workflows into jobs, fix bugs (#92097)
* flatten the workflows into just jobs in order to give more specific links (link to the specific job that failed instead of just pull), this should make it easier to implement bypass certain failures in the future
* try catch of MandatoryChecksMissingError from find_matching_merge_rule should fix error where merge loops instead of raising runtime error when trunk job fails
* remove usage of on_green and mandatory_only flags just in case.  on_green and force are the only two behaviors we currently use
* fail if ghstack pr has non ghstack change, tested locally with #92177 but unsure how to write tests b/c requires use of repo._run_git
Pull Request resolved: https://github.com/pytorch/pytorch/pull/92097
Approved by: https://github.com/huydhn, https://github.com/ZainRizvi
2023-01-18 23:38:16 +00:00
3794b4643f [GHF] Record how many times PR is revered (#92180)
Or merged, by adding "revertedX2","revertedX3",... labels

Tested in https://github.com/malfet/deleteme/pull/36

Pull Request resolved: https://github.com/pytorch/pytorch/pull/92180
Approved by: https://github.com/ZainRizvi, https://github.com/kit1980
2023-01-13 23:18:38 +00:00
de4e4c785a [mergebot] Fix mergebot allow revert of codev diff (#91975)
mergebot was allowing non facebook-github-bot users to revert codev diffs when it shouldnt be allowed

Fixes https://github.com/pytorch/test-infra/issues/1381
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91975
Approved by: https://github.com/ZainRizvi, https://github.com/kit1980, https://github.com/malfet
2023-01-11 01:59:07 +00:00
1e768c63c1 Add merged label to ghstack prs (#90238)
not very elegant

other option might be adding something to pytorchbot to listen to push events for master?
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90238
Approved by: https://github.com/malfet, https://github.com/kit1980
2023-01-09 22:49:20 +00:00
60e196c241 Better url in trymerge (#90583)
example:
old: 453b510b2d/checks
new: https://github.com/pytorch/pytorch/actions/runs/3644518486
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90583
Approved by: https://github.com/kit1980, https://github.com/ZainRizvi
2022-12-12 19:19:56 +00:00
ffd54def8f [GHF] Remove CC line from commit message (#88252)
This line is added by autoCCBot, but is not really meaningful as commit
message

Test Plan:
```
>>> from trymerge import GitHubPR, RE_PR_CC_LINE
>>> import re
>>> pr=GitHubPR("pytorch", "pytorch", 87809)
>>> re.sub(RE_PR_CC_LINE, "", pr.get_body())
'Fixes #ISSUE_NUMBER\r\n\n\n'
>>> pr=GitHubPR("pytorch", "pytorch", 87913)
>>> re.sub(RE_PR_CC_LINE, "", pr.get_body())
'Parallel compilation warms the Threadpool when we call `torch._dynamo.optimize()`. In current benchmarks, we were setting up the TRITON_CACHE_DIR much later. Because of this parallel compilation artifacts were not used and compilation latency improvements were not visible in dashboard. This PR just prepones the setup of TRITON_CACHE_DIR.\n\n'
>>> pr=GitHubPR("pytorch", "pytorch", 85692)
>>> re.sub(RE_PR_CC_LINE, "", pr.get_body())
'This PR sets CUDA_MODULE_LOADING if it\'s not set by the user. By default, it sets it to "LAZY".\r\n\r\nIt was tested using the following commands:\r\n```\r\npython -c "import torch; tensor=torch.randn(20, 16, 50, 100).cuda(); free, total = torch.cuda.cudart().cudaMemGetInfo(0); print(total-free)"\r\n```\r\nwhich shows a memory usage of: 287,047,680 bytes\r\n\r\nvs\r\n\r\n```\r\nCUDA_MODULE_LOADING="DEFAULT" python -c "import torch; tensor=torch.randn(20, 16, 50, 100).cuda(); free, total = torch.cuda.cudart().cudaMemGetInfo(0); print(total-free)"\r\n```\r\nwhich shows 666,632,192 bytes. \r\n\r\nC++ implementation is needed for the libtorch users (otherwise it could have been a pure python functionality).\r\n\r\n'
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/88252
Approved by: https://github.com/xuzhao9, https://github.com/izaitsevfb
2022-11-01 22:17:12 +00:00
294bfb8e80 Create workflow to make sure PRs have valid labels (#86829)
### Context
When a dev submits a PR against the repo, we want to validate that they applied two labels to the PR corresponding the module they edited and the kind of change they're making.

### Change
Extended the open source workflow CI to add a validation to ensure that the PR being checked has the required labels on it.  If it doesn't, the check fails and a bot will post a message on the PR with instructions on what labels the developer needs to add (https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work).

### Impact
Every time a new version of PyTorch is released, we want to compile all the changes made to each module. However, when devs forget to tag their PR, compiling the changes to write the release notes becomes a burdensome process (only ~20% of PRs are currently labeled appropriately, which means it can take up to 40 hours to compile release notes). With this new validation, the hope is that most PRs are labeled accordingly for more timely release notes compilation.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86829
Approved by: https://github.com/ZainRizvi
2022-10-21 17:39:29 +00:00
77e68b16cc suggest rebasing through @pytorchbot if PR is stale (#86898)
Summary:

Test Plan: Testing on GitHub with `stale_pr_days` set to zero.

Reviewers:

Subscribers:

Tasks:

Tags:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86898
Approved by: https://github.com/malfet
2022-10-13 14:04:08 +00:00
1059d3b52d Make mergebot message clearer when starting a new merge (#86311)
Modifying how the merge started message appears to make it more readable.
Also removing some deprecated v1 land checks messages

Old:
<img width="917" alt="image" src="https://user-images.githubusercontent.com/4468967/194150650-c9e384a3-d13c-40aa-975d-f43853790603.png">

New:
<img width="933" alt="image" src="https://user-images.githubusercontent.com/4468967/194151507-a5900cd5-5711-4cab-9447-c2cc6ed0d7b5.png">
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86311
Approved by: https://github.com/malfet, https://github.com/huydhn
2022-10-06 18:47:07 +00:00
5ca0f9e1d4 [GHF] Make EasyCLA unskippable (#86161)
And make small update to the revert test to use mocked rules rather than latest ones
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86161
Approved by: https://github.com/zpao, https://github.com/weiwangmeta
2022-10-03 22:50:06 +00:00
2f692236fe [GHF] Add commit statuses to checkruns conclusions (#86129)
Needed to surface CircleCI/EasyCLA checks to the `mergebot` rules

Pull Request resolved: https://github.com/pytorch/pytorch/pull/86129
Approved by: https://github.com/huydhn
2022-10-03 17:41:43 +00:00
ddc56732ae [GHF][BE] Delete land checks branch when done (#84767)
Also, don't create this branch if running with dry-run

Pull Request resolved: https://github.com/pytorch/pytorch/pull/84767
Approved by: https://github.com/clee2000, https://github.com/huydhn
2022-09-10 02:45:35 +00:00
fddfc4488a Further improve mergebot messages (#84283)
Reword the rejection reasons to better match the format mergebot uses to output the message, and repoints the workflow links to point to the commit page in hud instead of github

**Context:** Some of the mergebot messages looked a bit weird. For example, it would claim to be offering a reason for a merge failing, but instead the message would be of a more diagnostic nature.

Example of a weird message ("view failures on hud" is not a reason!):

<img width="960" alt="image" src="https://user-images.githubusercontent.com/4468967/187495195-9f1cf6cc-49e3-42a1-8c29-b1e95027d0e2.png">

The above message would now look like:

<img width="967" alt="image" src="https://user-images.githubusercontent.com/4468967/187726065-ea93dc34-065f-47bd-acd4-78415329e5a6.png">

Pull Request resolved: https://github.com/pytorch/pytorch/pull/84283
Approved by: https://github.com/huydhn
2022-08-31 22:44:16 +00:00
7acdb2d564 Don't start land checks if the PR hasn't been approved yet (#84239)
Per title, don't start land checks if the PR hasn't been approved yet. This is very important to make sure that we don't start CI jobs from unknown devs, i.e. first time contributor.

Also rename force to `skip_mandatory_checks` to make it clearer on what this flag does

### Testing

```
python .github/scripts/test_trymerge.py
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/84239
Approved by: https://github.com/zengk95, https://github.com/ZainRizvi
2022-08-30 22:19:07 +00:00
adc54dc219 Give better error message when merge fails to find any rules (#84160)
Fixes #84147 and https://github.com/pytorch/test-infra/issues/421.

* If merge rule file is missing or fails to load for whatever reasons:

```
No rules find to match PR, please [report]{issue_link} this issue to DevX team.
```

* If the list of rules is empty:

```
Merges are not allowed into repository without a rules.
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/84160
Approved by: https://github.com/ZainRizvi, https://github.com/malfet
2022-08-29 23:50:26 +00:00
95863f2ccc Make mergebot failure messages more readable (#84214)
Reformat how mergebot outputs merge and revert errors to make the failure more obvious and hide text that doesn't actually help most users debug their PRs. (The workflow job helps the DevX team to debug mergebot errors)

### Old message:
<img width="933" alt="image" src="https://user-images.githubusercontent.com/4468967/187276407-fb35880c-5ada-4f1f-a01e-86b5071ab0fd.png">

### New message contents:
<img width="833" alt="image" src="https://user-images.githubusercontent.com/4468967/187276280-e7397edb-1887-41a2-b206-4d005b59f683.png">

### New message contents detailed expanded:
<img width="843" alt="image" src="https://user-images.githubusercontent.com/4468967/187276342-b50e6b28-f19e-4547-bf29-1a7878a3a97c.png">

Pull Request resolved: https://github.com/pytorch/pytorch/pull/84214
Approved by: https://github.com/malfet, https://github.com/huydhn
2022-08-29 22:15:20 +00:00
562a021cf3 [GHF] Land validation should not change default branch (#84084)
This prevents a loophole, where somebody submits a PR that modifies merge rules and request land validation, so that their PR will be validated against those rules, rather than ones currently in trunk.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/84084
Approved by: https://github.com/janeyx99, https://github.com/kit1980
2022-08-25 21:13:09 +00:00
caaa723ae2 [GHF][BE] Move merge rules to yaml (#84065)
To allow comments

Update `trymerge.yaml`, `revert.yaml` and `tryrebase.yaml` to use v4 setup-python action and install pyyaml

Reformat json to yaml by running:
```
 python -c "import yaml;print(yaml.dump(yaml.safe_load(open('.github/merge_rules.yaml')), sort_keys=False))"
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/84065
Approved by: https://github.com/b0noI, https://github.com/huydhn
2022-08-25 18:21:44 +00:00
f7e668b7b5 add hud link to merge failure message (#83946)
as in title, related to https://github.com/pytorch/test-infra/issues/568
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83946
Approved by: https://github.com/huydhn
2022-08-24 18:38:36 +00:00
4808bda796 Prefer signal from land checks over PR signals (#83715)
# The problem

When a dev forks their branch from a red master build, their branch can fail CI checks for reasons unrelated to their changes, but the same checks would however pass in the land validation commit (which is rebased off of viable/strict)

Today, in the above scenario the `merge -l` command fails because mergebot sees the failing checks in the PR, which is not helpful when that same check passes in land validation.

# The solution
This PR changes the behavior so that:
1. If both the PR and land validation ran a workflow, only look at the results from land validation
2. If only the PR ran a specific workflow (e.g. for CLA Check or a nightly run) then continue to look the result from the PR (which matches existing behavior)

### Bonus fixes
It also includes a few extra BE fixes:
- Replaces the tuple we used to pass workflow check results around with a named tuple so that it's easier to tell what data is being used
- Reduces the number of API calls to github by ~50% during merges.  Before, we were pulling results from github every time and then filtering it down to the relevant category of checks (e.g. failed/pending/startup_failed). Now, our filters share the check results
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83715
Approved by: https://github.com/zengk95
2022-08-23 21:55:02 +00:00
79356311f5 update merge failed msg (#83462)
Message seemed a bit incorrect to read
Ref: https://github.com/pytorch/pytorch/pull/82955#issuecomment-1215523319

Before PR:
```
Merge failed due to This PR is too stale; the last push date was more than 3 days ago. Please rebase and try again.
Raised by https://github.com/pytorch/pytorch/actions/runs/2862480424
```

After PR
```
Merge failed
Reason: This PR is too stale; the last push date was more than 3 days ago. Please rebase and try again.
Raised by https://github.com/pytorch/pytorch/actions/runs/2862480424
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/83462
Approved by: https://github.com/janeyx99, https://github.com/ZainRizvi
2022-08-16 20:31:46 +00:00
408fa38f33 [GHF] Validate graphql output (#83366)
If checkrun nodes are not instance of dictionary, skip them

Should prevent  https://github.com/pytorch/pytorch/pull/83215#issuecomment-1213617665 from happening in the future

Pull Request resolved: https://github.com/pytorch/pytorch/pull/83366
Approved by: https://github.com/kit1980
2022-08-13 13:41:30 +00:00
cf6a91b7f9 [BE] Fix lint in trymerge.py (#83293)
Not sure why lintrunner did not detect it before

Pull Request resolved: https://github.com/pytorch/pytorch/pull/83293
Approved by: https://github.com/kit1980
2022-08-11 21:30:58 +00:00
23b5fcaab9 [mergebot] Update merge bot messages to explain flags (#82907)
## FORCE
@pytorchbot successfully started a merge job. Check the current status [here](None).
The merge job was triggered with the force (-f) flag. This means your change will be merged **immediately**, bypassing any CI checks (ETA: 1-5 minutes). If this is not the intended behavior, feel free to use some of the other merge options in the [wiki](https://github.com/pytorch/pytorch/wiki/Bot-commands).
Please reach out to the [PyTorch DevX Team](https://github.com/pytorch/pytorch/wiki/Dev-Infra-Office-Hours) with feedback or questions!
## GREEN
@pytorchbot successfully started a merge job. Check the current status [here](None).
The merge job was triggered with the green (-g) flag. This means that your change will be merged once all checks on your PR have passed (ETA: 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the [wiki](https://github.com/pytorch/pytorch/wiki/Bot-commands).
Please reach out to the [PyTorch DevX Team](https://github.com/pytorch/pytorch/wiki/Dev-Infra-Office-Hours) with feedback or questions!
## LAND CHECKS
@pytorchbot successfully started a merge job. Check the current status [here](None).
The merge job was triggered with the land checks (-l) flag. If you did not specify this flag yourself,  you are likely enrolled in the [land checks rollout](https://github.com/pytorch/test-infra/blob/main/torchci/lib/bot/rolloutUtils.ts#L1-L34). This means that your change will be merged once all checks on your PR and the land checks have passed (**ETA 4 Hours**). If you need to coordinate lands between different changes and cannot risk a land race, please add the `ciflow/trunk` label to your PR and wait for signal to complete, and then land your changes in proper order. Having `trunk`, `pull`, and `Lint` pre-run on a PR will bypass land checks and the ETA should be immediate. If this is not the intended behavior, feel free to use some of the other merge options in the [wiki](https://github.com/pytorch/pytorch/wiki/Bot-commands).
Please reach out to the [PyTorch DevX Team](https://github.com/pytorch/pytorch/wiki/Dev-Infra-Office-Hours) with feedback or questions!
## LAND CHECKS
@pytorchbot successfully started a merge job. Check the current status [here](None).
The merge job was triggered with the land checks (-l) flag. If you did not specify this flag yourself,  you are likely enrolled in the [land checks rollout](https://github.com/pytorch/test-infra/blob/main/torchci/lib/bot/rolloutUtils.ts#L1-L34). This means that your change will be merged once all checks on your PR have passed since you have added the `ciflow/trunk` label to your PR (ETA 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the [wiki](https://github.com/pytorch/pytorch/wiki/Bot-commands).
Please reach out to the [PyTorch DevX Team](https://github.com/pytorch/pytorch/wiki/Dev-Infra-Office-Hours) with feedback or questions!
## NORMAL
@pytorchbot successfully started a merge job. Check the current status [here](None).
The merge job was triggered without a flag. This means that your change will be merged once all checks on your PR have passed (ETA: 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the [wiki](https://github.com/pytorch/pytorch/wiki/Bot-commands).
Please reach out to the [PyTorch DevX Team](https://github.com/pytorch/pytorch/wiki/Dev-Infra-Office-Hours) with feedback or questions!
## Revert Message
@pytorchbot successfully started a revert job. Check the current status [here](None).
Please reach out to the [PyTorch DevX Team](https://github.com/pytorch/pytorch/wiki/Dev-Infra-Office-Hours) with feedback or questions!
## TROUBLESHOOTING
 If you believe this is an error, you can use the old behavior with `@pytorchbot merge -g` (optionally with the `ciflow/trunk` to get land checks) or use `@pytorchbot merge -f "some reason here"`. For more information, see the [bot wiki](https://github.com/pytorch/pytorch/wiki/Bot-commands).
Please reach out to the [PyTorch DevX Team](https://github.com/pytorch/pytorch/wiki/Dev-Infra-Office-Hours) with feedback or questions!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82907
Approved by: https://github.com/huydhn, https://github.com/janeyx99
2022-08-11 14:25:15 +00:00
95c3e2370a [mergebot] Amend messages for land checks (#82649)
### Description
<!-- What did you change and why was it needed? -->
We forgot that the < was for comments in markdown. Also added a link to the wiki to the start land checks message so users can see why their PR is taking extra time to land.

### Issue
<!-- Link to Issue ticket or RFP -->
n/a

### Testing
<!-- How did you test your change? -->
n/a
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82649
Approved by: https://github.com/janeyx99, https://github.com/ZainRizvi
2022-08-02 17:44:06 +00:00
c041b2f158 [mergebot] Add Land Check Troubleshooting Message (#82580)
### Description
Land checks are new and people can get confused on how to use it. In this, we make it a bit clearer to the user that they can use pytorchbot merge -g or -f to merge it in if they believe that there's infra issues with the land check.

### Issue
N/a

### Testing
N/a. Lint should be enough.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82580
Approved by: https://github.com/huydhn
2022-08-01 22:09:16 +00:00
4f2a475f7f refactor add_conclusions in trymerge.py (#82371)
### Description
There were two very similar functions in trymerge so I tried to refactor so that they was less duplicated code.

### Issue
<!-- Link to Issue ticket or RFP -->

### Testing
<!-- How did you test your change? -->
Ran `python test_trymerge.py` to test
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82371
Approved by: https://github.com/huydhn
2022-07-29 07:25:05 +00:00
1c523f75a9 Allow PR collaborators revert PRs (#82360)
### Description
This enables COLLABORATORS for a repository to revert PRs if they discover a problem.

The main difference between a COLLABORATOR and a MEMBER is that a MEMBER has access to the entire pytorch organization, while a COLLABORATOR's access is limited to a specific repository.  But within that repository, granting them both revert rights seems quite reasonable

### Issue
This request originated from pytorchbot's refusal to revert this pr: https://github.com/pytorch/pytorch/pull/79694#issuecomment-1189460942

### Testing
CI
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82360
Approved by: https://github.com/malfet, https://github.com/janeyx99
2022-07-29 01:52:14 +00:00
11c7e7ae08 [GHF] Refactor + test for revert checks (#82381)
Refactor revert checks into `validate_revert` and add check for
`COLLABORATOR` but not a member

This is preliminary change for https://github.com/pytorch/pytorch/pull/82360
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82381
Approved by: https://github.com/ZainRizvi
2022-07-28 16:50:21 +00:00
925ebbe215 [mergebot] dont run land checks when trunk label is there (#82338)
### Description
<!-- What did you change and why was it needed? -->
As we're adding accept2run, we don't want to do the typical land validation if ciflow/trunk is already on the PR. In this case, we default to the on_green checks to make sure all the PR checks and trunk checks are green before merging it in.
### Issue
https://github.com/pytorch/test-infra/issues/448

### Testing

Tested it locally and made sure land checks was false and on_ green was true
```
LANDCHECKS False ONGREEN True
Attempting merge of https://github.com/pytorch/pytorch/pull/82338 (0.003352566560109456 minutes elapsed)
Traceback (most recent call last):
  File "/Users/kerryz/pytorch/.github/scripts/trymerge.py", line 1247, in main
    merge(args.pr_num, repo,
  File "/Users/kerryz/pytorch/.github/scripts/trymerge.py", line 1178, in merge
    find_matching_merge_rule(pr, repo)
  File "/Users/kerryz/pytorch/.github/scripts/trymerge.py", line 979, in find_matching_merge_rule
    raise RuntimeError(reject_reason)
RuntimeError: Matched rule OSS CI, but PR #82338 has not been reviewed yet
(pytorch) kerryz@kerryz-mbp pytorch %
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82338
Approved by: https://github.com/clee2000, https://github.com/huydhn
2022-07-28 15:49:49 +00:00
22bc497656 [GHF] Ignore cancelled workflows (#82359)
If both cancelled and successful/failed workflow with the same name
exist, ignore the conclusion of cancelled one

Fixes https://github.com/pytorch/pytorch/issues/82335

### Description
<!-- What did you change and why was it needed? -->

### Issue
<!-- Link to Issue ticket or RFP -->

### Testing
<!-- How did you test your change? -->

Pull Request resolved: https://github.com/pytorch/pytorch/pull/82359
Approved by: https://github.com/zengk95, https://github.com/janeyx99
2022-07-27 21:15:15 +00:00
767d740aab [mergebot] fix up land message (#82223)
### Description
Forgot a f to make it a f string.

### Issue
n/a

### Testing
let lint run

Pull Request resolved: https://github.com/pytorch/pytorch/pull/82223
Approved by: https://github.com/clee2000, https://github.com/huydhn, https://github.com/malfet
2022-07-26 22:23:54 +00:00
0b3037cbf6 [mergebot] set on green to true if it has ciflow (#82110)
### Description
<!-- What did you change and why was it needed? -->
We've had reports of people adding ciflow labels and then merging with the expectation that it wouldn't merge until everything was passing. This wasn't how merge worked because it only works for mandatory jobs, so now based on that feedback, we're waiting for all jobs if there's a ciflow/* label on the PR.

### Issue
<!-- Link to Issue ticket or RFP -->
n/a
### Testing
<!-- How did you test your change? -->
let tests run

Ran the trymerge locally and checked that on_green was true/false depending if the ciflow label was added

Pull Request resolved: https://github.com/pytorch/pytorch/pull/82110
Approved by: https://github.com/ZainRizvi, https://github.com/malfet, https://github.com/huydhn
2022-07-26 18:09:54 +00:00
03ebe6d1d9 add workflow name to conclusions dictionary in trymerge (#82026)
Xla hash updates were failing because the merge rules json was looking for the name of the job in the format `<workflow name> / <job name>` but try merge just has `<job name>`.

An easier solution would be to just get rid of pull in the merge rules but I think it would be better to keep to this naming convention.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82026
Approved by: https://github.com/kit1980, https://github.com/zengk95, https://github.com/huydhn
2022-07-23 03:28:48 +00:00
eaaaafdb37 Remove unused approved_by (#81741)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81741
Approved by: https://github.com/huydhn
2022-07-20 03:45:43 +00:00
e5a504d45d [GHF] Report workflow startup failures (#81521)
Because they are not reported in signal box and as such very easy to
miss, see https://github.com/pytorch/pytorch/pull/81044 for example

TODO: Figure out how hard it it to adapt [actionlint](https://github.com/rhysd/actionlint) to validate composite workflows

Pull Request resolved: https://github.com/pytorch/pytorch/pull/81521
Approved by: https://github.com/kit1980, https://github.com/clee2000
2022-07-15 00:34:32 +00:00
e8fe11faf9 [merge bot] Migrate Rest API to GraphQL (#81264)
Before, we were using the Rest API to get the land checks but it's better to use graphql for rate limiting reasons and for pagination. This PR switches it over to using graphql.

Should also fix https://github.com/pytorch/pytorch/issues/81152

Test Plan:
Tested it locally and added additional tests
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81264
Approved by: https://github.com/malfet
2022-07-14 15:35:29 +00:00
7ce92d7fac [mergebot] combine land check and job started comments (#80965)
Addresses https://github.com/pytorch/pytorch/issues/80923

The alternative to this is editing the start comment to include the land checks details, but I think it might be a bit misleading because the land check branch creation might not be there when the person first clicks on it when they get a notification.  This might be a bit annoying cause then the user won't be able to look at their progress.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80965
Approved by: https://github.com/malfet
2022-07-13 18:47:51 +00:00