CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
80 lines
3.2 KiB
YAML
80 lines
3.2 KiB
YAML
name: Trigger compute-rocm-dkms-afar job on push
|
|
|
|
on:
|
|
push: # This triggers the workflow on push events
|
|
branches:
|
|
- amd-staging
|
|
workflow_dispatch: # This allows manual triggering of the workflow
|
|
|
|
jobs:
|
|
trigger_jenkins:
|
|
runs-on:
|
|
group: compiler-generic-runners
|
|
|
|
steps:
|
|
- name: Set environment variable for container image
|
|
run: |
|
|
echo "CONTAINER_IMAGE=${{ secrets.JENKINS_TRIGGER_DOCKER_IMAGE }}" >> $GITHUB_ENV
|
|
echo "CONTAINER_NAME=my_container_${{ github.run_id }}" >> $GITHUB_ENV
|
|
|
|
- name: Pull container image
|
|
run: docker pull "${{env.CONTAINER_IMAGE}}"
|
|
|
|
- name: Run container
|
|
run: |
|
|
docker run -d --name "${{env.CONTAINER_NAME}}" $CONTAINER_IMAGE sleep infinity
|
|
docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "echo 'Running commands inside the container'"
|
|
|
|
- name: Trigger compute-rocm-dkms-afar job
|
|
run: |
|
|
docker exec "${{env.CONTAINER_NAME}}" /bin/bash -c "python -c \"
|
|
import requests
|
|
import time
|
|
from requests.auth import HTTPBasicAuth
|
|
|
|
jenkins_user = '${{ secrets.CI_JENKINS_USER }}'
|
|
jenkins_token = '${{ secrets.ROCM_JENKINS_CI_TOKEN }}'
|
|
jenkins_host = '${{ secrets.ROCM_JENKINS_HOST }}'
|
|
jenkins_job = '${{ secrets.ROCM_JENKINS_OSDB_JOB }}'
|
|
|
|
jenkins_url = f'{jenkins_host}/job/{jenkins_job}/buildWithParameters'
|
|
|
|
response = requests.post(jenkins_url, auth=HTTPBasicAuth(jenkins_user, jenkins_token))
|
|
|
|
if response.status_code == 201:
|
|
print('Jenkins job triggered successfully!')
|
|
queue_url = response.headers.get('Location')
|
|
if queue_url:
|
|
print(f'Queue URL: {queue_url}')
|
|
print(f'Getting build URL(max 5 attempts with 10seconds interval)...')
|
|
# Poll the queue item to get the build number, limited to 5 attempts
|
|
max_attempts = 5
|
|
attempts = 0
|
|
while attempts < max_attempts:
|
|
queue_response = requests.get(queue_url + 'api/json', auth=HTTPBasicAuth(jenkins_user, jenkins_token))
|
|
queue_data = queue_response.json()
|
|
if 'executable' in queue_data:
|
|
build_number = queue_data['executable']['number']
|
|
build_url = f'{jenkins_host}/job/{jenkins_job}/{build_number}/'
|
|
print(f'Build URL: {build_url}')
|
|
break
|
|
attempts += 1
|
|
time.sleep(10) # Wait for 10 seconds before polling again
|
|
else:
|
|
print('Exceeded maximum attempts to get the build URL. The trigger happened, so not failing the workflow')
|
|
else:
|
|
print('Build URL not found in the response headers.')
|
|
|
|
elif response.status_code == 200:
|
|
print('Request was successful, but check the response content for details.')
|
|
print(response.text)
|
|
else:
|
|
print(f'Failed to trigger Jenkins job. Status code: {response.status_code}')
|
|
\""
|
|
|
|
- name: Stop and remove container
|
|
if: always()
|
|
run: |
|
|
docker stop "${{env.CONTAINER_NAME}}"
|
|
docker rm "${{env.CONTAINER_NAME}}"
|