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
32
43# Controls when the workflow will run
54on :
109
1110# 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
1211jobs :
13- # This workflow contains a single job called "build "
12+ # This workflow contains a single job called "invoke_jenkins_PSDB "
1413 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
1714 if : github.event.pull_request.draft == false
1815 runs-on : self-hosted
1916 env :
2320 input_pr_url : ${{ github.event.pull_request.html_url != '' && github.event.pull_request.html_url || '' }}
2421 input_pr_title : ${{ github.event.pull_request.title != '' && github.event.pull_request.title || '' }}
2522 # 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 }}
2724 JENKINS_URL : ${{secrets.CI_JENKINS_URL}}
2825 CONTAINER_IMAGE : ${{ secrets.JENKINS_TRIGGER_DOCKER_IMAGE }}
2926
@@ -55,11 +52,11 @@ jobs:
5552 JENKINS_URL : ${{secrets.CI_JENKINS_URL}}
5653 JENKINS_USER : ${{secrets.CI_JENKINS_USER}}
5754 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 }}
5956 PR_NUMBER : ${{ github.event.pull_request.number }}
6057 COMMIT_HASH : ${{ github.event.after }}
6158 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"
6360
6461
6562 # Runs a set of commands using the runners shell
@@ -76,25 +73,19 @@ jobs:
7673 echo "github.event.pull_request.id is: ${{github.event.pull_request.id}}"
7774 echo "github.event.pull_request.html_url is: ${{github.event.pull_request.html_url}}"
7875 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}}"
8076 echo "github.event.pull_request.url is: ${{github.event.pull_request.url}}"
8177 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}}"
8478 echo "github.event.pull_request.head.sha is: ${{github.event.pull_request.head.sha}}"
8579 echo "github.event.pull_request.base.ref is: ${{github.event.pull_request.base.ref}}"
8680 echo "github.event.pull_request.merge_commit_sha is: ${{github.event.pull_request.merge_commit_sha}}"
8781 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+
9384 - name : Trigger Jenkins Pipeline
9485 if : steps.check_changes.outcome != 'failure'
9586 run : |
9687 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}\""
9889 - name : Stop and remove container
9990 if : always()
10091 run : |
0 commit comments