Giter VIP home page Giter VIP logo

ansibullbot's Introduction

Build Status codecov

See the Ansibullbot Project Board for what is being worked on: Project Board

User Guide

If you are looking for help, please see the ISSUE HELP

Ansibull Github Issue/Pullrequest Bot

$ ./triage_ansible.py --help
usage: triage_ansible.py [-h] [--cachedir CACHEDIR_BASE] [--logfile LOGFILE]
                         [--daemonize]
                         [--daemonize_interval DAEMONIZE_INTERVAL] [--debug]
                         [--dry-run] [--force] [--pause] [--dump_actions]
                         [--botmetafile BOTMETAFILE]
                         [--repo {ansible/ansible}] [--skip_no_update]
                         [--collect_only] [--sort {asc,desc}]
                         [--skiprepo SKIPREPO] [--only_prs] [--only_issues]
                         [--only_closed]
                         [--ignore_state] [--ignore_bot_broken]
                         [--ignore_module_commits] [--pr PR]
                         [--start-at START_AT] [--resume] [--last LAST]
                         [--commit ANSIBLE_COMMIT] [--ignore_galaxy]
                         [--ci {azp}]

Triage issue and pullrequest queues for Ansible. (NOTE: only useful if you
have commit access to the repo in question.)

optional arguments:
  -h, --help            show this help message and exit
  --cachedir CACHEDIR_BASE
  --logfile LOGFILE     Send logging to this file
  --daemonize           run in a continuos loop
  --daemonize_interval DAEMONIZE_INTERVAL
                        seconds to sleep between loop iterations
  --debug, -d           Debug output
  --dry-run, -n         Don't make any changes
  --force, -f           Do not ask questions
  --pause, -p           Always pause between prs|issues
  --dump_actions        serialize the actions to disk [/tmp/actions]
  --botmetafile BOTMETAFILE
                        Use this filepath for botmeta instead of from the
                        repo
  --repo {ansible/ansible}, -r {ansible/ansible}
                        Github repo to triage (defaults to all)
  --skip_no_update      skip processing if updated_at hasn't changed
  --collect_only        stop after caching issues
  --sort {asc,desc}     Direction to sort issues [desc=9-0 asc=0-9]
  --skiprepo SKIPREPO   Github repo to skip triaging
  --only_prs            Triage pullrequests only
  --only_issues         Triage issues only
  --only_closed         Triage closed issues|prs only
  --ignore_state        Do not skip processing closed issues
  --ignore_bot_broken   Do not skip processing bot_broken|bot_skip issues
  --ignore_module_commits
                        Do not enumerate module commit logs
  --pr PR, --id PR      Triage only the specified pr|issue (separated by
                        commas)
  --start-at START_AT   Start triage at the specified pr|issue
  --resume              pickup right after where the bot last stopped
  --last LAST           triage the last N issues or PRs
  --commit ANSIBLE_COMMIT
                        Use a specific commit for the indexers
  --ignore_galaxy       do not index or search for components in galaxy
  --ci {azp}            Specify a CI provider that repo uses

ansibullbot's People

Contributors

abadger avatar akasurde avatar ansible-atomic avatar ansibull avatar caphrim007 avatar dagwieers avatar dharmabumstead avatar dmsimard avatar emonty avatar flowerysong avatar gregdek avatar gundalow avatar jasperla avatar jctanner avatar jjshoe avatar lujeni avatar mattclay avatar mkrizek avatar nerzhul avatar pilou- avatar resmo avatar robinro avatar robynbergeron avatar ryansb avatar samccann avatar samdoran avatar tedder avatar trishnaguha avatar webknjaz avatar willthames avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansibullbot's Issues

Double-comments sometimes happen for community_review

Sometimes something will be pushed into community_review for two different reasons -- typical case appears to be that needs_rebase is fixed, and the submitter says "ready_for_review". Should set the action queue to dedup before taking actions.

PRs that sit for more than a week waiting for a maintainer response should verify that previously pinged maintainer is still the maintainer.

