Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
05de774
init
danielsu-amd Jul 9, 2025
0b104e5
test branches
danielsu-amd Jul 9, 2025
3a3d0c0
use event.pr.head.sha
danielsu-amd Jul 9, 2025
3be607a
project names, use gh cli
danielsu-amd Jul 9, 2025
58949c9
fix token repo
danielsu-amd Jul 9, 2025
f51afab
print debug
danielsu-amd Jul 9, 2025
4b981eb
fix output
danielsu-amd Jul 9, 2025
3407d4f
escape quotes
danielsu-amd Jul 9, 2025
e9322e0
fix subkey
danielsu-amd Jul 9, 2025
eed20f4
double newline
danielsu-amd Jul 9, 2025
862f2a5
raw string flag
danielsu-amd Jul 9, 2025
5201c92
try newlines again
danielsu-amd Jul 9, 2025
1a2664b
newline again
danielsu-amd Jul 9, 2025
5e434ab
cancel previous inprogress runs
danielsu-amd Jul 9, 2025
f690b1d
fix api url
danielsu-amd Jul 9, 2025
3eb0006
filter repo
danielsu-amd Jul 9, 2025
64a0786
more output
danielsu-amd Jul 9, 2025
2a31657
init check report
danielsu-amd Jul 9, 2025
928562e
report template
danielsu-amd Jul 9, 2025
62e5177
debug
danielsu-amd Jul 9, 2025
5276d4c
fix template call
danielsu-amd Jul 9, 2025
47c4ca5
fix job name
danielsu-amd Jul 9, 2025
bb0abac
use stages for sequentialness
danielsu-amd Jul 9, 2025
5bd6a8a
add stage jobs
danielsu-amd Jul 9, 2025
d3e8482
fix indent
danielsu-amd Jul 9, 2025
f810bb6
always report check
danielsu-amd Jul 9, 2025
ce46fde
debug
danielsu-amd Jul 9, 2025
63ea833
change sourcebranchname to sourcebranch
danielsu-amd Jul 9, 2025
d732694
key file
danielsu-amd Jul 9, 2025
e0b9f98
key file again
danielsu-amd Jul 9, 2025
66693d7
more key file
danielsu-amd Jul 9, 2025
38e937c
try base64
danielsu-amd Jul 9, 2025
25af58d
use PR number
danielsu-amd Jul 9, 2025
3501812
job status, gh auth
danielsu-amd Jul 9, 2025
0d46f00
fix check summary sed
danielsu-amd Jul 9, 2025
a34fe40
map azure to github status
danielsu-amd Jul 9, 2025
6457289
fix semicolon
danielsu-amd Jul 10, 2025
2f03a02
conditionally set check conclusioon
danielsu-amd Jul 10, 2025
f5f2c90
fix semicolons again
danielsu-amd Jul 10, 2025
345d57b
canceled has one l apparently
danielsu-amd Jul 10, 2025
64dca9a
stage conditional
danielsu-amd Jul 10, 2025
d25a209
use checkconclusion param
danielsu-amd Jul 10, 2025
8fc939f
test rocrand
danielsu-amd Jul 10, 2025
528ff8a
rerun previous failed
danielsu-amd Jul 10, 2025
c96e3f2
improve rerun
danielsu-amd Jul 10, 2025
9e8f6de
fix new run logic
danielsu-amd Jul 10, 2025
15b6504
cancel notstarted jobs as well
danielsu-amd Jul 10, 2025
7cd6578
get pr merge commit through gh api
danielsu-amd Jul 10, 2025
03b8497
rm print
danielsu-amd Jul 10, 2025
2086c12
properly quote jq
danielsu-amd Jul 10, 2025
af187ee
fix retry api endpoint
danielsu-amd Jul 10, 2025
f20ef1b
update existing summary check for rerun jobs
danielsu-amd Jul 10, 2025
24f4a59
fix summary update job ids
danielsu-amd Jul 10, 2025
d1ebb45
missed one
danielsu-amd Jul 10, 2025
b2ee590
you cant edit completed checks, so create a new one
danielsu-amd Jul 10, 2025
20868bd
consolidate check creation
danielsu-amd Jul 10, 2025
3e6377d
missing an s
danielsu-amd Jul 10, 2025
5a4f7bb
make summary more descriptive
danielsu-amd Jul 10, 2025
6b552ae
end quote
danielsu-amd Jul 10, 2025
6493e21
escape quotes
danielsu-amd Jul 10, 2025
35875d1
fix summary formatting
danielsu-amd Jul 10, 2025
f258cd5
add explanation on how rerun works
danielsu-amd Jul 10, 2025
53cd755
use double quotes
danielsu-amd Jul 10, 2025
5652bc6
another dangling quote
danielsu-amd Jul 10, 2025
e185dd3
markdown formatting
danielsu-amd Jul 10, 2025
76fdef1
back to old merge commit method
danielsu-amd Jul 10, 2025
a0f3d11
rocprim test
danielsu-amd Jul 10, 2025
a1997fb
newline
danielsu-amd Jul 10, 2025
74a417f
fix rocprim stage name
danielsu-amd Jul 10, 2025
b4bc422
change check name
danielsu-amd Jul 11, 2025
340a57e
temp test job
danielsu-amd Jul 11, 2025
ee37fe5
fix test jobs
danielsu-amd Jul 11, 2025
478c4c4
fix conclusion logic
danielsu-amd Jul 11, 2025
388168e
carry forward successful runs in rerun summaries
danielsu-amd Jul 11, 2025
1d668d6
fix project jq parsing
danielsu-amd Jul 11, 2025
181e49f
fix table formatting
danielsu-amd Jul 11, 2025
f036a8b
wait for merge ref to exist
danielsu-amd Jul 11, 2025
780b9b7
add large diff cli fallback to detect_subtrees script
danielsu-amd Jul 11, 2025
64c99ce
rocprim rocrand test
danielsu-amd Jul 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions .azuredevops/rocprim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,37 @@ trigger:

