Skip to content

Commit c0e9e25

Browse files
authored
Update PSDB-amd-mainline.yml
1 parent 14e5b26 commit c0e9e25

File tree

1 file changed

+43
-26
lines changed

1 file changed

+43
-26
lines changed
Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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 amd-mainline PSDB trigger
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
33

44
# Controls when the workflow will run
55
on:
@@ -13,43 +13,53 @@ jobs:
1313
# This workflow contains a single job called "build"
1414
invoke_jenkins_PSDB:
1515
# 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
16+
#runs-on: ubuntu-latest
1717
if: github.event.pull_request.draft == false
1818
runs-on: self-hosted
19-
container:
20-
image: compute-artifactory.amd.com:5000/rocm-base-images/ghemu-action-ubuntu-24.04:2024101101
2119
env:
22-
svc_acc_org_secret: ${{'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'}}
20+
svc_acc_org_secret: ${{secrets.CI_GITHUB_TOKEN}}
2321
input_sha: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
2422
input_pr_num: ${{ github.event.pull_request.number != '' && github.event.pull_request.number || 0 }}
2523
input_pr_url: ${{ github.event.pull_request.html_url != '' && github.event.pull_request.html_url || '' }}
2624
input_pr_title: ${{ github.event.pull_request.title != '' && github.event.pull_request.title || '' }}
2725
# set the pipeline name here based on branch name
28-
pipeline_name: ${{ 'compiler-psdb-amd-mainline' }}
29-
JENKINS_URL: ${{'https://compiler-ci.amd.com/'}}
26+
pipeline_name: ${{secrets.CI_JENKINS_JOB_NAME}}
27+
JENKINS_URL: ${{secrets.CI_JENKINS_URL}}
28+
CONTAINER_IMAGE: ${{ secrets.JENKINS_TRIGGER_DOCKER_IMAGE }}
29+
3030
# Steps represent a sequence of tasks that will be executed as part of the job
31-
steps:
32-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
33-
- name: Check out rocm_ci_infra private repo
34-
uses: actions/checkout@main
35-
with:
36-
#ref: ci-utils-dev-siva
37-
#fetch-depth: 2
38-
repository: AMD-Lightning-Internal/ci-utils
39-
token: ${{ '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' }}
40-
#token: ${{'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'}}
31+
steps:
4132

33+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
34+
- name: Set environment variable for container image
35+
run: |
36+
echo "CONTAINER_IMAGE=${{ secrets.JENKINS_TRIGGER_DOCKER_IMAGE }}" >> $GITHUB_ENV
37+
echo "CONTAINER_NAME=my_container_${{ github.run_id }}" >> $GITHUB_ENV
38+
- name: Print environment variables
39+
run: |
40+
echo "CONTAINER_IMAGE=${{ env.CONTAINER_IMAGE }}"
41+
echo "CONTAINER_NAME=${{ env.CONTAINER_NAME }}"
4242
43+
- name: Pull container image
44+
run: docker pull "${{env.CONTAINER_IMAGE}}"
45+
46+
47+
- name: Run container
48+
run: |
49+
docker run -d --name "${{env.CONTAINER_NAME}}" $CONTAINER_IMAGE sleep infinity
50+
#docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "git clone ${{secrets.CI_UTILS_REPO}} ."
51+
docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "echo 'Running commands inside the container'"
52+
4353
- name: Run Jenkins Cancel Script
4454
env:
45-
JENKINS_URL: ${{ 'https://compiler-ci.amd.com/' }}
46-
JENKINS_USER: ${{ 'z1_cciauto' }}
47-
JENKINS_API_TOKEN: ${{ '11bdb3dcd61f1a00f3999c8e3a0d6da9a7' }}
48-
JENKINS_JOB_NAME: ${{ 'compiler-psdb-amd-mainline' }}
55+
JENKINS_URL: ${{secrets.CI_JENKINS_URL}}
56+
JENKINS_USER: ${{secrets.CI_JENKINS_USER}}
57+
JENKINS_API_TOKEN: ${{secrets.CI_JENKINS_TOKEN}}
58+
JENKINS_JOB_NAME: ${{secrets.CI_JENKINS_JOB_NAME}}
4959
PR_NUMBER: ${{ github.event.pull_request.number }}
5060
COMMIT_HASH: ${{ github.event.after }}
5161
run: |
52-
python3 cancel_previous_build.py
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"
5363
5464
5565
# Runs a set of commands using the runners shell
@@ -66,6 +76,7 @@ jobs:
6676
echo "github.event.pull_request.id is: ${{github.event.pull_request.id}}"
6777
echo "github.event.pull_request.html_url is: ${{github.event.pull_request.html_url}}"
6878
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}}"
6980
echo "github.event.pull_request.url is: ${{github.event.pull_request.url}}"
7081
echo "github.event.pull_request.issue_url is: ${{github.event.pull_request.issue_url}}"
7182
echo "github.event.pull_request.comments_url is: ${{github.event.pull_request.comments_url}}"
@@ -77,9 +88,15 @@ jobs:
7788
pip3 show python-jenkins || echo "python-jenkins is not installed"
7889
#sudo -H pip3 install --upgrade python-jenkins
7990
# 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 "}'
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"
8193
- name: Trigger Jenkins Pipeline
8294
if: steps.check_changes.outcome != 'failure'
8395
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
96+
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}\""
98+
- name: Stop and remove container
99+
if: always()
100+
run: |
101+
docker stop "${{env.CONTAINER_NAME}}"
102+
docker rm "${{env.CONTAINER_NAME}}"

0 commit comments

Comments
 (0)