Skip to content

Commit 78a285b

Browse files
committed
Merge remote-tracking branch 'ROCm/amd-staging' into HEAD
2 parents e757361 + 835ea63 commit 78a285b

File tree

2,688 files changed

+305928
-41682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,688 files changed

+305928
-41682
lines changed

.azuredevops/rocm-ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
resources:
2+
repositories:
3+
- repository: pipelines_repo
4+
type: github
5+
endpoint: ROCm
6+
name: ROCm/ROCm
7+
8+
variables:
9+
- group: common
10+
- template: /.azuredevops/variables-global.yml@pipelines_repo
11+
12+
trigger:
13+
batch: true
14+
branches:
15+
include:
16+
- amd-staging
17+
- amd-mainline-open
18+
paths:
19+
exclude:
20+
- .ci
21+
- .github
22+
- '*.md'
23+
- '**/*.md'
24+
- LICENSE.TXT
25+
26+
pr: none
27+
28+
jobs:
29+
- template: ${{ variables.CI_COMPONENT_PATH }}/llvm-project.yml@pipelines_repo

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,8 @@
185185

186186
# libclang/Python bindings
187187
/clang/bindings/python @DeinAlptraum
188+
189+
# AMD-specific projects.
190+
/amd/comgr/ @lamb-j
191+
/amd/device-libs/ @b-sumner
192+
/amd/hipcc/ @david-salinas

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

