Skip to main content

Overview

RecBot is a feature of the nOps GitHub App that reviews pull requests that change infrastructure as code. When a pull request touches a resource with an open nOps recommendation, RecBot comments on it, so the engineer making the change sees the savings opportunity while they’re already working on that resource. The nOps GitHub App carries every nOps feature for your repositories, and you choose which ones are on for each GitHub account you install it on. RecBot’s comments come from the nOps GitHub App and say Reviewed by nOps RecBot. On each pull request, RecBot posts:
  • A summary comment listing the recommendations the change touches, with their estimated monthly savings, followed by other open recommendations on resources the repository manages.
  • Inline comments on the changed lines that a recommendation applies to.
  • A nOps RecBot check with the result. The check is informational: it finishes as success, neutral, or skipped, and never blocks a merge.
Every recommendation links to its page in nOps, where you can see the details, mark it implemented, or create a ticket. RecBot labels what the change does to each recommendation: It also says how sure it is that the code and the recommendation are about the same resource: Exact match, Likely match (the name is built from variables or modules only known when Terraform runs), or Judged related.
RecBot is in early access. If you don’t see the nOps GitHub App card in nOps, contact your nOps account team.

What RecBot reads

RecBot reads Terraform (including .tfvars, local modules, and YAML or JSON config read with yamldecode(file(...))), CloudFormation, AWS CDK, and Kubernetes manifests.
  • For each pull request: the diff, plus the infrastructure files the diff only shows part of, such as the rest of a changed module, the variables it sets, and the config files it reads.
  • Once per repository, and again after each merge to the default branch: the infrastructure files on the default branch. From these, nOps stores only the list of resources the repository declares (names, IDs, file, and line), not the code.
RecBot matches resources against your existing nOps recommendations. It doesn’t create new recommendations, and it can only comment on resources that have open recommendations in nOps.

Permissions

The nOps GitHub App requests these GitHub App permissions, which cover all of its features: The App never pushes code, opens pull requests, approves or requests changes, or changes repository settings. You choose which repositories it can see when you install it on GitHub.

Connect RecBot

You need permission to manage integrations in nOps, and permission to install GitHub Apps on the GitHub organization (usually an organization owner).
  1. In nOps, go to Settings → Integrations → Notifications and click the nOps GitHub App card.
  2. GitHub opens. Choose the organization, then All repositories or the repositories you want reviewed, and click Install.
  3. GitHub returns you to nOps, which links the installation to your nOps account. A dialog lists the App’s features for that GitHub account; RecBot is on. Click Done.
The card then shows GitHub connected. To connect another GitHub organization, click the card (Manage →) and then Add GitHub account.
Start the install from nOps. An install started directly on GitHub isn’t linked to any nOps account, so RecBot can’t review anything. If that happens, click the nOps GitHub App card in nOps and finish the link from there; you don’t need to uninstall the App first.
Reviews run as the nOps user who connected the App, using that user’s access to your nOps data. If that user loses access to your nOps account, reviews stop until someone else connects the App again.

Turn RecBot on or off

Click the nOps GitHub App card (Manage →) and use the RecBot switch for each GitHub account. While RecBot is off for an account, it posts no comments and no check on that account’s pull requests, and the App’s other features keep working. Turn it back on to resume reviews on new commits.

When RecBot reviews

RecBot reviews a pull request when it’s opened, updated with new commits, reopened, or marked ready for review. It skips:
  • Draft pull requests, until they’re marked ready for review.
  • Pull requests from forks, since anyone can open those.
To review a pull request again, comment nops run (or /nops run, or nops review) on it, or click Re-run on the nOps RecBot check. Both need write access to the repository.

Disconnect

To stop only RecBot, turn it off as described above. To remove the App and every nOps feature from a GitHub organization, uninstall it on GitHub (your organization’s Settings → GitHub Apps → nOps → Uninstall). nOps marks the connection disconnected and the App stops working there.

Troubleshooting

  • No comment on a pull request: Check the nOps RecBot check on the pull request. Skipped gives the reason (draft, fork, or not linked to nOps). No open recommendations touched means nothing in the change has an open nOps recommendation.
  • “Installation is not linked”: The App was installed from GitHub, not from nOps. Click the nOps GitHub App card in nOps to link it.
  • “RecBot is off”: Someone pressed Re-run while RecBot is switched off for that GitHub account. Turn it on from the card’s Manage dialog.
  • A recommendation you expected is missing: RecBot only shows open recommendations. Check that the recommendation is open in nOps and that the resource’s name in the code can be resolved from the repository, not only from values passed in at deploy time.
  • The check doesn’t appear at all: Make sure RecBot is on for that GitHub account, and that the repository is one of the repositories you chose when installing the App on GitHub.