diff --git a/.azuredevops/rocm_ci_caller.yml b/.azuredevops/rocm_ci_caller.yml deleted file mode 100644 index 7ac73700e..000000000 --- a/.azuredevops/rocm_ci_caller.yml +++ /dev/null @@ -1,58 +0,0 @@ -trigger: none -pr: - branches: - include: - - release/rocm-rel-* - drafts: false - -variables: - - group: internal - - name: REPOSITORY_NAME - value: '$(Build.Repository.Name)' - - name: HEAD_SHA - value: '$(system.pullRequest.sourceCommitId)' - - name: PR_NUM - value: '$(system.pullRequest.pullRequestNumber)' - - name: PR_URL - value: '$(system.pullRequest.sourceRepositoryUri)/pull/$(PR_NUM)' - - name: BASE_REF - value: '$(system.pullRequest.TargetBranch)' - - name: EVENT_TYPE - value: 'pull_request' - - name: GH_PAT - value: '$(svc_acc_org_secret)' -jobs: -- job: Trigger_Pipeline - displayName: 'Trigger Pipeline' - pool: rocm-ci-caller - steps: - - checkout: none - - script: | - rm -rf $(repo_name) - git clone $(gh_repo) - displayName: Checkout Code - - script: | - set -e - echo "Calling jenkins_api.py for PR #$(PR_NUM)" - cd $(repo_name) - docker run \ - -v "$PWD:/src" \ - -w /src \ - -e GH_TOKEN="$(svc_acc_org_secret)" \ - -e svc_acc_org_secret="$(svc_acc_org_secret)" \ - $(base_image) \ - bash -c "echo 'Fetching PR title from GitHub API...' && \ - echo 'repos/$(REPOSITORY_NAME)/pulls/$(PR_NUM)' && \ - export TITLE=\$(gh api repos/$(REPOSITORY_NAME)/pulls/$(PR_NUM) | jq -r .title) && \ - python3 jenkins_api.py \ - -ghr '$(REPOSITORY_NAME)' \ - -ghsha '$(HEAD_SHA)' \ - -ghprn '$(PR_NUM)' \ - -ghpru '$(PR_URL)' \ - -ghprt \"\$TITLE\" \ - -ghpat '$(GH_PAT)' \ - -br '$(BASE_REF)' \ - -et '$(EVENT_TYPE)'" > /dev/null 2>&1 - displayName: Invoke jenkins_api.py in Docker - env: - svc_acc_org_secret: $(svc_acc_org_secret) diff --git a/.github/workflows/rocm_ci_caller.yml b/.github/workflows/rocm_ci_caller.yml new file mode 100644 index 000000000..78e337c03 --- /dev/null +++ b/.github/workflows/rocm_ci_caller.yml @@ -0,0 +1,54 @@ +name: Trigger ROCm CI + +on: + pull_request: + types: [opened, synchronize, reopened] + branches: [release/rocm-rel-7.2] + +jobs: + trigger-rocm-ci: + runs-on: azure-vms + steps: + - name: Generate GitHub App token + id: generate-token + uses: actions/create-github-app-token@v2.1.1 + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + owner: ${{ secrets.INTERNAL_ORG }} + repositories: ${{ secrets.INTERNAL_REPO }} + + - name: Trigger ROCm CI workflow + env: + TARGET_REPO: "${{ secrets.INTERNAL_ORG }}/${{ secrets.INTERNAL_REPO }}" + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + run: | + echo "Triggering ROCm CI workflow" + echo "PR Number: ${{ github.event.pull_request.number }}" + + response=$(curl -s -w "%{http_code}" -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/$TARGET_REPO/dispatches \ + -d "{ + \"event_type\": \"public-psdb-run\", + \"client_payload\": { + \"input_sha\": \"${{ github.event.pull_request.head.sha }}\", + \"input_pr_num\": \"${{ github.event.pull_request.number }}\", + \"input_pr_url\": \"${{ github.event.pull_request.html_url }}\", + \"input_pr_title\": \"${{ github.event.pull_request.title }}\", + \"repository_name\": \"${{ github.repository }}\", + \"base_ref\": \"${{ github.event.pull_request.base.ref }}\", + \"trigger_event_type\": \"pull_request\", + \"comment_text\": \"\" + } + }") + + http_code="${response: -3}" + if [ "$http_code" = "204" ]; then + echo "Successfully triggered ROCm CI workflow" + else + echo "Failed to trigger ROCm CI workflow (HTTP $http_code)" + exit 1 + fi