@@ -53,6 +53,30 @@ parameters:
5353 type : boolean
5454 default : false
5555
56+ # Name of the arcade repository resource in the pipeline.
57+ # This allows repos which haven't been onboarded to Arcade to still use this
58+ # template by checking out the repo as a resource with a custom name and pointing
59+ # this parameter to it.
60+ - name : arcadeRepoResource
61+ type : string
62+ default : self
63+
64+ # Directory name for the self repo under $(Build.SourcesDirectory) in multi-checkout.
65+ # In multi-checkout (when arcadeRepoResource != 'self'), Azure DevOps checks out the
66+ # self repo to $(Build.SourcesDirectory)/<repoName>. Set this to match the auto-generated
67+ # directory name. Using the auto-generated name is necessary rather than explicitly
68+ # defining a checkout path because container jobs expect repos to live under the agent's
69+ # workspace ($(Pipeline.Workspace)). On some self-hosted setups the host path
70+ # (e.g., /mnt/vss/_work) differs from the container path (e.g., /__w), and a custom checkout
71+ # path can fail validation. Using the default checkout location keeps the paths consistent
72+ # and avoids this issue.
73+ - name : selfRepoName
74+ type : string
75+ default : ' '
76+ - name : arcadeRepoName
77+ type : string
78+ default : ' '
79+
5680# Pool configuration for the job.
5781- name : pool
5882 type : object
@@ -71,16 +95,36 @@ jobs:
7195 # Changing the variable name here would require updating the name in https://github.com/dotnet/arcade/blob/main/eng/renovate.json as well.
7296 - name : renovateVersion
7397 value : ' 42'
98+ readonly : true
99+ - name : renovateLogFilePath
100+ value : ' $(Build.ArtifactStagingDirectory)/renovate.json'
101+ readonly : true
74102 - name : dryRunArg
103+ readonly : true
75104 ${{ if eq(parameters.dryRun, true) }} :
76105 value : ' full'
77106 ${{ else }} :
78107 value : ' '
79108 - name : recreateWhenArg
109+ readonly : true
80110 ${{ if eq(parameters.forceRecreatePR, true) }} :
81111 value : ' always'
82112 ${{ else }} :
83113 value : ' '
114+ # In multi-checkout (without custom paths), Azure DevOps places each repo under
115+ # $(Build.SourcesDirectory)/<repoName>. selfRepoName must be provided in that case.
116+ - name : selfRepoPath
117+ readonly : true
118+ ${{ if eq(parameters.arcadeRepoResource, 'self') }} :
119+ value : ' $(Build.SourcesDirectory)'
120+ ${{ else }} :
121+ value : ' $(Build.SourcesDirectory)/${{ parameters.selfRepoName }}'
122+ - name : arcadeRepoPath
123+ readonly : true
124+ ${{ if eq(parameters.arcadeRepoResource, 'self') }} :
125+ value : ' $(Build.SourcesDirectory)'
126+ ${{ else }} :
127+ value : ' $(Build.SourcesDirectory)/${{ parameters.arcadeRepoName }}'
84128 pool : ${{ parameters.pool }}
85129
86130 templateContext :
@@ -96,17 +140,34 @@ jobs:
96140 steps :
97141 - checkout : self
98142 fetchDepth : 1
143+
144+ - ${{ if ne(parameters.arcadeRepoResource, 'self') }} :
145+ - checkout : ${{ parameters.arcadeRepoResource }}
146+ fetchDepth : 1
99147
100- - script : renovate-config-validator $(Build.SourcesDirectory)/${{parameters.renovateConfigPath}}
148+ - script : |
149+ renovate-config-validator $(selfRepoPath)/${{parameters.renovateConfigPath}} 2>&1 | tee /tmp/renovate-config-validator.out
150+ validatorExit=${PIPESTATUS[0]}
151+ if grep -q '^ WARN:' /tmp/renovate-config-validator.out; then
152+ echo "##vso[task.logissue type=warning]Renovate config validator produced warnings."
153+ echo "##vso[task.complete result=SucceededWithIssues]"
154+ fi
155+ exit $validatorExit
101156 displayName: Validate Renovate config
102157 env:
103158 LOG_LEVEL: info
104159 LOG_FILE_LEVEL: debug
105160 LOG_FILE: $(Build.ArtifactStagingDirectory)/renovate-config-validator.json
106161
107162 - script : |
108- . $(Build.SourcesDirectory)/eng/common/renovate.env
109- renovate
163+ . $(arcadeRepoPath)/eng/common/renovate.env
164+ renovate 2>&1 | tee /tmp/renovate.out
165+ renovateExit=${PIPESTATUS[0]}
166+ if grep -q '^ WARN:' /tmp/renovate.out; then
167+ echo "##vso[task.logissue type=warning]Renovate produced warnings."
168+ echo "##vso[task.complete result=SucceededWithIssues]"
169+ fi
170+ exit $renovateExit
110171 displayName: Run Renovate
111172 env:
112173 RENOVATE_FORK_TOKEN: $(BotAccount-dotnet-renovate-bot-PAT)
@@ -117,13 +178,13 @@ jobs:
117178 RENOVATE_RECREATE_WHEN: $(recreateWhenArg)
118179 LOG_LEVEL: info
119180 LOG_FILE_LEVEL: debug
120- LOG_FILE: $(Build.ArtifactStagingDirectory)/renovate.json
121- RENOVATE_CONFIG_FILE: $(Build.SourcesDirectory )/${{parameters.renovateConfigPath}}
181+ LOG_FILE: $(renovateLogFilePath)
182+ RENOVATE_CONFIG_FILE: $(selfRepoPath )/${{parameters.renovateConfigPath}}
122183
123184 - script : |
124185 echo "PRs created by Renovate:"
125- if [ -s "$(Build.ArtifactStagingDirectory)/renovate-log.json " ]; then
126- if ! jq -r 'select(.msg == "PR created" and .pr != null) | "https://github.com/\(.repository)/pull/\(.pr)"' "$(Build.ArtifactStagingDirectory)/renovate-log.json " | sort -u; then
186+ if [ -s "$(renovateLogFilePath) " ]; then
187+ if ! jq -r 'select(.msg == "PR created" and .pr != null) | "https://github.com/\(.repository)/pull/\(.pr)"' "$(renovateLogFilePath) " | sort -u; then
127188 echo "##vso[task.logissue type=warning]Failed to parse Renovate log file with jq."
128189 echo "##vso[task.complete result=SucceededWithIssues]"
129190 fi
0 commit comments