diff --git a/src/AzSK.ADO/Framework/BugLog/AutoBugLog.ps1 b/src/AzSK.ADO/Framework/BugLog/AutoBugLog.ps1 index 79c2710a0..93f0c4d9a 100644 --- a/src/AzSK.ADO/Framework/BugLog/AutoBugLog.ps1 +++ b/src/AzSK.ADO/Framework/BugLog/AutoBugLog.ps1 @@ -42,7 +42,8 @@ class AutoBugLog { #Obtain area and iteration paths $AreaPath = [BugLogPathManager]::GetAreaPath() $IterationPath = [BugLogPathManager]::GetIterationPath() - + $BugLoggingProject = [BugLogPathManager]::GetBugLoggingProject() #This project should be used to check if current bug exists or not + #this falg is added to restrict 'Determining bug logging' message should print only once $printLogBugMsg = $true; #Loop through all the control results for the current resource @@ -68,7 +69,7 @@ class AutoBugLog { #compute hash of control Id and resource Id $hash = $this.GetHashedTag($control.ControlItem.Id, $control.ResourceContext.ResourceId) #check if a bug with the computed hash exists - $workItem = $this.GetWorkItemByHash($hash, $ProjectName) + $workItem = $this.GetWorkItemByHash($hash, $BugLoggingProject) if ($workItem[0].results.count -gt 0) { #a work item with the hash exists, find if it's state and reactivate if resolved bug $this.ManageActiveAndResolvedBugs($ProjectName, $control, $workItem, $AssignedTo) diff --git a/src/AzSK.ADO/Framework/BugLog/BugLogPathManager.ps1 b/src/AzSK.ADO/Framework/BugLog/BugLogPathManager.ps1 index 0a2805e97..a757c62f2 100644 --- a/src/AzSK.ADO/Framework/BugLog/BugLogPathManager.ps1 +++ b/src/AzSK.ADO/Framework/BugLog/BugLogPathManager.ps1 @@ -6,6 +6,8 @@ class BugLogPathManager { hidden static [bool] $checkValidPathFlag = $true; #flag to check if the path that has been declared is valid hidden static [bool] $isPathValid = $false; + #variable to store the actual project where bug is supposed to log + hidden static [string] $BugLoggingProject = $null #function to find if the area and iteration path are valid @@ -42,7 +44,9 @@ class BugLogPathManager { #sanitizing for JSON [BugLogPathManager]::AreaPath = [BugLogPathManager]::AreaPath.Replace("\", "\\") [BugLogPathManager]::IterationPath = [BugLogPathManager]::IterationPath.Replace("\", "\\") - + # AreaPath always Starts with Project + [BugLogPathManager]::BugLoggingProject = [BugLogPathManager]::AreaPath.split("\")[0] + #copying the value for easy inputting to the query JSON $AreaPathForJSON = [BugLogPathManager]::AreaPath $IterationPathForJSON = [BugLogPathManager]::IterationPath @@ -84,4 +88,7 @@ class BugLogPathManager { static hidden [bool] GetIsPathValid(){ return [BugLogPathManager]::isPathValid } + static hidden [string] GetBugLoggingProject(){ + return [BugLogPathManager]::BugLoggingProject + } } \ No newline at end of file