No useful state change since last pass can sometimes be due to the person previously maintaining it is no longer the maintainer, but the new maintainer has not been pinged. (See ansible/ansible-modules-core#2639.)

Alternative solutions:

  • Verify every time the bot runs through a PR that the current maintainer has been pinged / mentioned at least once by the bot in a comment, so that when maintainership transfers/additions happen, the new person can also be pinged.
  • When a line in the maintainers file changes, have a bot search all the PRs for old / previous maintainers, ping new / updated list of maintainers.

Removing "pending action" prematurely

Bot keeps trying to remove pending_action labels. Example: Core 1985.

When a bot user puts something into pending action, we should leave it there until it's removed by a subsequent submitter action, a reviewer action, or a bot action.

prbot does not handles state well

I did a deeper review how the prbot is working and I found that it does not handle state correctly.

The PR defines actions based on current comments and labels, it also handles boilerplates e.g. warning for current comments an label.

However it does not implicate the actions.

As a result of it, the bot could suggest giving a warning for a PR in community_review even if the actions has a shipit. I also found that if the maintainer of a module changes, it is not going to be handled correctly.

(Ironically this is what all ansible modules have to handle and what ansible is all about... :) )

So how we can fix that:

  1. we find the current state
  2. find out in which state the PR should be aka desired state
  3. we get the path from current state to desired state by defining actions.

I don't see a easy way to implement this properly in the current bot. I plan to give it a rewrite this weekend.

However I also make a PR for a few problems I found while testing the current bot.

Add "adopt_me" to modules without maintainers

For modules that are maintained by core, we really need some kind of "adopt_me" boilerplate.

Then, if a non-bot user says "adopt_me", we label it somehow and kick it into a separate module adoption process (details tba).

Handle backport requests

Any request that comes in for a backport to Ansible 1.9 (or perhaps any non-devel branch) should be handed directly to the core team with its own boilerplate, and should also be labeled "backport".

Expand boilerplate

The truncated boilerplate is perhaps too short -- need to adjust it still.

New pr bot state: "WIP"

The goal of the "WIP" (work in progress) state is to tell the bot to just leave it alone for now. Proposal:

  • Any PR with "WIP or [WIP]" at the start of the title is labeled "WIP"
  • Any PR labeled "WIP" but does not have "WIP" in the title has label removed
  • Boilerplate telling people "this PR is a work-in-progress. @submitter, when you're ready to have this PR reviewed, please remove WIP from the title of the PR."
  • Any PR in WIP is otherwise ignored completely by the bot.

plz2implement oauth tokens

I've hit the limit 2-3x in the past week and had to basically stop midstream (and then go back from the beginning, ugh).

Not a fire but sure would be nice. :)

Stop and/or notify if no maintainer is found

New bot seems to ignore the case when an existing module does not yet have a maintainer listed.

Previous bot treated this as FATAL, and I would immediately stop the run and edit the appropriate maintainers file.

New behavior should probably be to skip and and send some kind of notification to the bot team.

Friendly reminder prompt should include reminder to say "ready_for_review"

The "friendly reminder" prompt should remind people that when they do eventually address the issues with the PR, they should leave a comment stating "ready_for_review" so that it can be handled properly.

ansible/ansible-modules-extras#1354 is an example of how the lack of this can go awry. In this particular case, the maintainer changed from previous maintainer to the core team (also, when we reassign it to the core team, we should prompt them to tell the submitter to say ready_for_review as well, but I'll make a separate issue for that.), who then commented on some diffs, which then got updated, but the submitter never stated ready_for_review, and thus the maintainer has not been pinged for review.

Text currently says:
"@submitter: A friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open pending your changes.

[This message brought to you by your friendly Ansibull-bot.]"

It should say:
"@submitter: A friendly reminder: this pull request has been marked as needing your action. If you still believe that this PR applies, and you intend to address the issues with this PR, just let us know in the PR itself and we will keep it open pending your changes. When you do address the issues, please respond with ready_for_review in your comment, so that we can notify the maintainer."

[This message brought to you by your friendly Ansibull-bot.]"

Handle "new module" vs. "no owner" correctly

