Home

Awesome

Renovate - Hands On Tutorial

Introduction

Welcome to the Renovate hands-on tutorial.

This tutorial is based on the Mend Renovate App. You can also run Renovate as a CLI tool or a self-hosted application.

[!NOTE] Although this tutorial is based on the Mend Renovate App, the concepts discussed apply to all environments.

In this tutorial, you will learn how to configure Renovate and become familiar with some of the basic features.

What you will learn:

  1. Installation
  2. Onboarding
  3. Getting to know Renovate’s update PRs
  4. Dependency Dashboard

We will begin this tutorial with configuring and installing the Mend Renovate App and an overview of the default settings and basic functionalities.

Later, we will dive deeper into functional use-cases, advanced features, and best practices so you'll know how to leverage Renovate to its fullest.

Part 1 - Installation

Let’s start by forking the tutorial repo to your account, installing the Mend Renovate App, and configuring it to your repo.

  1. Make sure you are logged in to GitHub.com
  2. Fork this repository. The tutorial instructions will be based on its contents.
  3. The following instructions are directed at those that don’t have the Mend Renovate App installed:
  4. If you do have the Mend Renovate App installed:
  5. You will reach an installation configuration page where you are asked to configure Repository Access.

Note for existing users, installation configuration appears at the bottom of the page.

<img width="629" alt="configuration page" src="https://user-images.githubusercontent.com/102745725/178964980-df55dafd-f087-433a-90f7-986fa01c1ac0.png">

For new installs:

image

<img width="600" alt="sign in page" src="https://github.com/Gabriel-Ladzaretti/tutorial/assets/97394622/0a615573-6482-44e4-a79b-07d4356ee574">

Congratulations! You have successfully installed Renovate to your account. 🎈

Part 2 - Onboarding

Now you have installed the Mend Renovate App, we can begin onboarding.

Let’s review the concepts of the Onboarding PR and learn about Renovate’s initial settings.

[!NOTE] Renovate waits for you to finish onboarding, before making changes to your repo or raises PRs.

Let’s review the onboarding PR:

  1. Navigate to the Pull Requests section in GitHub, and open the newly generated PR - Configure Renovate
<img width="1500" alt="onboarding PR" src="https://user-images.githubusercontent.com/102745725/178965966-76aa3941-cac4-4df3-bd89-75b9f8002924.png"> <img width="935" alt="onboarding content" src="https://user-images.githubusercontent.com/102745725/178966039-b11315b8-8c75-416b-9f18-c8109c17d0ab.png">

The onboarding PR contains:

[!NOTE] Renovate only creates dependency update PRs after you merge the onboarding PR.

These are some of the default configurations of Renovate:

Renovate offers the ability to change configurations before merging the onboarding PR as well as preview the results of these changes. At this point, Renovate has created a branch called renovate/configure which contains the renovate.json configuration file. By default, Renovate limits branch creation to 2 per hour:

<img width="829" alt="onboarding warning hourly" src="https://user-images.githubusercontent.com/102745725/178961193-2f1f1548-5282-4d33-b8ef-6e141f0a643d.png">

Example

As a user, despite Renovate’s suggestion to limit hourly PR creation to 2, we might want to increase the limit to a different number. Let’s try changing this hourly limitation to 3:

  1. Go to the newly created branch - renovate/configure:
<img width="763" alt="new branch" src="https://user-images.githubusercontent.com/102745725/178966974-35c089c6-4190-4721-b1c2-956d84e80d07.png">
  1. Go into the renovate.json file:

image

  1. Add the following code segment:
{
  "prHourlyLimit": 3
}
<img width="591" alt="change in config 1" src="https://user-images.githubusercontent.com/102745725/178967120-51ec5940-42bc-444e-8c4d-b98ea4ee5948.png">
  1. Commit the changes
  2. Revisit the onboarding PR and notice how the onboarding PR automatically updates to reflect the changes you made to the configuration
<img width="830" alt="onboarding warning hourly update" src="https://user-images.githubusercontent.com/102745725/178960884-40077a5c-8fe1-422f-81c1-567ea1e6619b.png">

[!NOTE] May take a few moments to update.

  1. Merge the onboarding pull request.

Congratulations! You have successfully onboarded Renovate. 🎈

Part 3 - Getting to know Renovate’s update PRs

Now that you have merged the onboarding PR, Renovate will generate Update PRs to the most recent dependency version based on your configuration.

[!NOTE] PRs may take a couple of minutes to appear.

Here we will review the basic concepts of Renovate update PRs and merge it.

Let’s go ahead and take a look at a Renovate update PR:

  1. Navigate to the Pull requests section and open - Update dependency lodash to x.y.z