.github/dependabot.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
groups:
8+
github-actions:
9+
patterns:
10+
- "*"
11+
- package-ecosystem: "pip"
12+
directory: "/llvm/docs"
13+
schedule:
14+
interval: "monthly"
15+
groups:
16+
llvm-docs-requirements:
17+
patterns:
18+
- "*"
19+
- package-ecosystem: "pip" # See documentation for possible values
20+
directory: "/amd/hipcc/docs/sphinx" # Location of package manifests
21+
open-pull-requests-limit: 10
22+
schedule:
23+
interval: "daily"
24+
labels:
25+
- "documentation"
26+
reviewers:
27+
- "samjwu"
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Compiler CI PSDB trigger on amd-staging branch
2+
3+
# Controls when the workflow will run
4+
on:
5+
pull_request:
6+
branches: [amd-staging]
7+
types: [opened, reopened, synchronize, ready_for_review]
8+
workflow_dispatch:
9+
10+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel, below is a single job called invoke jenkins jobs
11+
jobs:
12+
# This workflow contains a single job called "invoke_jenkins_PSDB"
13+
invoke_jenkins_PSDB:
14+
if: github.event.pull_request.draft == false
15+
runs-on:
16+
group: compiler-generic-runners
17+
env:
18+
svc_acc_org_secret: ${{secrets.CI_GITHUB_TOKEN}}
19+
input_sha: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
20+
input_pr_num: ${{ github.event.pull_request.number != '' && github.event.pull_request.number || 0 }}
21+
input_pr_url: ${{ github.event.pull_request.html_url != '' && github.event.pull_request.html_url || '' }}
22+
input_pr_title: ${{ github.event.pull_request.title != '' && github.event.pull_request.title || '' }}
23+
# set the pipeline name here based on branch name
24+
pipeline_name: ${{secrets.CI_JENKINS_JOB_NAME}}
25+
JENKINS_URL: ${{secrets.CI_JENKINS_URL}}
26+
CONTAINER_IMAGE: ${{ secrets.JENKINS_TRIGGER_DOCKER_IMAGE }}
27+
28+
# Steps represent a sequence of tasks that will be executed as part of the job
29+
steps:
30+
31+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
32+
- name: Set environment variable for container image
33+
run: |
34+
echo "CONTAINER_IMAGE=${{ secrets.JENKINS_TRIGGER_DOCKER_IMAGE }}" >> $GITHUB_ENV
35+
echo "CONTAINER_NAME=my_container_${{ github.run_id }}" >> $GITHUB_ENV
36+
37+
38+
- name: Pull container image
39+
run: docker pull "${{env.CONTAINER_IMAGE}}"
40+
41+
42+
- name: Run container
43+
run: |
44+
docker run -d --name "${{env.CONTAINER_NAME}}" $CONTAINER_IMAGE sleep infinity
45+
#docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "git clone ${{secrets.CI_UTILS_REPO}} ."
46+
docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "echo 'Running commands inside the container'"
47+
48+
- name: Escape pull request title
49+
run: |
50+
import json
51+
import os
52+
import shlex
53+
with open('${{ github.event_path }}') as fh:
54+
event = json.load(fh)
55+
escaped = event['pull_request']['title']
56+
with open(os.environ['GITHUB_ENV'], 'a') as fh:
57+
print(f'PR_TITLE={escaped}', file=fh)
58+
shell: python3 {0}
59+
60+
- name: Run Jenkins Cancel Script
61+
env:
62+
JENKINS_URL: ${{secrets.CI_JENKINS_URL}}
63+
JENKINS_USER: ${{secrets.CI_JENKINS_USER}}
64+
JENKINS_API_TOKEN: ${{secrets.CI_JENKINS_TOKEN}}
65+
JENKINS_JOB_NAME: ${{secrets.CI_JENKINS_JOB_NAME}}
66+
PR_NUMBER: ${{ github.event.pull_request.number }}
67+
COMMIT_HASH: ${{ github.event.after }}
68+
run: |
69+
docker exec -e JENKINS_JOB_NAME=${{secrets.CI_JENKINS_JOB_NAME}} -e PR_NUMBER=${{ github.event.pull_request.number }} -e COMMIT_HASH=${{ github.event.after }} -e JENKINS_URL=${{secrets.CI_JENKINS_URL}} -e JENKINS_USER=${{secrets.CI_JENKINS_USER}} -e JENKINS_API_TOKEN=${{secrets.CI_JENKINS_TOKEN}} "${{env.CONTAINER_NAME}}" /bin/bash -c "PYTHONHTTPSVERIFY=0 python3 cancel_previous_build.py"
70+
71+
72+
# Runs a set of commands using the runners shell
73+
- name: Getting Event Details
74+
run: |
75+
echo $(pwd)
76+
echo $GITHUB_ENV
77+
echo $GITHUB_REPOSITORY
78+
echo $GITHUB_SERVER_URL
79+
echo "GITHUB_SHA is: $GITHUB_SHA"
80+
echo "GITHUB_WORKFLOW_SHA is: $GITHUB_WORKFLOW_SHA"
81+
echo "GITHUB_BASE_REF is: $GITHUB_BASE_REF"
82+
echo "GITHUB_REF_NAME is: $GITHUB_REF_NAME"
83+
echo "github.event.pull_request.id is: ${{github.event.pull_request.id}}"
84+
echo "github.event.pull_request.html_url is: ${{github.event.pull_request.html_url}}"
85+
echo "github.event.pull_request.number is: ${{github.event.pull_request.number}}"
86+
echo "github.event.pull_request.url is: ${{github.event.pull_request.url}}"
87+
echo "github.event.pull_request.issue_url is: ${{github.event.pull_request.issue_url}}"
88+
echo "github.event.pull_request.head.sha is: ${{github.event.pull_request.head.sha}}"
89+
echo "github.event.pull_request.base.ref is: ${{github.event.pull_request.base.ref}}"
90+
echo "github.event.pull_request.merge_commit_sha is: ${{github.event.pull_request.merge_commit_sha}}"
91+
echo "github.event.pull_request is: ${{github.event.pull_request}}"
92+
93+
94+
- name: Trigger Jenkins Pipeline
95+
if: steps.check_changes.outcome != 'failure'
96+
run: |
97+
echo "--Running jenkins_api.py with input sha - $input_sha for pull request - $input_pr_url"
98+
docker exec -e GITHUB_REPOSITORY="$GITHUB_REPOSITORY" -e svc_acc_org_secret="$svc_acc_org_secret" -e input_sha="$input_sha" -e input_pr_url="$input_pr_url" -e pipeline_name="$pipeline_name" \
99+
-e input_pr_num="$input_pr_num" -e PR_TITLE="$PR_TITLE" -e JENKINS_URL="$JENKINS_URL" -e GITHUB_PAT="$svc_acc_org_secret" "${{env.CONTAINER_NAME}}" \
100+
/bin/bash -c 'echo \"PR NUM: "$input_pr_num"\" && PYTHONHTTPSVERIFY=0 python3 jenkins_api.py -s \"${JENKINS_URL}\" -jn "$pipeline_name" -ghr "$GITHUB_REPOSITORY" -ghsha "$input_sha" -ghprn "$input_pr_num" -ghpru "$input_pr_url" -ghprt "$PR_TITLE" -ghpat="$svc_acc_org_secret"'
101+
102+
- name: Stop and remove container
103+
if: always()
104+
run: |
105+
docker stop "${{env.CONTAINER_NAME}}"
106+
docker rm "${{env.CONTAINER_NAME}}"
107+
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Trigger amd-debug Buildbot Build
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
branches: [amd-debug]
6+
types: [opened, reopened, synchronize, ready_for_review]
7+
8+
9+
jobs:
10+
trigger-build:
11+
if: github.event.pull_request.draft == false
12+
runs-on:
13+
group: compiler-generic-runners
14+
env:
15+
PR_SHA: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
16+
PR_NUMBER: ${{ github.event.pull_request.number != '' && github.event.pull_request.number || 0 }}
17+
PR_URL: ${{ github.event.pull_request.html_url != '' && github.event.pull_request.html_url || '' }}
18+
PR_TITLE: ${{ github.event.pull_request.title != '' && github.event.pull_request.title || '' }}
19+
BASE_BRANCH: ${{ github.event.pull_request.base.ref != '' && github.event.pull_request.base.ref || '' }}
20+
GITHUB_TOKEN: ${{secrets.CI_GITHUB_TOKEN}}
21+
22+
steps:
23+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
24+
- name: Set environment variable for container image
25+
run: |
26+
echo "CONTAINER_IMAGE=${{ secrets.BUILDBOT_DOCKER_IMAGE }}" >> $GITHUB_ENV
27+
echo "CONTAINER_NAME=my_container_${{ github.run_id }}" >> $GITHUB_ENV
28+
29+
- name: Pull container image
30+
run: docker pull "${{env.CONTAINER_IMAGE}}"
31+
32+
- name: Run container
33+
run: |
34+
docker run -d --name "${{env.CONTAINER_NAME}}" $CONTAINER_IMAGE sleep infinity
35+
docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "echo 'Running commands inside the container'"
36+
37+
- name: Escape pull request title
38+
run: |
39+
import json
40+
import os
41+
import shlex
42+
with open('${{ github.event_path }}') as fh:
43+
event = json.load(fh)
44+
escaped = event['pull_request']['title']
45+
with open(os.environ['GITHUB_ENV'], 'a') as fh:
46+
print(f'PR_TITLE={escaped}', file=fh)
47+
shell: python3 {0}
48+
49+
- name: Trigger Buildbot Build
50+
run: |
51+
echo "${{ secrets.BUILDBOT_HOST }}:${{ secrets.BUILDBOT_WORKER_PORT }}"
52+
docker exec -e PR_TITLE="$PR_TITLE" "${{env.CONTAINER_NAME}}" /bin/bash -c 'buildbot sendchange -W ${{ secrets.BUILDBOT_USER }} -a ${{secrets.BUILDBOT_USER}}:${{secrets.BUILDBOT_PWD}} --master="${{ secrets.BUILDBOT_HOST }}:${{ secrets.BUILDBOT_WORKER_PORT }}" --branch=${{ env.BASE_BRANCH }} --revision=${{ env.PR_SHA }} -p PR_NUMBER:${{ env.PR_NUMBER }} -p PR_TITLE:"$PR_TITLE" -p PR_URL:${{ env.PR_URL }} -p SHA:${{ env.PR_SHA }}'
53+
54+
- name: Set Initial Status to Pending
55+
run: |
56+
docker exec -e PR_SHA=$PR_SHA -e GITHUB_TOKEN=$GITHUB_TOKEN "${{env.CONTAINER_NAME}}" /bin/bash -c "python3 -c \"
57+
import os
58+
import requests
59+
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
60+
TARGET_SHA = os.getenv('PR_SHA')
61+
print('debug', TARGET_SHA)
62+
api_url = f'https://api.github.com/repos/AMD-Lightning-Internal/llvm-project/statuses/{TARGET_SHA}'
63+
headers = {
64+
'Authorization': f'token {GITHUB_TOKEN}',
65+
'Content-Type': 'application/json'
66+
}
67+
payload = {
68+
'state': 'pending',
69+
'context': 'buildbot',
70+
'description': 'Build is in queue'
71+
}
72+
response = requests.post(api_url, json=payload, headers=headers)
73+
if response.status_code == 201:
74+
print('Status set to pending successfully.')
75+
else:
76+
print(f'Failed to set status: {response.status_code} {response.text}')
77+
\""
78+
79+
- name: Poll Buildbot build status
80+
run: |
81+
python3 -c "
82+
import os
83+
import time
84+
import requests
85+
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
86+
BUILD_URL = 'http://${{ secrets.BUILDBOT_HOST }}:${{ secrets.BUILDBOT_MASTER_PORT }}/api/v2/builds'
87+
TARGET_SHA = os.getenv('PR_SHA')
88+
print('debug', TARGET_SHA)
89+
MAX_RETRIES = 10
90+
RETRY_INTERVAL = 30 # seconds
91+
92+
def get_build_properties(build_id):
93+
build_properties_url = f'http://${{ secrets.BUILDBOT_HOST }}:${{ secrets.BUILDBOT_MASTER_PORT }}/api/v2/builds/{build_id}/properties'
94+
response = requests.get(build_properties_url, headers={'Accept': 'application/json', 'Authorization': f'token {GITHUB_TOKEN}'})
95+
return response.json()
96+
97+
for i in range(MAX_RETRIES):
98+
response = requests.get(BUILD_URL, headers={'Accept': 'application/json'})
99+
response_json = response.json()
100+
print(f'Attempt {i + 1}: Buildbot response:', response_json)
101+
102+
# Check if any build has the target SHA
103+
builds = response_json.get('builds', [])
104+
print (builds)
105+
build_with_sha = None
106+
for build in builds:
107+
build_id = build['buildid']
108+
properties = get_build_properties(build_id)
109+
#print(properties)
110+
#prop = properties.get('revision', [])
111+
112+
if 'properties' in properties:
113+
print (properties['properties'])
114+
if 'revision' in properties['properties'][0]:
115+
print(properties['properties'][0])
116+
if 'revision' in properties['properties'][0] and properties['properties'][0]['revision'] [0] == TARGET_SHA:
117+
build_with_sha = build
118+
break
119+
120+
if build_with_sha:
121+
print('Build started successfully for SHA:', TARGET_SHA)
122+
break
123+
else:
124+
print('Build for SHA not started yet, retrying in', RETRY_INTERVAL, 'seconds')
125+
time.sleep(RETRY_INTERVAL)
126+
else:
127+
print('Build did not start for SHA:', TARGET_SHA, 'after maximum retries')
128+
exit(1)
129+
"
130+
131+
- name: Stop and remove container
132+
if: always()
133+
run: |
134+
docker stop "${{env.CONTAINER_NAME}}"
135+
docker rm "${{env.CONTAINER_NAME}}"
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Trigger compute-rocm-dkms-afar job on push
2+
3+
on:
4+
push: # This triggers the workflow on push events
5+
branches:
6+
- amd-staging
7+
workflow_dispatch: # This allows manual triggering of the workflow
8+
9+
jobs:
10+
trigger_jenkins:
11+
runs-on:
12+
group: compiler-generic-runners
13+
14+
steps:
15+
- name: Set environment variable for container image
16+
run: |
17+
echo "CONTAINER_IMAGE=${{ secrets.JENKINS_TRIGGER_DOCKER_IMAGE }}" >> $GITHUB_ENV
18+
echo "CONTAINER_NAME=my_container_${{ github.run_id }}" >> $GITHUB_ENV
19+
20+
- name: Pull container image
21+
run: docker pull "${{env.CONTAINER_IMAGE}}"
22+
23+
- name: Run container
24+
run: |
25+
docker run -d --name "${{env.CONTAINER_NAME}}" $CONTAINER_IMAGE sleep infinity
26+
docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "echo 'Running commands inside the container'"
27+
28+
- name: Trigger compute-rocm-dkms-afar job
29+
run: |
30+
docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "python -c \"
31+
import requests
32+
import time
33+
from requests.auth import HTTPBasicAuth
34+
35+
jenkins_user = '${{ secrets.CI_JENKINS_USER }}'
36+
jenkins_token = '${{ secrets.ROCM_JENKINS_CI_TOKEN }}'
37+
jenkins_host = '${{ secrets.ROCM_JENKINS_HOST }}'
38+
jenkins_job = '${{ secrets.ROCM_JENKINS_OSDB_JOB }}'
39+
40+
jenkins_url = f'{jenkins_host}/job/{jenkins_job}/buildWithParameters'
41+
42+
response = requests.post(jenkins_url, auth=HTTPBasicAuth(jenkins_user, jenkins_token))
43+
44+
if response.status_code == 201:
45+
print('Jenkins job triggered successfully!')
46+
queue_url = response.headers.get('Location')
47+
if queue_url:
48+
print(f'Queue URL: {queue_url}')
49+
print(f'Getting build URL(max 5 attempts with 10seconds interval)...')
50+
# Poll the queue item to get the build number, limited to 5 attempts
51+
max_attempts = 5
52+
attempts = 0
53+
while attempts < max_attempts:
54+
queue_response = requests.get(queue_url + 'api/json', auth=HTTPBasicAuth(jenkins_user, jenkins_token))
55+
queue_data = queue_response.json()
56+
if 'executable' in queue_data:
57+
build_number = queue_data['executable']['number']
58+
build_url = f'{jenkins_host}/job/{jenkins_job}/{build_number}/'
59+
print(f'Build URL: {build_url}')
60+
break
61+
attempts += 1
62+
time.sleep(10) # Wait for 10 seconds before polling again
63+
else:
64+
print('Exceeded maximum attempts to get the build URL. The trigger happened, so not failing the workflow')
65+
else:
66+
print('Build URL not found in the response headers.')
67+
68+
elif response.status_code == 200:
69+
print('Request was successful, but check the response content for details.')
70+
print(response.text)
71+
else:
72+
print(f'Failed to trigger Jenkins job. Status code: {response.status_code}')
73+
\""
74+
75+
- name: Stop and remove container
76+
if: always()
77+
run: |
78+
docker stop "${{env.CONTAINER_NAME}}"
79+
docker rm "${{env.CONTAINER_NAME}}"

0 commit comments

Comments
 (0)