You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Octoshift/Services/AdoPipelineTriggerService.cs
+18-9Lines changed: 18 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -138,7 +138,8 @@ public async Task<bool> IsPipelineRequiredByBranchPolicy(string adoOrg, string t
138
138
139
139
if(string.IsNullOrEmpty(repositoryId))
140
140
{
141
-
_log.LogWarning($"Repository ID not found for {adoOrg}/{teamProject}/{repoName}. Branch policy check cannot be performed for pipeline {pipelineId}.");
141
+
varrepoIdentifier=repoName??repoId??"unknown";
142
+
_log.LogWarning($"Repository ID not found for {adoOrg}/{teamProject}/{repoIdentifier}. Branch policy check cannot be performed for pipeline {pipelineId}.");
142
143
returnfalse;
143
144
}
144
145
}
@@ -156,7 +157,8 @@ public async Task<bool> IsPipelineRequiredByBranchPolicy(string adoOrg, string t
_log.LogVerbose($"No branch policies found for repository {adoOrg}/{teamProject}/{repoName}. ADO Pipeline ID = {pipelineId} is not required by branch policy.");
160
+
varrepoIdentifier=repoName??repoId??"unknown";
161
+
_log.LogVerbose($"No branch policies found for repository {adoOrg}/{teamProject}/{repoIdentifier}. ADO Pipeline ID = {pipelineId} is not required by branch policy.");
160
162
returnfalse;
161
163
}
162
164
@@ -168,43 +170,50 @@ public async Task<bool> IsPipelineRequiredByBranchPolicy(string adoOrg, string t
168
170
169
171
if(isPipelineRequired)
170
172
{
171
-
_log.LogVerbose($"ADO Pipeline ID = {pipelineId} is required by branch policy in {adoOrg}/{teamProject}/{repoName}. Build status reporting will be enabled to support branch protection.");
173
+
varrepoIdentifier=repoName??repoId??"unknown";
174
+
_log.LogVerbose($"ADO Pipeline ID = {pipelineId} is required by branch policy in {adoOrg}/{teamProject}/{repoIdentifier}. Build status reporting will be enabled to support branch protection.");
172
175
}
173
176
else
174
177
{
175
-
_log.LogVerbose($"ADO Pipeline ID = {pipelineId} is not required by any branch policies in {adoOrg}/{teamProject}/{repoName}.");
178
+
varrepoIdentifier=repoName??repoId??"unknown";
179
+
_log.LogVerbose($"ADO Pipeline ID = {pipelineId} is not required by any branch policies in {adoOrg}/{teamProject}/{repoIdentifier}.");
176
180
}
177
181
178
182
returnisPipelineRequired;
179
183
}
180
184
catch(HttpRequestExceptionex)
181
185
{
182
186
// If we can't determine branch policy status due to network issues, default to false
183
-
_log.LogWarning($"HTTP error during branch policy check for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoName}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
187
+
varrepoIdentifier=repoName??repoId??"unknown";
188
+
_log.LogWarning($"HTTP error during branch policy check for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoIdentifier}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
184
189
returnfalse;
185
190
}
186
191
catch(TaskCanceledExceptionex)
187
192
{
188
193
// If branch policy checking times out, consider check failed
189
-
_log.LogWarning($"Branch policy check timed out for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoName}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
194
+
varrepoIdentifier=repoName??repoId??"unknown";
195
+
_log.LogWarning($"Branch policy check timed out for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoIdentifier}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
190
196
returnfalse;
191
197
}
192
198
catch(JsonExceptionex)
193
199
{
194
200
// If we can't determine branch policy status due to JSON parsing issues, default to false
195
-
_log.LogWarning($"JSON parsing error during branch policy check for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoName}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
201
+
varrepoIdentifier=repoName??repoId??"unknown";
202
+
_log.LogWarning($"JSON parsing error during branch policy check for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoIdentifier}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
196
203
returnfalse;
197
204
}
198
205
catch(ArgumentExceptionex)
199
206
{
200
207
// If we can't determine branch policy status due to invalid arguments, default to false
201
-
_log.LogWarning($"Invalid argument error during branch policy check for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoName}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
208
+
varrepoIdentifier=repoName??repoId??"unknown";
209
+
_log.LogWarning($"Invalid argument error during branch policy check for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoIdentifier}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
202
210
returnfalse;
203
211
}
204
212
catch(InvalidOperationExceptionex)
205
213
{
206
214
// If branch policy checking fails due to invalid state, consider check failed
207
-
_log.LogWarning($"Invalid operation error during branch policy check for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoName}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
215
+
varrepoIdentifier=repoName??repoId??"unknown";
216
+
_log.LogWarning($"Invalid operation error during branch policy check for pipeline {pipelineId} in {adoOrg}/{teamProject}/{repoIdentifier}: {ex.Message}. Pipeline trigger configuration may not preserve branch policy requirements.");
0 commit comments