Default behavior when we don't find a match in the MAINTAINERS file is to assume that we're dealing with a new module. This is incorrect.

The right thing to do: look at the file diff. If there's no code in the a: side of the diff, then and only then should we assume new module. If we find a file that's clearly existing with no maintainer, we should warn appropriately.

Add timeout functionality

Here's the workflow, I think:

  • Issue touched by no one in two weeks?
    • If community_review and new_plugin, ignore (we need something better here)
    • If community_review and not new_plugin and not pending_action:
      • If <=2 last comments are bot pings, ping maintainer
      • If >2 last comments are bot pings, put in pending_action
    • If community_review and not new_plugin and pending_action:
      • Flag "orphaned" (and figure this process out!)
    • If core_review, touch ("still waiting for core team, thx for your patience") and move on.
    • If needs_* and not pending_action, put in pending_action
    • If needs_* and pending_action, close

Notify co-maintainers of shipit event when owner_pr

In the cases of modules or files with multiple maintainers, when one of the co-maintainers submits a PR (and thus, gets labeled owner_pr and is merged automagically), when we apply the shipit label we should ping the other co-maintainers as a polite heads-up.

(I don't know if this means we should handle the case where one of those maintainers then wants to move it out of shipit in the short time period between shipit label and actual merge, or if it can still be moved out of shipit via a needs_revision comment at that point or not, at least as the code stands today.)

Change "owner_pr" process

Per discussion on mailing list:

  • do away with owner_pr tag, as it's superfluous
  • new owner_pr boilerplate that says: "This module is going into community review. We notice that you are maintainer of this module, so when you think it's ready, please comment "shipit" and we will consider it for merging."
  • change the current "owner_pr" behavior to put an owner_pr into community_review instead of shipit.

When changing maintainer to core_review, need to ensure somehow that we prompt them for "shipit" or "needs_revision"

ansible/ansible-modules-extras#1354 is an example.

The maintainer was changed to the core team, who requested revisions in a diff, but did not state the regular boilerplate that is normally given to maintainers ("please review according to guidelines (http://docs.ansible.com/ansible/developing_modules.html#module-checklist) and comment with text 'shipit' or 'needs_revision' as appropriate.") In this case the core team manually changed the label to needs_revision, but didn't state needs_revision, and thus the maintainer was not pinged for some time until the bot noticed that it was in a needs_revision state for X number of days, and then it prompted him.

Perhaps this should be an "anytime the reviewer is changed from community_review label to core_review label, add core_review boilerplate text" (which should be fixed also, because it says nothing about shipit vs. needs_revision, but that's yet another ticket.)

Fast operation mode

Right now we break for all PRs for which there are no actions recommended.

We could save a lot of time if we just skip over those PRs with a summary at the end of the PRs that we skipped, and streamline the output.

prbot dies when attempting to add boilerplate -- "AttributeError: 'list' object has no attribute 'replace'

Found while running triage on core. Using the new and improved prbot.py freshly updated yesterday.


3099 --- Fix: Incorrect parameters for module.set_fs_attributes_if_different in file.py
Labels: []
Submitter: bassco
Maintainer(s): ansible
Filename(s): files/file.py

RECOMMENDED ACTIONS for ansible/ansible-modules-core#3099
newlabel: core_review
boilerplate: core_review_existing

Take recommended actions (y/N)?y
LABELS_URL: https://api.github.com/repos/ansible/ansible-modules-core/issues/3099/labels{/name}
COMMENTS_URL: https://api.github.com/repos/ansible/ansible-modules-core/issues/3099/comments
Traceback (most recent call last):
File "./prbot.py", line 587, in
triage(shortpull['url'])
File "./prbot.py", line 531, in triage
mtext = pr_maintainers.replace(' ', ' @')
AttributeError: 'list' object has no attribute 'replace'

New modules in Core go into Core Review

Title says it all. We don't encourage new modules in Core, so they should go immediately into core_review (where the core team can say "yes" or "please refile in extras").

Add a "close_me" state

Sometimes a PR just isn't going to be accepted; maybe it's a duplicate, for instance. In that case, we should provide a mechanism for the maintainer of the module to request closure of the module.

Disallow new module requests in core

We can always have exception cases, but the tool should by default say "no thanks, please submit to extras" when it sees a new module request in core.

Changing PR states for unclear reasons

Some instances of a PR being put into a review state when it's already in a needs state:

  • (e1793, e1722, c2438, c2278, c1665) Trying to take a PR in "needs_info" state and putting it back into community_review/core_review. Bot should leave it in "needs_info" until we get an explicit ready_for_review.
  • (e1663, c3015) Trying to take a PR in "needs_revision" state and putting it back into community_review. Not sure why.
  • (e1480) Trying to take a PR in "needs_rebase" state and putting it back into community_review. Not sure why.

hasty "shipits" for owner_prs for new modules

2:35 PM gregdek: ansibull-bot marked 'shipit' on a PR that was only meant to be a comment
2:35 PM ansible/ansible-modules-extras#1370 (comment)
2:35 PM it was just that good
2:35 PM → cloudtrainme joined ⇐ kushal quit
2:36 PM hehe. ansibull-bot is 2 days early. april 1st isn't until friday
2:36 PM → josuebrunel joined ⇐ ageorgop quit
2:36 PM <•gregdek> Ah, thanks. Looks like the bot is too aggressively giving "shipits" for new modules. resmo: ^^^
2:36 PM → ppinkert_ joined (~[email protected])
2:37 PM <•gregdek> Gave "owner_pr shipit" to a module that isn't a module yet. :)

Add the ability to specify an individual pull request

Sometimes you need to debug the triaging of a single PR, and you don't want to go over the entire list just to get to the wonky PR. Add a mode in which you can specify and handle a single PR (or maybe a list of PRs.)

Metrics after each run

We should be getting automated metrics from this as well. We should collect:

  • Number of issues in each state
  • Average open time?

...and put into a spreadsheet somewhere.

This is probably best for when it's fully automated.

Periodically cross-check maintainer line in module against maintainers_core/extras files.

See ansible/ansible-modules-core#2653 -

Note that:

  • Mark filed a PR to remove himself as maintainer and added ansible core team to some mysql modules
  • Brian merged it
  • maintainers_core, on the other hand, lists jmainguy as the maintainer

(This, ultimately, has hosed PRs such as ansible/ansible-modules-core#2639 -- who should be pinging someone new, presumably jmainguy?)

Alternately: We remove the maintainer line out of all modules?

Handle needs_info cases

Probably the right thing to do, for now, is just to flag them every single time. "Hey, this is still in needs_info, should we do something about it?" The goal is always to resolve needs_info into some other state as quickly as possible -- and anything that stays in needs_info for too long should probably just be closed by hand.

When the core_review label is applied, apply appropriate text including "shipit" or "needs_revision" wording.

ansible/ansible-modules-extras#1707 is an example.

Text currently says:

"Thanks @submitterofstuffandthings for this PR. This module is maintained by the Ansible core team, so it can take a while for patches to be reviewed. Thanks for your patience.

[This message brought to you by your friendly Ansibull-bot.]"

It should probably say,

"Thanks @submitterofstuffandthings for this PR. This module is maintained by the Ansible core team, so it can take a while for patches to be reviewed. Thanks for your patience.

Core team: please review according to guidelines (http://docs.ansible.com/ansible/developing_modules.html#module-checklist) and comment with text 'shipit' or 'needs_revision' as appropriate.

[This message brought to you by your friendly Ansibull-bot.]"

And this is for a few reasons:

  • Keep consistency for community_review and core_review items; we don't want to confuse issue submitters with what may appear to be different types of workflow.
  • Core folks should be using the proper bot word tags to ensure that the bot workflow behaves correctly and providing text to also appropriately prompt submitters / issue creators to do the right thing. Additionally, even if the core team "knows" that they should do this, it still lacks consistency (as mentioned above) and the addition of more core team members may mean that a new member may not know to do this.

Also:

  • Should also ask core team to not manually change labels if possible to avoid breaking bot workflow.
  • Not sure how this applies in the shipit case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.