<img width="1256" alt="open PRs" src="https://user-images.githubusercontent.com/102745725/178967929-690b3866-190b-4576-a961-981ce78cbd1b.png">

Each update PR contains:

image

<img width="1488" alt="file diff lodash" src="https://user-images.githubusercontent.com/102745725/178968020-865560f7-173c-4e9e-a073-488147dbb137.png">
  1. Merge this pull request

[!NOTE] Renovate is highly configurable and supports:

All the above and more will be discussed in future parts of the tutorial.

Congratulations! You have now updated your first dependency with Renovate. 🎈

Part 4 - Dependency Dashboard

Renovate’s Dependency Dashboard is a GitHub Issue that enables you to manage and monitor Renovate’s activity in your repo. In this section, we will go over some of its main functionalities and capabilities.

Let’s begin by creating and enabling the Dependency Dashboard. Since GitHub defaults to disable issues on forked repositories, we need to enable it on the forked RenovateTutorial repo:

  1. Go to the main page of the repo
  2. Go to settings -> general
  3. Check the issues checkbox under the Features section:
<img width="1284" alt="issues settings" src="https://user-images.githubusercontent.com/102745725/178968523-fb002cf1-2510-4b4f-b840-f9776e660d92.png">

[!NOTE] This is usually done in a click via the Dependency Dashboard.

  1. Go to the Pull requests section
  2. Select Update dependency php to v8.1 and select Close pull request
<img width="927" alt="close php" src="https://user-images.githubusercontent.com/102745725/178969009-7239db99-4abe-44d1-a86c-a0effdf6fb7a.png">
  1. This will trigger Renovate to run and the Dependency Dashboard will appear under the Issues section - navigate to it

[!NOTE] It may take a minute to appear.

The Dependency Dashboard includes:

<img width="942" alt="Screen Shot 2022-07-14 at 14 05 40" src="https://user-images.githubusercontent.com/102745725/178968912-24ef22ec-fc98-4bf1-a293-9fb5dbf4c1b8.png">

Users can manually trigger the creation of dependency updates directly from the dashboard.

You can also re-run Renovate manually from the Dependency Dashboard by enabling the “Check this box to trigger a request Renovate to run again on this repository” option:

<img width="867" alt="rerun renovate" src="https://user-images.githubusercontent.com/102745725/178969114-c1b64333-b45a-4508-b638-1e25ad0adab5.png">

Let’s dive into one of the Dependency Dashboard capabilities - the Pending Approval feature.

Say we want to take extra measures before updating major versions of a package (either to reduce noise or to handle it more carefully). Renovate offers an option to prevent automatic creation of major version update PRs and create such PRs only upon manual request from the Dependency Dashboard.

In the Dependency Dashboard, under the Rate Limited section, the Update dependency commander to vX is waiting to be created.

[!NOTE] Based on the previously set prHourlyLimit configuration, 3 PRs per hour in our case, this PR will be created within an hour.

<img width="928" alt="commander in Rate Limited" src="https://user-images.githubusercontent.com/102745725/178960104-c254c12f-08fb-4508-824d-20df60b2290f.png">

Since we decided that we want to handle it manually, we will edit configurations and see how the Dependency Dashboard is affected by this change.

In order to limit all major updates to on-demand creation:

  1. Add this code segment to your renovate.json file:
"packageRules": [
    {
      "matchUpdateTypes": ["major"],
      "dependencyDashboardApproval": true
    }
  ]
<img width="924" alt="change in config - pending approval" src="https://user-images.githubusercontent.com/102745725/178962677-612e8172-fac7-45fb-937b-46a559d848f0.png">
  1. Commit the changes

[!NOTE] Changing the renovate.json configuration file is a webhook that triggers Renovate to re-run.

  1. Now go back to the Dependency Dashboard in the Issues section

  2. As you can see, commander major update PR now appears under the Pending Approval section and will not be opened unless manually triggered

    Note it may take a minute to complete Renovate's run

<img width="926" alt="commander in pending approval" src="https://user-images.githubusercontent.com/102745725/178962735-84f1ae00-df4c-4fed-adf5-12fefeb94e9f.png">
  1. You can now decide to manually open this PR by checking the box next to it
  2. Navigate to the Pull requests section to review the generated PR and merge it to the repo.

Congratulations! You are now familiar with Renovate’s Dependency Dashboard. 🎈

What you learned:

General Comments:

Congratulations!

You have successfully completed Renovate’s hands-on tutorial and have taken your first steps to automate dependency updates in your projects. Now, it's time to configure Renovate on the rest of your repositories and let Renovate manage your dependencies' health.

Upcoming Tutorials:

We're working on more advanced Renovate tutorials and will post updates when we publish new tutorials.

What’s coming next: