diff --git a/.github/workflows/PSDB-amd-mainline.yml b/.github/workflows/PSDB-amd-mainline.yml new file mode 100644 index 0000000000000..95a9fa79519f5 --- /dev/null +++ b/.github/workflows/PSDB-amd-mainline.yml @@ -0,0 +1,85 @@ +# 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 +name: Compiler CI test + +# Controls when the workflow will run +on: + pull_request: + branches: [amd-mainline] + types: [opened, reopened, synchronize] + workflow_dispatch: + +# 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 +jobs: + # This workflow contains a single job called "build" + invoke_jenkins_PSDB: + # The type of runner that the job will run on. For github hosted runner use (${{ 'ubuntu-latest' }}) or self-hosted for sel-hosted runner. + #runs-on: ubuntu-latest + runs-on: self-hosted + container: + image: compute-artifactory.amd.com:5000/rocm-base-images/ghemu-action-ubuntu-24.04:2024101101 + env: + svc_acc_org_secret: ${{'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'}} + input_sha: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }} + input_pr_num: ${{ github.event.pull_request.number != '' && github.event.pull_request.number || 0 }} + input_pr_url: ${{ github.event.pull_request.html_url != '' && github.event.pull_request.html_url || '' }} + input_pr_title: ${{ github.event.pull_request.title != '' && github.event.pull_request.title || '' }} + # set the pipeline name here based on branch name + pipeline_name: ${{ 'compiler-psdb-amd-mainline' }} + JENKINS_URL: ${{'https://compiler-ci.amd.com/'}} + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Check out rocm_ci_infra private repo + uses: actions/checkout@main + with: + #ref: ci-utils-dev-siva + #fetch-depth: 2 + repository: AMD-Lightning-Internal/ci-utils + token: ${{ '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' }} + #token: ${{'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'}} + + + - name: Run Jenkins Cancel Script + env: + JENKINS_URL: ${{ 'https://compiler-ci.amd.com/' }} + JENKINS_USER: ${{ 'z1_cciauto' }} + JENKINS_API_TOKEN: ${{ '11bdb3dcd61f1a00f3999c8e3a0d6da9a7' }} + JENKINS_JOB_NAME: ${{ 'compiler-psdb-amd-mainline' }} + PR_NUMBER: ${{ github.event.pull_request.number }} + COMMIT_HASH: ${{ github.event.after }} + run: | + python3 cancel_previous_build.py + + + # Runs a set of commands using the runners shell + - name: Getting Event Details + run: | + echo $(pwd) + echo $GITHUB_ENV + echo $GITHUB_REPOSITORY + echo $GITHUB_SERVER_URL + echo "GITHUB_SHA is: $GITHUB_SHA" + echo "GITHUB_WORKFLOW_SHA is: $GITHUB_WORKFLOW_SHA" + echo "GITHUB_BASE_REF is: $GITHUB_BASE_REF" + echo "GITHUB_REF_NAME is: $GITHUB_REF_NAME" + echo "github.event.pull_request.id is: ${{github.event.pull_request.id}}" + echo "github.event.pull_request.html_url is: ${{github.event.pull_request.html_url}}" + echo "github.event.pull_request.number is: ${{github.event.pull_request.number}}" + echo "github.event.pull_request.title is: ${{github.event.pull_request.title}}" + echo "github.event.pull_request.url is: ${{github.event.pull_request.url}}" + echo "github.event.pull_request.issue_url is: ${{github.event.pull_request.issue_url}}" + echo "github.event.pull_request.comments_url is: ${{github.event.pull_request.comments_url}}" + echo "github.event.pull_request.statuses_url is: ${{github.event.pull_request.statuses_url}}" + echo "github.event.pull_request.head.sha is: ${{github.event.pull_request.head.sha}}" + echo "github.event.pull_request.base.ref is: ${{github.event.pull_request.base.ref}}" + echo "github.event.pull_request.merge_commit_sha is: ${{github.event.pull_request.merge_commit_sha}}" + echo "github.event.pull_request is: ${{github.event.pull_request}}" + pip3 show python-jenkins || echo "python-jenkins is not installed" + #sudo -H pip3 install --upgrade python-jenkins + # pipeline name shuould be unique to the workfow yml for a given repository + #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 "}' + - name: Trigger Jenkins Pipeline + if: steps.check_changes.outcome != 'failure' + run: | + echo "running jenkins_api.py with input sha - $input_sha for pull request - $input_pr_url" + 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