Skip to content

Commit e5205f5

Browse files
authored
Merge pull request #60 from AMD-Lightning-Internal/mainline-add-psdb-yaml
Adding Github workflow file to trigger PSDB
2 parents 7035ae9 + 4f3fde4 commit e5205f5

File tree

2 files changed

+170
-0
lines changed

2 files changed

+170
-0
lines changed
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This workflow is used to invoke the PSDB jenkins job for ROCm Compiler CI. The python script can be used to invoke any jenkins job but input params needs to be configured properly
2+
name: Compiler CI test
3+
4+
# Controls when the workflow will run
5+
on:
6+
pull_request:
7+
branches: [amd-mainline]
8+
types: [opened, reopened, synchronize]
9+
workflow_dispatch:
10+
11+
# 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
12+
jobs:
13+
# This workflow contains a single job called "build"
14+
invoke_jenkins_PSDB:
15+
# The type of runner that the job will run on. For github hosted runner use (${{ 'ubuntu-latest' }}) or self-hosted for sel-hosted runner.
16+
#runs-on: ubuntu-latest
17+
runs-on: self-hosted
18+
container:
19+
image: compute-artifactory.amd.com:5000/rocm-base-images/ghemu-action-ubuntu-24.04:2024101101
20+
env:
21+
svc_acc_org_secret: ${{'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'}}
22+
input_sha: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
23+
input_pr_num: ${{ github.event.pull_request.number != '' && github.event.pull_request.number || 0 }}
24+
input_pr_url: ${{ github.event.pull_request.html_url != '' && github.event.pull_request.html_url || '' }}
25+
input_pr_title: ${{ github.event.pull_request.title != '' && github.event.pull_request.title || '' }}
26+
# set the pipeline name here based on branch name
27+
pipeline_name: ${{ 'compiler-psdb-amd-mainline' }}
28+
JENKINS_URL: ${{'https://compiler-ci.amd.com/'}}
29+
# Steps represent a sequence of tasks that will be executed as part of the job
30+
steps:
31+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
32+
- name: Check out rocm_ci_infra private repo
33+
uses: actions/checkout@main
34+
with:
35+
#ref: ci-utils-dev-siva
36+
#fetch-depth: 2
37+
repository: AMD-Lightning-Internal/ci-utils
38+
token: ${{ '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' }}
39+
#token: ${{'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'}}
40+
41+
42+
- name: Run Jenkins Cancel Script
43+
env:
44+
JENKINS_URL: ${{ 'https://compiler-ci.amd.com/' }}
45+
JENKINS_USER: ${{ 'z1_cciauto' }}
46+
JENKINS_API_TOKEN: ${{ '11bdb3dcd61f1a00f3999c8e3a0d6da9a7' }}
47+
JENKINS_JOB_NAME: ${{ 'compiler-psdb-amd-mainline' }}
48+
PR_NUMBER: ${{ github.event.pull_request.number }}
49+
COMMIT_HASH: ${{ github.event.after }}
50+
run: |
51+
python3 cancel_previous_build.py
52+
53+
54+
# Runs a set of commands using the runners shell
55+
- name: Getting Event Details
56+
run: |
57+
echo $(pwd)
58+
echo $GITHUB_ENV
59+
echo $GITHUB_REPOSITORY
60+
echo $GITHUB_SERVER_URL
61+
echo "GITHUB_SHA is: $GITHUB_SHA"
62+
echo "GITHUB_WORKFLOW_SHA is: $GITHUB_WORKFLOW_SHA"
63+
echo "GITHUB_BASE_REF is: $GITHUB_BASE_REF"
64+
echo "GITHUB_REF_NAME is: $GITHUB_REF_NAME"
65+
echo "github.event.pull_request.id is: ${{github.event.pull_request.id}}"
66+
echo "github.event.pull_request.html_url is: ${{github.event.pull_request.html_url}}"
67+
echo "github.event.pull_request.number is: ${{github.event.pull_request.number}}"
68+
echo "github.event.pull_request.title is: ${{github.event.pull_request.title}}"
69+
echo "github.event.pull_request.url is: ${{github.event.pull_request.url}}"
70+
echo "github.event.pull_request.issue_url is: ${{github.event.pull_request.issue_url}}"
71+
echo "github.event.pull_request.comments_url is: ${{github.event.pull_request.comments_url}}"
72+
echo "github.event.pull_request.statuses_url is: ${{github.event.pull_request.statuses_url}}"
73+
echo "github.event.pull_request.head.sha is: ${{github.event.pull_request.head.sha}}"
74+
echo "github.event.pull_request.base.ref is: ${{github.event.pull_request.base.ref}}"
75+
echo "github.event.pull_request.merge_commit_sha is: ${{github.event.pull_request.merge_commit_sha}}"
76+
echo "github.event.pull_request is: ${{github.event.pull_request}}"
77+
pip3 show python-jenkins || echo "python-jenkins is not installed"
78+
#sudo -H pip3 install --upgrade python-jenkins
79+
# pipeline name shuould be unique to the workfow yml for a given repository
80+
#curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{'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'}}" ${{github.event.pull_request.comments_url}} -d '{"body":"Github action triggered jenkins job for compute-psdb-staging-smi-libs-ghemu "}'
81+
- name: Trigger Jenkins Pipeline
82+
if: steps.check_changes.outcome != 'failure'
83+
run: |
84+
echo "running jenkins_api.py with input sha - $input_sha for pull request - $input_pr_url"
85+
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 "$input_pr_title" -ghpat $svc_acc_org_secret
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This workflow is used to invoke the PSDB jenkins job for ROCm Compiler CI. The python script can be used to invoke any jenkins job but input params needs to be configured properly
2+
name: Compiler CI test
3+
4+
# Controls when the workflow will run
5+
on:
6+
pull_request:
7+
branches: [amd-staging]
8+
types: [opened, reopened, synchronize]
9+
workflow_dispatch:
10+
11+
# 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
12+
jobs:
13+
# This workflow contains a single job called "build"
14+
invoke_jenkins_PSDB:
15+
# The type of runner that the job will run on. For github hosted runner use (${{ 'ubuntu-latest' }}) or self-hosted for sel-hosted runner.
16+
#runs-on: ubuntu-latest
17+
runs-on: self-hosted
18+
container:
19+
image: compute-artifactory.amd.com:5000/rocm-base-images/ghemu-action-ubuntu-24.04:2024101101
20+
env:
21+
svc_acc_org_secret: ${{'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'}}
22+
input_sha: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
23+
input_pr_num: ${{ github.event.pull_request.number != '' && github.event.pull_request.number || 0 }}
24+
input_pr_url: ${{ github.event.pull_request.html_url != '' && github.event.pull_request.html_url || '' }}
25+
input_pr_title: ${{ github.event.pull_request.title != '' && github.event.pull_request.title || '' }}
26+
# set the pipeline name here based on branch name
27+
pipeline_name: ${{ 'compiler-psdb-amd-staging' }}
28+
JENKINS_URL: ${{'https://compiler-ci.amd.com/'}}
29+
# Steps represent a sequence of tasks that will be executed as part of the job
30+
steps:
31+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
32+
- name: Check out rocm_ci_infra private repo
33+
uses: actions/checkout@main
34+
with:
35+
#ref: ci-utils-dev-siva
36+
#fetch-depth: 2
37+
repository: AMD-Lightning-Internal/ci-utils
38+
token: ${{ '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' }}
39+
#token: ${{'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'}}
40+
41+
42+
- name: Run Jenkins Cancel Script
43+
env:
44+
JENKINS_URL: ${{ 'https://compiler-ci.amd.com/' }}
45+
JENKINS_USER: ${{ 'z1_cciauto' }}
46+
JENKINS_API_TOKEN: ${{ '11bdb3dcd61f1a00f3999c8e3a0d6da9a7' }}
47+
JENKINS_JOB_NAME: ${{ 'compiler-psdb-amd-staging' }}
48+
PR_NUMBER: ${{ github.event.pull_request.number }}
49+
COMMIT_HASH: ${{ github.event.after }}
50+
run: |
51+
python3 cancel_previous_build.py
52+
53+
54+
# Runs a set of commands using the runners shell
55+
- name: Getting Event Details
56+
run: |
57+
echo $(pwd)
58+
echo $GITHUB_ENV
59+
echo $GITHUB_REPOSITORY
60+
echo $GITHUB_SERVER_URL
61+
echo "GITHUB_SHA is: $GITHUB_SHA"
62+
echo "GITHUB_WORKFLOW_SHA is: $GITHUB_WORKFLOW_SHA"
63+
echo "GITHUB_BASE_REF is: $GITHUB_BASE_REF"
64+
echo "GITHUB_REF_NAME is: $GITHUB_REF_NAME"
65+
echo "github.event.pull_request.id is: ${{github.event.pull_request.id}}"
66+
echo "github.event.pull_request.html_url is: ${{github.event.pull_request.html_url}}"
67+
echo "github.event.pull_request.number is: ${{github.event.pull_request.number}}"
68+
echo "github.event.pull_request.title is: ${{github.event.pull_request.title}}"
69+
echo "github.event.pull_request.url is: ${{github.event.pull_request.url}}"
70+
echo "github.event.pull_request.issue_url is: ${{github.event.pull_request.issue_url}}"
71+
echo "github.event.pull_request.comments_url is: ${{github.event.pull_request.comments_url}}"
72+
echo "github.event.pull_request.statuses_url is: ${{github.event.pull_request.statuses_url}}"
73+
echo "github.event.pull_request.head.sha is: ${{github.event.pull_request.head.sha}}"
74+
echo "github.event.pull_request.base.ref is: ${{github.event.pull_request.base.ref}}"
75+
echo "github.event.pull_request.merge_commit_sha is: ${{github.event.pull_request.merge_commit_sha}}"
76+
echo "github.event.pull_request is: ${{github.event.pull_request}}"
77+
pip3 show python-jenkins || echo "python-jenkins is not installed"
78+
#sudo -H pip3 install --upgrade python-jenkins
79+
# pipeline name shuould be unique to the workfow yml for a given repository
80+
#curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{'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'}}" ${{github.event.pull_request.comments_url}} -d '{"body":"Github action triggered jenkins job for compute-psdb-staging-smi-libs-ghemu "}'
81+
- name: Trigger Jenkins Pipeline
82+
if: steps.check_changes.outcome != 'failure'
83+
run: |
84+
echo "running jenkins_api.py with input sha - $input_sha for pull request - $input_pr_url"
85+
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 "$input_pr_title" -ghpat $svc_acc_org_secret

0 commit comments

Comments
 (0)