Skip to content

Commit

Permalink
Redefine PR workflow
Browse files Browse the repository at this point in the history
Signed-off-by: ZePan110 <[email protected]>
  • Loading branch information
ZePan110 committed Jan 17, 2025
1 parent 12cef73 commit 435fa22
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
48 changes: 25 additions & 23 deletions .github/workflows/_run-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ on:
default: "xeon"
required: true
type: string
valuefile:
default: "values"
required: true
type: string

jobs:
get-test-case:
Expand Down Expand Up @@ -63,28 +59,34 @@ jobs:
run: |
set -x
if [ "${{ inputs.mode }}" = "CI" ]; then
value_files=[\"${{ inputs.valuefile }}\"]
echo $value_files
base_commit=${{ github.event.pull_request.base.sha }}
merged_commit=$(git log -1 --format='%H')
values_files=$(git diff --name-only ${base_commit} ${merged_commit} | \
grep "kubernetes" | \
sort -u )
echo $values_files
elif [ "${{ inputs.mode }}" = "CD" ]; then
value_files="["
for file in ${{ github.workspace }}/comps/"${{ inputs.service }}"/deployment/kubernetes/*values.yaml; do
if [ -f "$file" ]; then
filename=$(basename "$file")
if [[ "$filename" == *"gaudi"* ]]; then
if [[ "${{ inputs.hardware }}" == "gaudi" ]]; then
value_files="${value_files}\"${filename}\","
fi
elif [[ "$filename" == *"nv"* ]]; then
continue
else
if [[ "${{ inputs.hardware }}" == "xeon" ]]; then
value_files="${value_files}\"${filename}\","
fi
values_files=$(ls ${{ github.workspace }}/comps/"${{ inputs.service }}"/deployment/kubernetes/*values.yaml)
fi
value_files="["
for file in ${values_files}; do
if [ -f "$file" ]; then
filename=$(basename "$file")
if [[ "$filename" == *"gaudi"* ]]; then
if [[ "${{ inputs.hardware }}" == "gaudi" ]]; then
value_files="${value_files}\"${filename}\","
fi
elif [[ "$filename" == *"nv"* ]]; then
continue
else
if [[ "${{ inputs.hardware }}" == "xeon" ]]; then
value_files="${value_files}\"${filename}\","
fi
fi
done
value_files="${value_files%,}]"
fi
fi
done
value_files="${value_files%,}]"
echo "value_files=${value_files}"
echo "value_files=${value_files}" >> $GITHUB_OUTPUT
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pr-helm-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
merged_commit=$(git log -1 --format='%H')
values_files=$(git diff --name-only ${base_commit} ${merged_commit} | \
grep "kubernetes" | \
sort -u ) # comps/agent/deployment/kubernetes/cpu-values.yaml
sort -u) # comps/agent/deployment/kubernetes/cpu-values.yaml
run_matrix="{\"include\":["
for values_file in ${values_files}; do
Expand All @@ -51,8 +51,8 @@ jobs:
hardware="xeon"
fi
echo "service=${service}, hardware=${hardware}, valuefile=${valuefile}"
if [[ $(echo ${run_matrix} | grep -c "{\"service\":\"${service}\",\"hardware\":\"${hardware}\",\"valuefile\":\"${valuefile}\"},") == 0 ]]; then
run_matrix="${run_matrix}{\"service\":\"${service}\",\"hardware\":\"${hardware}\",\"valuefile\":\"${valuefile}\"},"
if [[ $(echo ${run_matrix} | grep -c "{\"service\":\"${service}\",\"hardware\":\"${hardware}\"},") == 0 ]]; then
run_matrix="${run_matrix}{\"service\":\"${service}\",\"hardware\":\"${hardware}\"},"
echo "------------------ add one values file ------------------"
fi
fi
Expand All @@ -71,6 +71,5 @@ jobs:
with:
service: ${{ matrix.service }}
hardware: ${{ matrix.hardware }}
valuefile: ${{ matrix.valuefile }}
mode: "CI"
secrets: inherit

0 comments on commit 435fa22

Please sign in to comment.