|
1 |
| -# tutorial |
2 |
| -Renovate Bot Tutorial source |
| 1 | +# Renovate - Hands On Tutorial |
| 2 | + |
| 3 | + |
| 4 | +## Introduction |
| 5 | + |
| 6 | +Welcome to the Renovate hands-on tutorial. |
| 7 | + |
| 8 | +This tutorial is based on the Renovate GitHub App. |
| 9 | +You can also run Renovate as a CLI tool or a self-hosted application. |
| 10 | + |
| 11 | +> **Note** |
| 12 | +> Although this tutorial is based on the GitHub App, the concepts discussed apply to all environments. |
| 13 | +
|
| 14 | +In this tutorial, you will learn how to configure Renovate and become familiar with some of the basic features. |
| 15 | + |
| 16 | +What you will learn: |
| 17 | + |
| 18 | +- 1 Installation |
| 19 | +- 1 Onboarding |
| 20 | +- 1 Getting to know Renovate’s update PRs |
| 21 | +- 1 Dependency Dashboard |
| 22 | + |
| 23 | +We will begin this tutorial with configuring and installing the Renovate app and an overview of the default settings and basic functionalities. |
| 24 | + |
| 25 | +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. |
| 26 | + |
| 27 | +## Part 1 - Installation |
| 28 | + |
| 29 | +Let’s start by forking the tutorial repo to your account, installing the Renovate GitHub App, and configuring it to your repo. |
| 30 | + |
| 31 | +- 1 Make sure you are logged in to GitHub.com |
| 32 | +- 1 Fork this [RenovateTutorial](https://github.com/PhilipAbed/RenovateTutorial) repository. The tutorial instructions will be based on the contents of this repository |
| 33 | +- 1 The following instructions are directed at those that don’t have Renovate installed: |
| 34 | + - Install the Renovate App to your account by navigating to the [Renovate App GitHub installation page](https://github.com/apps/renovate) and select Install: |
| 35 | +  |
| 36 | +-1 If you do have Renovate installed: |
| 37 | + - navigate to the [Renovate app page](https://github.com/apps/renovate) and select configure: |
| 38 | +  |
| 39 | +- 1 You will reach an installation configuration page where you are asked to configure Repository Access. |
| 40 | + |
| 41 | +> **Note** |
| 42 | +> for existing users, installation configuration appears at the bottom of the page. |
| 43 | +
|
| 44 | + - Mark `Only select repositories` and make sure to select the forked RenovateTutorial repo |
| 45 | + |
| 46 | + > **Note** |
| 47 | + > each selected repo gets an onboarding PR. |
| 48 | + |
| 49 | + If you select `All repositories`, forked repos will be skipped by default (including RenovateTutorial). |
| 50 | + - click on `Install` (“Save” for existing users) |
| 51 | + |
| 52 | +<img width="629" alt="configuration page" src="https://user-images.githubusercontent.com/102745725/178964980-df55dafd-f087-433a-90f7-986fa01c1ac0.png"> |
| 53 | + |
| 54 | + |
| 55 | +For new installs: |
| 56 | +- You will be redirected to our “Thank you for installing Renovate” page while we are setting up your account. |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +- After a few seconds, you will be automatically directed to a dashboard where you can login and view the Renovate logs. We recommend saving this [link](https://app.renovatebot.com/dashboard) for future use. |
| 61 | + |
| 62 | +<img width="625" alt="Screen Shot 2022-07-14 at 14 24 26" src="https://user-images.githubusercontent.com/102745725/178972035-abe2e859-0756-498c-91d5-ec2f0cfdd503.png"> |
| 63 | + |
| 64 | +**Congratulations! You have successfully installed Renovate to your account.** 🎈 |
| 65 | + |
| 66 | +## Part 2 - Onboarding |
| 67 | + |
| 68 | +Now that you have Renovate installed, we can begin onboarding. |
| 69 | + |
| 70 | +Let’s review the concepts of the Onboarding PR and learn about Renovate’s initial settings. |
| 71 | + |
| 72 | +> **Note** |
| 73 | +> For your convenience, Renovate will not make any changes to your repo or raise PRs until after you finish onboarding. |
| 74 | +
|
| 75 | +- Upon installing Renovate, an onboarding PR will be automatically generated. |
| 76 | +- This PR is there to help you understand Renovate and its default settings before Renovate starts running on your repository. |
| 77 | +- The Onboarding PR creates a configuration file called `renovate.json`, which contains Renovate’s default settings and can be modified during onboarding. |
| 78 | + |
| 79 | +Now let’s review the onboarding PR - |
| 80 | +- 1 Navigate to the `Pull Requests` section in GitHub, and open the newly generated PR - `Configure Renovate` |
| 81 | + |
| 82 | +<img width="1500" alt="onboarding PR" src="https://user-images.githubusercontent.com/102745725/178965966-76aa3941-cac4-4df3-bd89-75b9f8002924.png"> |
| 83 | + |
| 84 | +<img width="935" alt="onboarding content" src="https://user-images.githubusercontent.com/102745725/178966039-b11315b8-8c75-416b-9f18-c8109c17d0ab.png"> |
| 85 | + |
| 86 | +#### The onboarding PR contains: |
| 87 | + |
| 88 | + - **Detected Package Files** - All package files detected by Renovate in your code. |
| 89 | + - **Configuration Summary** - The default configuration settings that will be applied. |
| 90 | + - **What to Expect** - The dependency update PRs that Renovate is about to automatically create. |
| 91 | + - The link to Renovate’s official [documentation](https://docs.renovatebot.com/). |
| 92 | + - The link to review jobs logs in the [Renovate dashboard](https://app.renovatebot.com/dashboard). |
| 93 | + |
| 94 | +> **Note** |
| 95 | +> Renovate will not create dependency update PRs until the onboarding PR will be merged. |
| 96 | +
|
| 97 | +#### These are some of the default configurations of Renovate: |
| 98 | + |
| 99 | + - Enables creation of the “Dependency Dashboard” - a dashboard that shows an overview of the state of your repositories' dependencies. |
| 100 | + - PRs will be created at a rate of 2 PRs per hour. |
| 101 | + - The limit of simultaneous open Renovate PRs is set to 10. |
| 102 | + - Renovate automatically groups known monorepo packages to a single PR (example can be seen in the `date-io` PR under the **what to expect** section). |
| 103 | + |
| 104 | +Renovate offers the ability to change configurations before merging the onboarding PR as well as preview the results of these changes. |
| 105 | +At this point, Renovate has created a branch called renovate/configure which contains the `renovate.json` configuration file. |
| 106 | +By default, Renovate limits branch creation to 2 per hour: |
| 107 | + |
| 108 | +<img width="829" alt="onboarding warning hourly" src="https://user-images.githubusercontent.com/102745725/178961193-2f1f1548-5282-4d33-b8ef-6e141f0a643d.png"> |
| 109 | + |
| 110 | +Example |
| 111 | + |
| 112 | +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. |
| 113 | +Let’s try changing this hourly limitation to 3: |
| 114 | + |
| 115 | +- 1 Go to the newly created branch - `renovate/configure`: |
| 116 | + |
| 117 | +<img width="763" alt="new branch" src="https://user-images.githubusercontent.com/102745725/178966974-35c089c6-4190-4721-b1c2-956d84e80d07.png"> |
| 118 | + |
| 119 | +- 1 Go into the `renovate.json` file: |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | +- 1 Add the following code segment: |
| 124 | +```json |
| 125 | +{ |
| 126 | + "prHourlyLimit": 3 |
| 127 | +} |
| 128 | +``` |
| 129 | +<img width="591" alt="change in config 1" src="https://user-images.githubusercontent.com/102745725/178967120-51ec5940-42bc-444e-8c4d-b98ea4ee5948.png"> |
| 130 | + |
| 131 | +- 1 Commit the changes |
| 132 | +- 1 Revisit the onboarding PR and notice how the onboarding PR automatically updates to reflect the changes you made to the configuration |
| 133 | + |
| 134 | +<img width="830" alt="onboarding warning hourly update" src="https://user-images.githubusercontent.com/102745725/178960884-40077a5c-8fe1-422f-81c1-567ea1e6619b.png"> |
| 135 | + |
| 136 | +> **Note** |
| 137 | +> May take a few moments to update. |
| 138 | +
|
| 139 | +- 1 Merge the onboarding pull request. |
| 140 | + |
| 141 | +**Congratulations! You have successfully onboarded Renovate.** 🎈 |
| 142 | + |
| 143 | +## Part 3 - Getting to know Renovate’s update PRs |
| 144 | + |
| 145 | +Now that you have merged the onboarding PR, Renovate will generate Update PRs to the most recent dependency version based on your configuration. |
| 146 | + |
| 147 | +> **Note** |
| 148 | +> PRs may take a couple of minutes to appear |
| 149 | +
|
| 150 | +Here we will review the basic concepts of Renovate update PRs and merge it. |
| 151 | + |
| 152 | +- By default, Renovate will create up to 2 update PRs per hour. However, if you completed the onboarding section of this tutorial, Renovate will now create 3 PRs. |
| 153 | +- You should already see notifications for these pull requests in the `Pull Requests` section of the repo. |
| 154 | + |
| 155 | +Let’s go ahead and take a look at a Renovate update PR: |
| 156 | +- 1 Navigate to the `Pull requests` section and open - `Update dependency lodash to x.y.z` |
| 157 | + |
| 158 | +<img width="1256" alt="open PRs" src="https://user-images.githubusercontent.com/102745725/178967929-690b3866-190b-4576-a961-981ce78cbd1b.png"> |
| 159 | + |
| 160 | +### Each update PR contains: |
| 161 | +- Dependency information (name and version changes) |
| 162 | +- [Merge Confidence](https://docs.renovatebot.com/merge-confidence/) values |
| 163 | +- Up-to-date release notes |
| 164 | +- Renovate configuration-related info |
| 165 | +- Option to rebase PR |
| 166 | +- Link to view Renovate logs |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | +- Renovate’s update PRs will update the relevant dependency across your entire repo. In our RenovateTutorial repo, this will be both the `package.json` file and the `package-lock.json` file: |
| 171 | + |
| 172 | +<img width="1488" alt="file diff lodash" src="https://user-images.githubusercontent.com/102745725/178968020-865560f7-173c-4e9e-a073-488147dbb137.png"> |
| 173 | + |
| 174 | +- 1 Merge this pull request |
| 175 | + |
| 176 | +>Note - Renovate is highly configurable and supports: |
| 177 | +> |
| 178 | +>- On-demand PR creation. |
| 179 | +>- Automatic merging of PRs. |
| 180 | +>- Settings for specific dependencies/package managers. |
| 181 | +>- Scheduling. |
| 182 | +>- Grouping. |
| 183 | +> |
| 184 | +> All the above and more will be discussed in future parts of the tutorial. |
| 185 | +
|
| 186 | +**Congratulations! You have now updated your first dependency with Renovate.** 🎈 |
| 187 | + |
| 188 | +## Part 4 - Dependency Dashboard |
| 189 | + |
| 190 | +Renovate’s Dependency Dashboard is a GitHub Issue that enables you to manage and monitor Renovate’s activity in your repo. |
| 191 | +In this section, we will go over some of its main functionalities and capabilities. |
| 192 | + |
| 193 | +Let’s begin by creating and enabling the Dependency Dashboard. |
| 194 | +Since GitHub defaults to disable `issues` on forked repositories, we need to enable it on the forked RenovateTutorial repo: |
| 195 | + |
| 196 | +- 1 Go to the main page of the repo |
| 197 | +- 1 Go to `settings` -> `general` |
| 198 | +- 1 Check the `issues` checkbox under the Features section: |
| 199 | + |
| 200 | +<img width="1284" alt="issues settings" src="https://user-images.githubusercontent.com/102745725/178968523-fb002cf1-2510-4b4f-b840-f9776e660d92.png"> |
| 201 | + |
| 202 | +- In order for the Dependency Dashboard to become available, we will need to re-run Renovate by triggering a webhook (for example, closing an update PR). |
| 203 | + |
| 204 | +> **Note** |
| 205 | +> This is usually done in a click via the Dependency Dashboard. |
| 206 | +
|
| 207 | + |
| 208 | +- 1 Go to the `Pull requests` section |
| 209 | +- 1 Select `Update dependency php to v8.1` and select `Close pull request` |
| 210 | + |
| 211 | +<img width="927" alt="close php" src="https://user-images.githubusercontent.com/102745725/178969009-7239db99-4abe-44d1-a86c-a0effdf6fb7a.png"> |
| 212 | + |
| 213 | +- 1 This will trigger Renovate to run and the Dependency Dashboard will appear under the `Issues` section - navigate to it |
| 214 | + |
| 215 | +> **Note** |
| 216 | +> it may take a minute to appear. |
| 217 | +
|
| 218 | + |
| 219 | +### The Dependency Dashboard includes: |
| 220 | + - Overview of all updates that are still to-do: |
| 221 | + |
| 222 | + - **Open** PRs |
| 223 | + - **Rate Limited** - PRs blocked by rate limit setting and will be opened based on preferences. |
| 224 | + - **Pending Approval** - PRs that require manual triggering based on configurations. |
| 225 | + - **Awaiting Schedule** - PRs creation blocked by Renovate scheduling settings. |
| 226 | + - **Pending Status Checks** - updates that await pending status checks in order to be created. |
| 227 | + |
| 228 | + - Visibility into **rejected/deferred updates**. |
| 229 | + - List of all the **detected dependencies** and **package managers** in your repository. |
| 230 | + |
| 231 | + <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"> |
| 232 | + |
| 233 | +Users can manually trigger the creation of dependency updates directly from the dashboard. |
| 234 | + |
| 235 | +You can also re-run the Renovate bot manually directly from the Dependency Dashboard by enabling the “Check this box to trigger a request Renovate to run again on this repository” option: |
| 236 | + |
| 237 | + <img width="867" alt="rerun renovate" src="https://user-images.githubusercontent.com/102745725/178969114-c1b64333-b45a-4508-b638-1e25ad0adab5.png"> |
| 238 | + |
| 239 | + |
| 240 | +Let’s dive into one of the dependency dashboard capabilities - **the Pending Approval feature**. |
| 241 | + |
| 242 | +Say we want to take extra measures before updating major versions of a package (either to reduce noise or to handle it more carefully). |
| 243 | +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. |
| 244 | + |
| 245 | +In the Dependency Dasboard, under the `Rate Limited` section, the `Update dependency commander to vX` is waiting to be created. |
| 246 | + |
| 247 | +> **Note** |
| 248 | +> based on the previously set `prHourlyLimit` configuration, 3 PRs per hour in our case, this PR will be created within an hour. |
| 249 | +
|
| 250 | +<img width="928" alt="commander in Rate Limited" src="https://user-images.githubusercontent.com/102745725/178960104-c254c12f-08fb-4508-824d-20df60b2290f.png"> |
| 251 | + |
| 252 | +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. |
| 253 | + |
| 254 | +In order to limit all major updates to on-demand creation: |
| 255 | + |
| 256 | +- 1 Add this code segment to your `renovate.json` file: |
| 257 | +```json |
| 258 | +"packageRules": [ |
| 259 | + { |
| 260 | + "matchUpdateTypes": ["major"], |
| 261 | + "dependencyDashboardApproval": true |
| 262 | + } |
| 263 | + ] |
| 264 | +``` |
| 265 | + |
| 266 | +<img width="924" alt="change in config - pending approval" src="https://user-images.githubusercontent.com/102745725/178962677-612e8172-fac7-45fb-937b-46a559d848f0.png"> |
| 267 | + |
| 268 | +- 1 Commit the changes |
| 269 | + |
| 270 | +> **Note** |
| 271 | +> Changing the `renovate.json` configuraion file is a webhook that triggers Renovate to re-run. |
| 272 | +
|
| 273 | +- 1 Now go back to the Dependency Dashboard in the Issues section |
| 274 | + |
| 275 | +- 1 As you can see, `commander` major update PR now appears under the **Pending Approval** section and **will not** be opened unless manually triggered |
| 276 | + |
| 277 | + > **Note** |
| 278 | + > it make take a minute to complete Renovate's run |
| 279 | +
|
| 280 | +<img width="926" alt="commander in pending approval" src="https://user-images.githubusercontent.com/102745725/178962735-84f1ae00-df4c-4fed-adf5-12fefeb94e9f.png"> |
| 281 | + |
| 282 | +- 1 You can now decide to manually open this PR by checking the box next to it |
| 283 | + |
| 284 | +- 1 Navigate to the `Pull requests` section to review the generated PR and merge it to the repo. |
| 285 | + |
| 286 | + |
| 287 | +**Congratulations! You are now familiar with Renovate’s Dependency Dashboard.** 🎈 |
| 288 | + |
| 289 | +## What have we learned so far: |
| 290 | + - How to install Renovate |
| 291 | + - Onboarding Renovate by reviewing, configuring, and merging the onboarding PR |
| 292 | + - How to update a dependency with Renovate |
| 293 | + - How to utilize the Dependency Dashboard |
| 294 | + |
| 295 | +### General Comments: |
| 296 | + - Granting access to all repositories or change repo selections can be modified at any time on the [Renovate App GitHub page](https://github.com/apps/renovate). |
| 297 | + - Renovate configuration can be modified by manual configurations, global organization configurations and existing Renovate presets. |
| 298 | + |
| 299 | +### Congratulations! You have successfully completed Renovate’s hands-on tutorial and have taken your first steps to automate dependency updates in your projects. |
| 300 | + |
| 301 | +### Now, it's time to configure Renovate on the rest of your repositories and let Renovate manage your dependencies' health. |
| 302 | + |
| 303 | +### Upcoming Tutorials: |
| 304 | + |
| 305 | +We have more advanced Renovate tutorials in the pipeline and will post updates when they are published. |
| 306 | + |
| 307 | +What’s coming next: |
| 308 | + |
| 309 | +- Merge confidence |
| 310 | +- Auto Merge |
| 311 | +- Labeling |
| 312 | +- Grouping |
| 313 | +- Schedule |
| 314 | +- Package Rules |
| 315 | +- GitHub actions |
| 316 | +- PR Assignees and PR reviewers |
| 317 | +- Regex Managers |
| 318 | + |
| 319 | + |
| 320 | + |
0 commit comments