-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathrenovate.yml
More file actions
135 lines (122 loc) · 5.2 KB
/
renovate.yml
File metadata and controls
135 lines (122 loc) · 5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# --------------------------------------------------------------------------------------
# Renovate Bot Job Template
# --------------------------------------------------------------------------------------
# This Azure DevOps pipeline job template runs Renovate (https://docs.renovatebot.com/)
# to automatically update dependencies in a GitHub repository.
#
# Renovate scans the repository for dependency files and creates pull requests to update
# outdated dependencies based on the configuration specified in the renovateConfigPath
# parameter.
#
# Usage:
# For each product repo wanting to make use of Renovate, this template is called from
# an internal Azure DevOps pipeline, typically with a schedule trigger, to check for
# and propose dependency updates.
#
# For more info, see https://github.com/dotnet/arcade/blob/main/Documentation/Renovate.md
# --------------------------------------------------------------------------------------
parameters:
# Path to the Renovate configuration file within the repository.
- name: renovateConfigPath
type: string
default: 'eng/renovate.json'
# GitHub repository to run Renovate against, in the format 'owner/repo'.
# This could technically be any repo but convention is to target the same
# repo that contains the calling pipeline. The Renovate config file would
# be co-located with the pipeline's repo and, in most cases, the config
# file is specific to the repo being targeted.
- name: gitHubRepo
type: string
# List of base branches to target for Renovate PRs.
# NOTE: The Renovate configuration file is always read from the branch where the
# pipeline is run, NOT from the target branches specified here. If you need different
# configurations for different branches, run the pipeline from each branch separately.
- name: baseBranches
type: object
default:
- main
# When true, Renovate will run in dry run mode, which previews changes without creating PRs.
# See the 'Run Renovate' step log output for details of what would have been changed.
- name: dryRun
type: boolean
default: false
# By default, Renovate will not recreate a PR for a given dependency/version pair that was
# previously closed. This allows opting in to always recreating PRs even if they were
# previously closed.
- name: forceRecreatePR
type: boolean
default: false
# Pool configuration for the job.
- name: pool
type: object
default:
name: NetCore1ESPool-Internal
image: build.azurelinux.3.amd64
os: linux
jobs:
- job: Renovate
displayName: Run Renovate
container: RenovateContainer
variables:
- group: dotnet-renovate-bot
# The Renovate version is automatically updated by https://github.com/dotnet/arcade/blob/main/azure-pipelines-renovate.yml.
# Changing the variable name here would require updating the name in https://github.com/dotnet/arcade/blob/main/eng/renovate.json as well.
- name: renovateVersion
value: '42'
- name: dryRunArg
${{ if eq(parameters.dryRun, true) }}:
value: 'full'
${{ else }}:
value: ''
- name: recreateWhenArg
${{ if eq(parameters.forceRecreatePR, true) }}:
value: 'always'
${{ else }}:
value: ''
pool: ${{ parameters.pool }}
templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
- output: pipelineArtifact
displayName: Publish Renovate Log
condition: succeededOrFailed()
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: $(Agent.JobName)_Logs_Attempt$(System.JobAttempt)
sbomEnabled: false
steps:
- checkout: self
fetchDepth: 1
- script: renovate-config-validator $(Build.SourcesDirectory)/${{parameters.renovateConfigPath}}
displayName: Validate Renovate config
env:
LOG_LEVEL: info
LOG_FILE_LEVEL: debug
LOG_FILE: $(Build.ArtifactStagingDirectory)/renovate-config-validator.json
- script: |
. $(Build.SourcesDirectory)/eng/common/renovate.env
renovate
displayName: Run Renovate
env:
RENOVATE_FORK_TOKEN: $(BotAccount-dotnet-renovate-bot-PAT)
RENOVATE_TOKEN: $(BotAccount-dotnet-renovate-bot-PAT)
RENOVATE_REPOSITORIES: ${{parameters.gitHubRepo}}
RENOVATE_BASE_BRANCHES: ${{ convertToJson(parameters.baseBranches) }}
RENOVATE_DRY_RUN: $(dryRunArg)
RENOVATE_RECREATE_WHEN: $(recreateWhenArg)
LOG_LEVEL: info
LOG_FILE_LEVEL: debug
LOG_FILE: $(Build.ArtifactStagingDirectory)/renovate.json
RENOVATE_CONFIG_FILE: $(Build.SourcesDirectory)/${{parameters.renovateConfigPath}}
- script: |
echo "PRs created by Renovate:"
if [ -s "$(Build.ArtifactStagingDirectory)/renovate-log.json" ]; then
if ! jq -r 'select(.msg == "PR created" and .pr != null) | "https://github.com/\(.repository)/pull/\(.pr)"' "$(Build.ArtifactStagingDirectory)/renovate-log.json" | sort -u; then
echo "##vso[task.logissue type=warning]Failed to parse Renovate log file with jq."
echo "##vso[task.complete result=SucceededWithIssues]"
fi
else
echo "##vso[task.logissue type=warning]No Renovate log file found or file is empty."
echo "##vso[task.complete result=SucceededWithIssues]"
fi
displayName: List created PRs
condition: and(succeededOrFailed(), eq('${{ parameters.dryRun }}', false))