pr: none

jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocPRIM.yml@pipelines_repo
stages:
# - stage: rocprim
# jobs:
# - template: ${{ variables.CI_COMPONENT_PATH }}/rocPRIM.yml@pipelines_repo
# parameters:
# sparseCheckoutDir: projects/rocprim
# triggerDownstreamJobs: false # todo: revert
- stage: temp_test
jobs:
- job: temp_test
displayName: 'Temporary test stage'
pool:
vmImage: ubuntu-latest
steps:
- checkout: none
- script: exit 1
- stage: report_successful
condition: succeeded()
jobs:
- template: templates/report-summary-check.yml
parameters:
sparseCheckoutDir: projects/rocprim
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
checkConclusion: success
- stage: report_failed
condition: failed()
jobs:
- template: templates/report-summary-check.yml
parameters:
checkConclusion: failure
- stage: report_cancelled
condition: canceled() # note: only 1 L in canceled()
jobs:
- template: templates/report-summary-check.yml
parameters:
checkConclusion: cancelled
37 changes: 33 additions & 4 deletions .azuredevops/rocrand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,37 @@ trigger:

pr: none

jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/rocRAND.yml@pipelines_repo
stages:
# - stage: rocrand
# jobs:
# - template: ${{ variables.CI_COMPONENT_PATH }}/rocRAND.yml@pipelines_repo
# parameters:
# sparseCheckoutDir: projects/rocrand
# triggerDownstreamJobs: false # todo: revert
- stage: temp_test
jobs:
- job: temp_test
displayName: 'Temporary test stage'
pool:
vmImage: ubuntu-latest
steps:
- checkout: none
- script: exit 0
- stage: report_successful
condition: succeeded()
jobs:
- template: templates/report-summary-check.yml
parameters:
sparseCheckoutDir: projects/rocrand
triggerDownstreamJobs: ${{ parameters.triggerDownstreamJobs }}
checkConclusion: success
- stage: report_failed
condition: failed()
jobs:
- template: templates/report-summary-check.yml
parameters:
checkConclusion: failure
- stage: report_cancelled
condition: canceled() # note: only 1 L in canceled()
jobs:
- template: templates/report-summary-check.yml
parameters:
checkConclusion: cancelled
112 changes: 112 additions & 0 deletions .azuredevops/templates/report-summary-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
parameters:
- name: checkConclusion
type: string
default: success
values:
- success
- failure
- cancelled

