Selective trigger of PSDB jobs (#783)

* Selective trigger of PSDB jobs
Tento commit je obsažen v:
ammallya
2025-08-28 09:50:11 -07:00
odevzdal GitHub
rodič 94e194eba2
revize f40c04be62
+55 -14
Zobrazit soubor
@@ -3,12 +3,8 @@ pr:
branches:
include:
- develop
paths:
include:
- projects/*
- shared/*
drafts: false
variables:
- group: internal
- name: REPOSITORY_NAME
@@ -25,17 +21,46 @@ variables:
value: 'pull_request'
- name: GH_PAT
value: '$(svc_acc_org_secret)'
jobs:
- job: Trigger_Pipeline
displayName: 'Trigger Pipeline'
- job: Determine_Changes
displayName: 'Check Changed Files'
pool: rocm-ci-caller
steps:
- checkout: none
- script: |
- checkout: self
- script: |
echo "## Detecting file changes in PR #$(PR_NUM)"
git fetch origin $(BASE_REF)
git diff --name-only origin/$(BASE_REF)...HEAD > changed_files.txt
echo "Changed files:"
cat changed_files.txt
MATCH_FOUND=false
while read file; do
if [[ "$file" == projects/* || "$file" == shared/* ]]; then
MATCH_FOUND=true
break
fi
done < changed_files.txt
echo "##vso[task.setvariable variable=match_found]$MATCH_FOUND"
displayName: Detect path changes
- job: Trigger_Pipeline
displayName: 'Trigger Pipeline or Skip'
dependsOn: Determine_Changes
condition: succeeded()
pool: rocm-ci-caller
steps:
- checkout: none
- ${{ if eq(dependencies.Determine_Changes.outputs['Determine_Changes.match_found'], 'true') }}:
- script: |
rm -rf $(repo_name)
git clone $(gh_repo)
displayName: Checkout Code
- script: |
displayName: Checkout Code
- script: |
set -e
echo "Calling jenkins_api.py for PR #$(PR_NUM)"
cd $(repo_name)
@@ -57,6 +82,22 @@ jobs:
-ghpat '$(GH_PAT)' \
-br '$(BASE_REF)' \
-et '$(EVENT_TYPE)'" > /dev/null 2>&1
displayName: Invoke jenkins_api.py in Docker
env:
svc_acc_org_secret: $(svc_acc_org_secret)
displayName: Invoke jenkins_api.py in Docker
env:
svc_acc_org_secret: $(svc_acc_org_secret)
- ${{ if ne(dependencies.Determine_Changes.outputs['Determine_Changes.match_found'], 'true') }}:
- script: |
echo "Changes outside monitored paths. Skipping Jenkins trigger."
echo "Sending success status for PSDB..."
gh api repos/$(REPOSITORY_NAME)/statuses/$(HEAD_SHA) \
-H "Authorization: token $(GH_PAT)" \
-f state=success \
-f context="PSDB" \
-f description="PSDB skipped"
gh api repos/$(REPOSITORY_NAME)/statuses/$(HEAD_SHA) \
-H "Authorization: token $(GH_PAT)" \
-f state=success \
-f context="psdb-test" \
-f description="psdb-test skipped"
displayName: Send Skipped Status