Skip to content

Commit

Permalink
[SW-201504] Trigger Internal Tests (#538)
Browse files Browse the repository at this point in the history
- Added actionlint.yaml to allow usage of self-hosted runners (without
it actionlint will throw error) - I also tried to disable some of
shellcheck warnings/errors but couldn't do that so probably this PR
should be merged even though actionlint is failing
- Update Trigger Jenkins workflow - now it will contain 4 jobs:
1. Dependency Scan - will fail the job if a dependency with high
severity vulnerability will be part of the PR
2. CodeQL Scan - scan the python code itself 
3. Calculate Tests To Trigger - will read the .jenkins/test_config.yaml
file and based on it trigger all the tests configured on it
4. Tests - The tests running on Gaudi resources
  • Loading branch information
RonBenMosheHabana authored Jan 12, 2025
1 parent c5975f8 commit c83289e
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
self-hosted-runner:
# Labels of self-hosted runner in array of strings.
labels:
- generic-runner
paths:
.github/workflows/trigger_jenkins.yml:
ignore:
- shellcheck reported issue in this script: SC2116:.+
- shellcheck reported issue in this script: SC2086:.+
- shellcheck reported issue in this script: SC2001:.+
107 changes: 102 additions & 5 deletions .github/workflows/trigger_jenkins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,108 @@ on:
permissions:
pull-requests: write
jobs:
TriggerJenkinsTests:
DependencyReview:
name: Dependency Review
runs-on: ubuntu-latest
steps:
- name: Trigger Jenkins Tests
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
with:
fail-on-severity: high
CodeQLScan:
name: CodeQL Scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python
build-mode: none
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:python"
upload: "never"
CalculateJobs:
runs-on: generic-runner
name: Calculate Tests To Trigger
needs: [DependencyReview,CodeQLScan]
outputs:
tests_list: ${{ steps.tests.outputs.tests_list }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install YQ
run: |
wget https://github.com/mikefarah/yq/releases/download/v4.14.1/yq_linux_amd64.tar.gz -O - |\
tar xz && sudo mv yq_linux_amd64 /usr/bin/yq
- name: Calculate Tests
id: tests
run: |
test_list=$(yq -oj e .jenkins/test_config.yaml | jq -c "[.stages[].steps[]]")
echo "tests_list=${test_list}" >> "$GITHUB_OUTPUT"
TestRun:
name: Test / ${{matrix.tests.name}}
needs: [CalculateJobs]
runs-on: generic-runner
strategy:
fail-fast: false
matrix:
tests: ${{ fromJson(needs.CalculateJobs.outputs.tests_list) }}
env:
USERNAME: ${{ secrets.SWUSERNAME }}
PASSWORD: ${{ secrets.SWPASSWORD }}
POD_TEMPLATE: ${{ secrets.POD_TEMPLATE }}
TEST_COMMAND: ${{ matrix.tests.command }}
steps:
- name: Download Hlctl
run: |
curl --show-error --silent ${{ secrets.HLCTL_ADDRESS }} | bash &> /dev/null
- name: Config Hlctl
run: |
${{ secrets.HLCTL_COMMAND }} &> /dev/null
- name: Create Pod Template
env:
TARGET_BRANCH: ${{ github.base_ref }}
RELEASED_SYNAPSE_VERSION: ${{ vars.RELEASED_SYNAPSE_VERSION }}
BASE_BRANCH: ${{github.head_ref}}
run: |
if [[ $TARGET_BRANCH == "habana_main" ]]; then
synapse_version=${RELEASED_SYNAPSE_VERSION#v}
elif [[ $TARGET_BRANCH =~ v*.*.* ]]; then
synapse_version=${TARGET_BRANCH#v}
else
echo "Cant Calculate Synapse Version, Failing The Test"
exit 1
fi
synapse_build=$(curl "https://dms.habana-labs.com/api/v1.1/branch/info/v$synapse_version" | jq -r ".release_id")
pt_version=${{ vars.PT_VERSION }}
BUILD_TAG="Github-vLLM-Fork-${{ github.event.number }}-${{github.run_number}}"
safe_cmd=${TEST_COMMAND//&/\\&}
echo "Writing Pod Template To File"
echo "${POD_TEMPLATE}" > pod.yml
sed -i "s/##VERSION##/${synapse_version}/g" pod.yml
sed -i "s/##BUILD##/${synapse_build}/g" pod.yml
sed -i "s/##BUILD_TAG##/${BUILD_TAG}/g" pod.yml
sed -i "s/##PYTORCH_VERSION##/${pt_version}/g" pod.yml
sed -i "s|##GIT_BRANCH##|$BASE_BRANCH|g" pod.yml
sed -i "s|##CMD##|$safe_cmd|g" pod.yml
echo "Pod Template Created"
- name: Run Test
run: |
curl -XPOST -H "Content-Type: application/json" \
"${{ secrets.WEBHOOK_URL }}" \
-d '${{ toJson(github) }}'
converted_test_name=$(echo ${{ matrix.tests.name }} | tr "_" "-")
if [[ ${#converted_test_name} -ge 33 ]];then
converted_test_name=${converted_test_name:12}
fi
hlctl create containers \
--file=pod.yml \
--flavor=${{ matrix.tests.flavor}} \
--name="vllm-fork-${{github.event.number}}-${converted_test_name}" \
--namespace="framework" \
--priority="high" \
--retry \
--shm=10240

0 comments on commit c83289e

Please sign in to comment.