Added `always: true` to the Azure Pipeline to make sure the pipeline gets triggered on schedule even when there are no changes to the source code.
3.3 KiB
title | description |
---|---|
Azure DevOps setup | How to setup Renovate for Azure DevOps |
Azure DevOps setup
This document explains how to setup Renovate for use on Azure DevOps.
Setting up a new pipeline
Create a brand new pipeline within Azure DevOps, and select your source:
Then select your repository.
Within Configure your pipeline select: Starter pipeline
Replace all content in the starter pipeline with:
schedules:
- cron: '0 3 * * *'
displayName: 'Every day at 3am'
branches:
include: [main]
always: true
trigger: none
pool:
vmImage: ubuntu-latest
steps:
- task: npmAuthenticate@0
inputs:
workingFile: .npmrc
- bash: |
git config --global user.email 'bot@renovateapp.com'
git config --global user.name 'Renovate Bot'
npx --userconfig .npmrc renovate
env:
TOKEN: $(System.AccessToken)
Create a .npmrc file
Create a .npmrc
file in your repository:
registry=https://pkgs.dev.azure.com/YOUR-ORG/_packaging/YOUR-FEED/npm/registry/
always-auth=true
For the registry
key, replace YOUR-ORG
with your Azure DevOps organization and YOUR-FEED
with your Azure Artifacts feed.
Create a config.js file
Create a config.js
file in your repository:
module.exports = {
platform: 'azure',
endpoint: 'https://dev.azure.com/YOUR-ORG/',
token: process.env.TOKEN,
hostRules: [
{
hostType: 'npm',
matchHost: 'pkgs.dev.azure.com',
username: 'apikey',
password: process.env.TOKEN,
},
],
repositories: ['YOUR-PROJECT/YOUR-REPO'],
};
For the endpoint
key, replace YOUR-ORG
with your Azure DevOps organization.
For the repositories
key, replace YOUR-PROJECT/YOUR-REPO
with your Azure DevOps project and repository.
Yarn users
To do a successful yarn install
you need to match the URL of the registry fully.
Use the matchHost
config option to specify the full path to the registry.
module.exports = {
platform: 'azure',
endpoint: 'https://myorg.visualstudio.com/',
token: process.env.TOKEN,
hostRules: [
{
matchHost:
'https://myorg.pkgs.visualstudio.com/_packaging/myorg/npm/registry/',
token: process.env.TOKEN,
hostType: 'npm',
},
{
matchHost: 'github.com',
token: process.env.GITHUB_COM_TOKEN,
},
],
repositories: ['YOUR-PROJECT/YOUR-REPO'],
};
Put this in your repository's .npmrc
file:
registry=https://myorg.pkgs.visualstudio.com/_packaging/myorg/npm/registry/
always-auth=true
Add renovate.json file
Additionally, you can create a renovate.json
file (which holds the Renovate configuration) in the root of the repository you want to update.
Read more about the Renovate configuration options
Using a single pipeline to update multiple repositories
If you want to use a single Renovate pipeline to update multiple repositories you must take the following steps.
Add the names of the repositories to config.js
.
Make sure that the "Project Collection Build Service (YOUR-PROJECT)" user has the following permissions on the repositories:
- Contribute
- Contribute to pull requests
- Create branch