From 0157d4e7ff8a0309b1cbd251da87b6c2fdfbd0f6 Mon Sep 17 00:00:00 2001 From: "Mallya, Ameya Keshava" Date: Tue, 10 Dec 2024 13:13:17 -0800 Subject: [PATCH] Reusable PSDB/OSDB (#65) * Deleting redundant action * Single reusable workflow for PSDB and OSDB * fixed calling psdb for mainline [ROCm/rocprofiler-sdk commit: f80480cc868395474f205f7c74b1b33d865e1cac] --- .../.github/workflows/OSDB.yml | 64 ------------------ .../.github/workflows/PSDB.yml | 65 ------------------- .../.github/workflows/rocm_ci_caller.yml | 22 +++++++ 3 files changed, 22 insertions(+), 129 deletions(-) delete mode 100644 projects/rocprofiler-sdk/.github/workflows/OSDB.yml delete mode 100644 projects/rocprofiler-sdk/.github/workflows/PSDB.yml create mode 100644 projects/rocprofiler-sdk/.github/workflows/rocm_ci_caller.yml diff --git a/projects/rocprofiler-sdk/.github/workflows/OSDB.yml b/projects/rocprofiler-sdk/.github/workflows/OSDB.yml deleted file mode 100644 index 98440a14d2..0000000000 --- a/projects/rocprofiler-sdk/.github/workflows/OSDB.yml +++ /dev/null @@ -1,64 +0,0 @@ -# This workflow is used to invoke the OSDB jenkins job for rocm CI. The python script can be used to invoke any jenkins job but input params needs to be configured properly -name: ROCm CI OSDB - -# Controls when the workflow will run -on: - push: - branches: [amd-mainline] - 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_OSDB: - # 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: self-hosted - container: - image: compute-artifactory.amd.com:5000/rocm-base-images/ghemu-action-ubuntu-24.04:2024101101 - env: - svc_acc_org_secret: ${{secrets.ROCM_SERVICE_ACCOUNT_PAT}} - 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: ${{ github.event.pull_request.base.ref == 'amd-mainline' && 'compute-psdb-no-npi' || 'compute-rocm-dkms-no-npi-hipclang' }} - # 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: - repository: AMD-ROCm-Internal/rocm_ci_infra - token: ${{ secrets.ROCM_SERVICE_ACCOUNT_PAT }} - - # 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}}" - # 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 ${{secrets.ROCM_SERVICE_ACCOUNT_PAT}}" ${{github.event.pull_request.comments_url}} -d '{"body":"Github action triggered jenkins job for compute-psdb-staging-smi-libs-ghemu "}' - #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" - - name: Trigger Jenkins Pipeline - run: | - echo "running jenkins_api.py with input sha - $input_sha for pull request - $input_pr_url" - python3 jenkins_api.py -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 diff --git a/projects/rocprofiler-sdk/.github/workflows/PSDB.yml b/projects/rocprofiler-sdk/.github/workflows/PSDB.yml deleted file mode 100644 index 2f875190d1..0000000000 --- a/projects/rocprofiler-sdk/.github/workflows/PSDB.yml +++ /dev/null @@ -1,65 +0,0 @@ -# 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 -name: ROCm CI PSDB - -# Controls when the workflow will run -on: - pull_request: - branches: [amd-staging] - types: [opened, reopened] - 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: self-hosted - container: - image: compute-artifactory.amd.com:5000/rocm-base-images/ghemu-action-ubuntu-24.04:2024101101 - env: - svc_acc_org_secret: ${{secrets.ROCM_SERVICE_ACCOUNT_PAT}} - 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: ${{ github.event.pull_request.base.ref == 'amd-mainline' && 'compute-psdb-no-npi' || 'compute-psdb-staging-profiler-sdk-internal-emu' }} - # 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: - repository: AMD-ROCm-Internal/rocm_ci_infra - token: ${{ secrets.ROCM_SERVICE_ACCOUNT_PAT }} - - # 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}}" - # 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 ${{secrets.ROCM_SERVICE_ACCOUNT_PAT}}" ${{github.event.pull_request.comments_url}} -d '{"body":"Github action triggered jenkins job for compute-psdb-staging-smi-libs-ghemu "}' - #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" - - name: Trigger Jenkins Pipeline - run: | - echo "running jenkins_api.py with input sha - $input_sha for pull request - $input_pr_url" - python3 jenkins_api.py -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 diff --git a/projects/rocprofiler-sdk/.github/workflows/rocm_ci_caller.yml b/projects/rocprofiler-sdk/.github/workflows/rocm_ci_caller.yml new file mode 100644 index 0000000000..1032b79626 --- /dev/null +++ b/projects/rocprofiler-sdk/.github/workflows/rocm_ci_caller.yml @@ -0,0 +1,22 @@ +name: ROCm CI Caller + +on: + pull_request: + branches: [amd-staging] + types: [opened, reopened, synchronize] + push: + branches: [amd-mainline] + workflow_dispatch: + +jobs: + call-workflow: + uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline + secrets: inherit + with: + input_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + input_pr_num: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || 0 }} + input_pr_url: ${{ github.event_name == 'pull_request' && github.event.pull_request.html_url || '' }} + input_pr_title: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || '' }} + repository_name: ${{ github.repository }} + base_ref: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }} + trigger_event_type: ${{ github.event_name }}