@@ -1016,7 +1016,6 @@ function UpdateValidationStatus($pkgvalidationDetails, $BuildDefinition, $Pipeli
1016
1016
return $true
1017
1017
}
1018
1018
1019
-
1020
1019
function Get-LanguageDevOpsName ($LanguageShort )
1021
1020
{
1022
1021
switch ($LanguageShort.ToLower ())
@@ -1113,4 +1112,91 @@ function Get-ReleasePlan-Link($releasePlanWorkItemId)
1113
1112
return $null
1114
1113
}
1115
1114
return $workItem [" fields" ]
1115
+ }
1116
+
1117
+ function Get-ReleasePlansForCPEXAttestation ($releasePlanWorkItemId = $null , $targetServiceTreeId = $null )
1118
+ {
1119
+ $fields = @ ()
1120
+ $fields += " Custom.ProductServiceTreeID"
1121
+ $fields += " Custom.ReleasePlanType"
1122
+ $fields += " Custom.ProductType"
1123
+ $fields += " Custom.DataScope"
1124
+ $fields += " Custom.MgmtScope"
1125
+ $fields += " Custom.ProductName"
1126
+
1127
+ $fieldList = ($fields | ForEach-Object { " [$_ ]" }) -join " , "
1128
+
1129
+ $query = " SELECT ${fieldList} FROM WorkItems WHERE [System.WorkItemType] = 'Release Plan'"
1130
+
1131
+ if ($releasePlanWorkItemId ){
1132
+ $query += " AND [System.Id] = '$releasePlanWorkItemId '"
1133
+ } else {
1134
+ $query += " AND [System.State] = 'Finished'"
1135
+ $query += " AND [Custom.AttestationStatus] IN ('', 'Pending')"
1136
+ $query += " AND [System.Tags] NOT CONTAINS 'Release Planner App Test'"
1137
+ $query += " AND [System.Tags] NOT CONTAINS 'Release Planner Test App'"
1138
+ $query += " AND [System.Tags] NOT CONTAINS 'non-APEX tracking'"
1139
+ $query += " AND [System.Tags] NOT CONTAINS 'out of scope APEX'"
1140
+ $query += " AND [System.Tags] NOT CONTAINS 'APEX out of scope'"
1141
+ $query += " AND [System.Tags] NOT CONTAINS 'validate APEX out of scope'"
1142
+ $query += " AND [Custom.ProductServiceTreeID] <> ''"
1143
+ $query += " AND [Custom.ProductLifecycle] <> ''"
1144
+ $query += " AND [Custom.ProductType] IN ('Feature', 'Offering', 'Sku')"
1145
+ }
1146
+
1147
+ if ($targetServiceTreeId ){
1148
+ $query += " AND [Custom.ProductServiceTreeID] = '${targetServiceTreeId} '"
1149
+ }
1150
+
1151
+ $workItems = Invoke-Query $fields $query
1152
+ return $workItems
1153
+ }
1154
+
1155
+ function Get-TriagesForCPEXAttestation ($triageWorkItemId = $null , $targetServiceTreeId = $null )
1156
+ {
1157
+ $fields = @ ()
1158
+ $fields += " Custom.ProductServiceTreeID"
1159
+ $fields += " Custom.ProductType"
1160
+ $fields += " Custom.ProductLifecycle"
1161
+ $fields += " Custom.DataScope"
1162
+ $fields += " Custom.MgmtScope"
1163
+ $fields += " Custom.DataplaneAttestationStatus"
1164
+ $fields += " Custom.ManagementPlaneAttestationStatus"
1165
+ $fields += " Custom.ProductName"
1166
+
1167
+ $fieldList = ($fields | ForEach-Object { " [$_ ]" }) -join " , "
1168
+
1169
+ $query = " SELECT ${fieldList} FROM WorkItems WHERE [System.WorkItemType] = 'Triage'"
1170
+
1171
+ if ($triageWorkItemId ){
1172
+ $query += " AND [System.Id] = '$triageWorkItemId '"
1173
+ } else {
1174
+ $query += " AND ([Custom.DataplaneAttestationStatus] IN ('', 'Pending') OR [Custom.ManagementPlaneAttestationStatus] IN ('', 'Pending'))"
1175
+ $query += " AND [System.Tags] NOT CONTAINS 'Release Planner App Test'"
1176
+ $query += " AND [System.Tags] NOT CONTAINS 'Release Planner Test App'"
1177
+ $query += " AND [System.Tags] NOT CONTAINS 'non-APEX tracking'"
1178
+ $query += " AND [System.Tags] NOT CONTAINS 'out of scope APEX'"
1179
+ $query += " AND [System.Tags] NOT CONTAINS 'APEX out of scope'"
1180
+ $query += " AND [System.Tags] NOT CONTAINS 'validate APEX out of scope'"
1181
+ $query += " AND [Custom.ProductServiceTreeID] <> ''"
1182
+ $query += " AND [Custom.ProductLifecycle] <> ''"
1183
+ $query += " AND [Custom.ProductType] IN ('Feature', 'Offering', 'Sku')"
1184
+ }
1185
+
1186
+ if ($targetServiceTreeId ){
1187
+ $query += " AND [Custom.ProductServiceTreeID] = '$targetServiceTreeId '"
1188
+ }
1189
+
1190
+ $workItems = Invoke-Query $fields $query
1191
+ return $workItems
1192
+ }
1193
+
1194
+ function Update-AttestationStatusInWorkItem ($workItemId , $fieldName , $status )
1195
+ {
1196
+ $fields = " `" ${fieldName} =${status} `" "
1197
+
1198
+ Write-Host " Updating Work Item [$workItemId ] with status [$status ] for field [$fieldName ]."
1199
+ $workItem = UpdateWorkItem - id $workItemId - fields $fields
1200
+ Write-Host " Updated attestation status for [$fieldName ] in Work Item [$workItemId ]"
1201
+ return $true
1116
1202
}
0 commit comments