Skip to content

Commit 8c4adbd

Browse files
committed
update gen rules
1 parent 5103731 commit 8c4adbd

2 files changed

Lines changed: 31 additions & 11 deletions

File tree

codebundles/azure-devops-project-health/.runwhen/generation-rules/azure-devops-triage.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ spec:
44
platform: azure_devops
55
generationRules:
66
- resourceTypes:
7-
- organization
7+
- project
88
matchRules:
99
- type: pattern
1010
pattern: ".+"
1111
properties: ["name"]
1212
mode: substring
1313
slxs:
1414
- baseName: az-devops-triage
15-
qualifiers: ["resource"]
15+
qualifiers: ["organization"]
1616
baseTemplateName: azure-devops-triage
1717
levelOfDetail: basic
1818
outputItems:

codebundles/azure-devops-project-health/.test/Taskfile.yaml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,19 +274,39 @@ tasks:
274274
done
275275
silent: true
276276
delete-slxs:
277-
desc: "Delete generated SLX resources"
277+
desc: "Delete SLX objects from the appropriate URL"
278+
env:
279+
RW_WORKSPACE: '{{.RW_WORKSPACE | default "my-workspace"}}'
280+
RW_API_URL: "{{.RW_API}}"
281+
RW_PAT: "{{.RW_PAT}}"
278282
cmds:
283+
- task: check-rwp-config
279284
- |
280-
echo "Cleaning up generated SLX resources..."
281-
if [ -f "workspaceInfo.yaml" ]; then
282-
rm workspaceInfo.yaml
283-
echo "✓ workspaceInfo.yaml removed"
284-
fi
285-
if [ -d ".test/output" ]; then
286-
rm -rf .test/output
287-
echo "✓ Test output directory removed"
285+
BASE_DIR="output/workspaces/${RW_WORKSPACE}/slxs"
286+
if [ ! -d "$BASE_DIR" ]; then
287+
echo "Directory $BASE_DIR does not exist. Deletion aborted."
288+
exit 1
288289
fi
289290
291+
for dir in "$BASE_DIR"/*; do
292+
if [ -d "$dir" ]; then
293+
SLX_NAME=$(basename "$dir")
294+
URL="https://${RW_API_URL}/api/v3/workspaces/${RW_WORKSPACE}/branches/main/slxs/${SLX_NAME}"
295+
echo "Deleting SLX: $SLX_NAME from $URL"
296+
response=$(curl -v -X DELETE "$URL" \
297+
-H "Authorization: Bearer $RW_PAT" \
298+
-H "Content-Type: application/json" -w "%{http_code}" -o /dev/null -s 2>&1)
299+
300+
if [[ "$response" =~ 200|204 ]]; then
301+
echo "Successfully deleted SLX: $SLX_NAME from $URL"
302+
else
303+
echo "Failed to delete SLX: $SLX_NAME from $URL. Response:"
304+
echo "$response"
305+
fi
306+
fi
307+
done
308+
silent: true
309+
290310
clean-rwl-discovery:
291311
desc: "Clean RunWhen Local discovery files"
292312
cmds:

0 commit comments

Comments
 (0)