1
- # This workflow is used to invoke the PSDB jenkins job for rocm 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 on amd-mainline branch
1
+ name : Compiler CI PSDB trigger on amd-mainline branch
3
2
4
3
# Controls when the workflow will run
5
4
on :
10
9
11
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
12
11
jobs :
13
- # This workflow contains a single job called "build "
12
+ # This workflow contains a single job called "invoke_jenkins_PSDB "
14
13
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
14
if : github.event.pull_request.draft == false
18
15
runs-on : self-hosted
19
16
env :
23
20
input_pr_url : ${{ github.event.pull_request.html_url != '' && github.event.pull_request.html_url || '' }}
24
21
input_pr_title : ${{ github.event.pull_request.title != '' && github.event.pull_request.title || '' }}
25
22
# set the pipeline name here based on branch name
26
- pipeline_name : ${{secrets.CI_JENKINS_JOB_NAME }}
23
+ pipeline_name : ${{secrets.CI_JENKINS_MAINLINE_JOB_NAME }}
27
24
JENKINS_URL : ${{secrets.CI_JENKINS_URL}}
28
25
CONTAINER_IMAGE : ${{ secrets.JENKINS_TRIGGER_DOCKER_IMAGE }}
29
26
@@ -55,11 +52,11 @@ jobs:
55
52
JENKINS_URL : ${{secrets.CI_JENKINS_URL}}
56
53
JENKINS_USER : ${{secrets.CI_JENKINS_USER}}
57
54
JENKINS_API_TOKEN : ${{secrets.CI_JENKINS_TOKEN}}
58
- JENKINS_JOB_NAME : ${{secrets.CI_JENKINS_JOB_NAME }}
55
+ JENKINS_JOB_NAME : ${{secrets.CI_JENKINS_MAINLINE_JOB_NAME }}
59
56
PR_NUMBER : ${{ github.event.pull_request.number }}
60
57
COMMIT_HASH : ${{ github.event.after }}
61
58
run : |
62
- 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 "python3 cancel_previous_build.py"
59
+ docker exec -e JENKINS_JOB_NAME=${{secrets.CI_JENKINS_MAINLINE_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 "python3 cancel_previous_build.py"
63
60
64
61
65
62
# Runs a set of commands using the runners shell
@@ -76,25 +73,19 @@ jobs:
76
73
echo "github.event.pull_request.id is: ${{github.event.pull_request.id}}"
77
74
echo "github.event.pull_request.html_url is: ${{github.event.pull_request.html_url}}"
78
75
echo "github.event.pull_request.number is: ${{github.event.pull_request.number}}"
79
- echo "github.event.pull_request.title is: ${{github.event.pull_request.title}}"
80
76
echo "github.event.pull_request.url is: ${{github.event.pull_request.url}}"
81
77
echo "github.event.pull_request.issue_url is: ${{github.event.pull_request.issue_url}}"
82
- echo "github.event.pull_request.comments_url is: ${{github.event.pull_request.comments_url}}"
83
- echo "github.event.pull_request.statuses_url is: ${{github.event.pull_request.statuses_url}}"
84
78
echo "github.event.pull_request.head.sha is: ${{github.event.pull_request.head.sha}}"
85
79
echo "github.event.pull_request.base.ref is: ${{github.event.pull_request.base.ref}}"
86
80
echo "github.event.pull_request.merge_commit_sha is: ${{github.event.pull_request.merge_commit_sha}}"
87
81
echo "github.event.pull_request is: ${{github.event.pull_request}}"
88
- pip3 show python-jenkins || echo "python-jenkins is not installed"
89
- #sudo -H pip3 install --upgrade python-jenkins
90
- # pipeline name shuould be unique to the workfow yml for a given repository
91
- #curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{secrets.CI_GITHUB_TOKEN}}" ${{github.event.pull_request.comments_url}} -d '{"body":"Github action triggered jenkins job for compute-psdb-staging-smi-libs-ghemu "}'
92
- #python jenkins_api.py -jn compute-psdb-staging-smi-libs-ghemu -ghr $GITHUB_REPOSITORY -ghsha $input_sha -ghprn $input_pr_num -ghpru "$input_pr_url" -ghprt "$input_pr_title"
82
+
83
+
93
84
- name : Trigger Jenkins Pipeline
94
85
if : steps.check_changes.outcome != 'failure'
95
86
run : |
96
87
echo "--Running jenkins_api.py with input sha - $input_sha for pull request - $input_pr_url"
97
- docker exec -e JENKINS_URL=${{secrets.CI_JENKINS_URL}} -e GITHUB_PAT=${{secrets.CI_GITHUB_TOKEN}} "${{env.CONTAINER_NAME}}" /bin/bash -c "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}\""
88
+ docker exec -e JENKINS_URL=${{secrets.CI_JENKINS_URL}} -e GITHUB_PAT=${{secrets.CI_GITHUB_TOKEN}} "${{env.CONTAINER_NAME}}" /bin/bash -c "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}\""
98
89
- name : Stop and remove container
99
90
if : always()
100
91
run : |
0 commit comments