jobs:
- job: report_summary_check
displayName: 'Report check status: ${{ parameters.checkConclusion }}'
variables:
- group: assistant-librarian
pool:
vmImage: ubuntu-latest
steps:
- checkout: none
# - task: Bash@3
# displayName: Install GitHub CLI
# condition: always()
# inputs:
# targetType: 'inline'
# script: |
# (type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
# && sudo mkdir -p -m 755 /etc/apt/keyrings \
# && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
# && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
# && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
# && sudo mkdir -p -m 755 /etc/apt/sources.list.d \
# && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
# && sudo apt update \
# && sudo apt install gh jq -y
- task: Bash@3
displayName: Report CI status to GitHub PR Summary Check
condition: always()
env:
APP_ID: $(APP_ID)
APP_INSTALLATION_ID: $(APP_INSTALLATION_ID)
APP_PRIVATE_KEY: $(APP_PRIVATE_KEY)
inputs:
targetType: 'inline'
script: |
if [[ ! "$(Build.SourceBranch)" =~ ^refs/pull/ ]]; then
echo "This is not a PR build. Exiting."
exit 0
fi

# APP_PRIVATE_KEY is generated with `base64 app_private_key.pem | tr -d '\n'`
echo "$APP_PRIVATE_KEY" | base64 -d > app_private_key.pem
chmod 600 app_private_key.pem
create_jwt() {
local header=$(echo -n '{"alg":"RS256","typ":"JWT"}' | openssl base64 -e | tr -d '=' | tr '/+' '_-' | tr -d '\n')
local payload=$(echo -n "{\"iat\":$(date +%s),\"exp\":$(($(date +%s) + 600)),\"iss\":\"$APP_ID\"}" | openssl base64 -e | tr -d '=' | tr '/+' '_-' | tr -d '\n')
local unsigned_token="${header}.${payload}"
local signature=$(echo -n "$unsigned_token" | openssl dgst -sha256 -sign "app_private_key.pem" | openssl base64 -e | tr -d '=' | tr '/+' '_-' | tr -d '\n')
echo "${unsigned_token}.${signature}"
}
JWT=$(create_jwt)
export GH_TOKEN=$(curl -sSX POST \
-H "Authorization: Bearer $JWT" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/app/installations/$APP_INSTALLATION_ID/access_tokens" | jq -r .token)

PR_NUMBER=$(echo "$(Build.SourceBranch)" | sed 's|refs/pull/\([0-9]*\)/.*|\1|')
PR_HEAD_SHA=$(curl -s "https://api.github.com/repos/ROCm/rocm-libraries/pulls/$PR_NUMBER" | jq -r '.head.sha')
CHECK=$(curl -s "https://api.github.com/repos/ROCm/rocm-libraries/commits/$PR_HEAD_SHA/check-runs" | jq -r '.check_runs[] | select(.name == "Azure CI Summary")')
CHECK_ID=$(echo "$CHECK" | jq -r '.id')
CHECK_SUMMARY=$(echo "$CHECK" | jq -r '.output.summary')
CHECK_TEXT=$(echo "$CHECK" | jq -r '.output.text')

if [[ -z "$CHECK_ID" ]]; then
echo "No Azure CI Summary check found for commit $PR_HEAD_SHA"
exit 0
fi
if [[ "$CHECK_SUMMARY" == *"$(Build.BuildId)"* ]]; then
CHECK_SUMMARY=$(echo "$CHECK_SUMMARY" | sed "s/buildId=$(Build.BuildId)[^|]*|[^|]*|/buildId=$(Build.BuildId)) | ${{ parameters.checkConclusion }} |/")
fi
if [[ "$CHECK_TEXT" == *"$(Build.BuildId)="* ]]; then
CHECK_TEXT=$(echo "$CHECK_TEXT" | sed "s/$(Build.BuildId)=[^;]*;/$(Build.BuildId)=${{ parameters.checkConclusion }};/")
fi

CHECK_STATUS=$(echo "$CHECK_TEXT" | grep -q "pending" && echo "in_progress" || echo "completed")
CHECK_CONCLUSION=$(echo "$CHECK_TEXT" | grep -q -e "cancelled" -e "failure" && echo "failure" || echo "success")

if [[ "$CHECK_STATUS" == "completed" ]]; then
gh_output=$(gh api repos/ROCm/rocm-libraries/check-runs/$CHECK_ID \
-X PATCH \
-f "name=Azure CI Summary" \
-f "head_sha=$PR_HEAD_SHA" \
-f "status=$CHECK_STATUS" \
-f "conclusion=$CHECK_CONCLUSION" \
-f "output[title]=Azure CI Summary" \
-f "output[summary]=$CHECK_SUMMARY" \
-f "output[text]=$CHECK_TEXT")
else
gh_output=$(gh api repos/ROCm/rocm-libraries/check-runs/$CHECK_ID \
-X PATCH \
-f "name=Azure CI Summary" \
-f "head_sha=$PR_HEAD_SHA" \
-f "output[title]=Azure CI Summary" \
-f "output[summary]=$CHECK_SUMMARY" \
-f "output[text]=$CHECK_TEXT")
fi

echo "Reported status '${{ parameters.checkConclusion }}' to summary check: $(echo "$gh_output" | jq -r '.id')"
if [[ "$CHECK_STATUS" == "completed" ]]; then
echo "All checks completed with overall conclusion: $CHECK_CONCLUSION"
else
echo "Some checks are still in progress: $CHECK_STATUS"
fi
echo "Summary check URL: $(echo "$gh_output" | jq -r '.html_url')"
1 change: 0 additions & 1 deletion .github/scripts/pr_category_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def main(argv=None) -> None:
client = GitHubCLIClient()
changed_files = [file for file in client.get_changed_files(args.repo, int(args.pr))]


if not changed_files:
logger.warning("REST API failed or returned no changed files. Falling back to Git CLI...")
try:
Expand Down
16 changes: 16 additions & 0 deletions .github/scripts/pr_detect_changed_subtrees.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ def main(argv=None) -> None:
client = GitHubCLIClient()
config = load_repo_config(args.config)
changed_files = client.get_changed_files(args.repo, int(args.pr))

if not changed_files:
logger.warning("REST API failed or returned no changed files. Falling back to Git CLI...")
try:
# Ensure fetch is safe
os.system("git fetch origin +refs/pull/*/merge:refs/remotes/origin/pr/*")
# Get merge commit ref for this PR
base_ref = f"origin/{os.getenv('GITHUB_BASE_REF', 'main')}"
head_ref = "HEAD" # Assumes checkout to PR merge ref
result = os.popen(f"git diff --name-only {base_ref}...{head_ref}").read()
changed_files = result.strip().splitlines()
logger.info(f"Fallback changed files: {changed_files}")
except Exception as e:
logger.error(f"Git CLI fallback failed: {e}")
sys.exit(1)

valid_prefixes = get_valid_prefixes(config, args.require_auto_pull, args.require_auto_push)
matched_subtrees = find_matched_subtrees(changed_files, valid_prefixes)
output_subtrees(matched_subtrees, args.dry_run)
Expand Down
Loading