From 43a50200fa3bc5680fa70deb57f1f84b4090ab74 Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Thu, 3 Apr 2025 17:36:09 +0800 Subject: [PATCH 1/6] WIP Signed-off-by: ZePan110 --- .github/workflows/_comps-workflow.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/_comps-workflow.yml b/.github/workflows/_comps-workflow.yml index f4efdd2a1e..71dc5cd6c9 100644 --- a/.github/workflows/_comps-workflow.yml +++ b/.github/workflows/_comps-workflow.yml @@ -43,7 +43,6 @@ jobs: # Image Build #################################################################################################### build-images: - if: ${{ !(fromJSON(inputs.test_helmchart)) }} runs-on: "docker-build-gaudi" continue-on-error: true outputs: @@ -110,7 +109,6 @@ jobs: # Docker Compose Test #################################################################################################### test-service-compose: - needs: [build-images] if: ${{ fromJSON(inputs.test_compose) }} uses: ./.github/workflows/_run-docker-compose.yml with: From 85165eb14e15e1279219651c1caea94dabe7a20a Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Thu, 3 Apr 2025 18:04:43 +0800 Subject: [PATCH 2/6] Add build node options. Signed-off-by: ZePan110 --- .github/workflows/_comps-workflow.yml | 5 ++++- .github/workflows/_run-helm-chart.yml | 7 ++++--- .github/workflows/manual-comps-test.yml | 11 +++++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_comps-workflow.yml b/.github/workflows/_comps-workflow.yml index 71dc5cd6c9..866e606e23 100644 --- a/.github/workflows/_comps-workflow.yml +++ b/.github/workflows/_comps-workflow.yml @@ -9,6 +9,9 @@ on: service: required: true type: string + node: + required: true + type: string tag: default: "comps" required: false @@ -43,7 +46,7 @@ jobs: # Image Build #################################################################################################### build-images: - runs-on: "docker-build-gaudi" + runs-on: "docker-build-${{ inputs.node }}" continue-on-error: true outputs: file_exists: ${{ steps.get-yaml-path.outputs.file_exists }} diff --git a/.github/workflows/_run-helm-chart.yml b/.github/workflows/_run-helm-chart.yml index 5523494f4d..abed64dbc6 100644 --- a/.github/workflows/_run-helm-chart.yml +++ b/.github/workflows/_run-helm-chart.yml @@ -58,7 +58,9 @@ jobs: id: get-test-files run: | set -x - if [ "${{ inputs.mode }}" = "CI" ]; then + if [ "${{ github.ref_name }}" == "main" ]; then + values_files=$(ls ${{ github.workspace }}/comps/${{ inputs.service }}/deployment/kubernetes/*values.yaml) + else 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} | \ @@ -66,9 +68,8 @@ jobs: grep "${{ inputs.service }}" | \ sort -u ) echo $values_files - elif [ "${{ inputs.mode }}" = "CD" ]; then - values_files=$(ls ${{ github.workspace }}/comps/${{ inputs.service }}/deployment/kubernetes/*values.yaml) fi + run_matrix="[" run_matrix="{\"include\":[" for file in ${values_files}; do diff --git a/.github/workflows/manual-comps-test.yml b/.github/workflows/manual-comps-test.yml index bedadb9181..c8da7a8817 100644 --- a/.github/workflows/manual-comps-test.yml +++ b/.github/workflows/manual-comps-test.yml @@ -15,6 +15,11 @@ on: description: "Build test required images for Comps" required: false type: boolean + build-node: + default: "gaudi,xeon" + description: "Build test required images for Comps on gaudi,xeon" + required: true + type: string test_compose: default: true description: "Test comps with docker compose" @@ -48,6 +53,7 @@ jobs: runs-on: ubuntu-latest outputs: services: ${{ steps.get-matrix.outputs.services }} + nodes: ${{ steps.get-matrix.outputs.nodes }} steps: - name: Create Matrix id: get-matrix @@ -55,16 +61,21 @@ jobs: services=($(echo ${{ inputs.services }} | tr ',' ' ')) services_json=$(printf '%s\n' "${services[@]}" | sort -u | jq -R '.' | jq -sc '.') echo "services=$services_json" >> $GITHUB_OUTPUT + nodes=($(echo ${{ inputs.build-node }} | tr ',' ' ')) + nodes_json=$(printf '%s\n' "${nodes[@]}" | sort -u | jq -R '.' | jq -sc '.') + echo "nodes=$nodes_json" >> $GITHUB_OUTPUT run-services: needs: [get-test-matrix] strategy: matrix: service: ${{ fromJson(needs.get-test-matrix.outputs.services) }} + node: ${{ fromJson(needs.get-test-matrix.outputs.nodes) }} fail-fast: false uses: ./.github/workflows/_comps-workflow.yml with: service: ${{ matrix.service }} + node: ${{ matrix.node }} tag: ${{ inputs.tag }} mode: ${{ inputs.mode }} test_compose: ${{ inputs.test_compose }} From ed6d36bfa41e14244b1432932a3eb35a8a2ba75e Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Thu, 3 Apr 2025 19:19:17 +0800 Subject: [PATCH 3/6] Fix issue Signed-off-by: ZePan110 --- .github/workflows/_run-helm-chart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_run-helm-chart.yml b/.github/workflows/_run-helm-chart.yml index abed64dbc6..98991c3514 100644 --- a/.github/workflows/_run-helm-chart.yml +++ b/.github/workflows/_run-helm-chart.yml @@ -98,9 +98,9 @@ jobs: helm-test: needs: [get-test-case] + if: ${{ needs.get-test-case.outputs.run_matrix != '[]' }} strategy: matrix: ${{ fromJSON(needs.get-test-case.outputs.run_matrix) }} - if: ${{ needs.get-test-case.outputs.run_matrix != '[]' }} runs-on: k8s-${{ matrix.hardware }} continue-on-error: true steps: From 9726dba25da66baa91c65eccac296ec0525d4238 Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Thu, 3 Apr 2025 19:26:48 +0800 Subject: [PATCH 4/6] Change output check Signed-off-by: ZePan110 --- .github/workflows/_run-helm-chart.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_run-helm-chart.yml b/.github/workflows/_run-helm-chart.yml index 98991c3514..85dc412b2a 100644 --- a/.github/workflows/_run-helm-chart.yml +++ b/.github/workflows/_run-helm-chart.yml @@ -98,7 +98,8 @@ jobs: helm-test: needs: [get-test-case] - if: ${{ needs.get-test-case.outputs.run_matrix != '[]' }} + # if: ${{ needs.get-test-case.outputs.run_matrix != '[]' }} + if: ${{ fromJson(needs.get-test-case.outputs.run_matrix).include[0] }} strategy: matrix: ${{ fromJSON(needs.get-test-case.outputs.run_matrix) }} runs-on: k8s-${{ matrix.hardware }} From 9c6342f5f61b5a3c14331c202665dc232f57a08f Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Thu, 10 Apr 2025 23:46:44 +0800 Subject: [PATCH 5/6] Fix comments Signed-off-by: ZePan110 --- .github/workflows/_comps-workflow.yml | 7 +++++-- .github/workflows/_run-helm-chart.yml | 5 ----- .github/workflows/manual-comps-test.yml | 13 ++++++------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/_comps-workflow.yml b/.github/workflows/_comps-workflow.yml index 866e606e23..e963931b41 100644 --- a/.github/workflows/_comps-workflow.yml +++ b/.github/workflows/_comps-workflow.yml @@ -9,7 +9,7 @@ on: service: required: true type: string - node: + image_build_nodes: required: true type: string tag: @@ -46,7 +46,10 @@ jobs: # Image Build #################################################################################################### build-images: - runs-on: "docker-build-${{ inputs.node }}" + strategy: + matrix: + image_build_node: ${{ fromJson(inputs.image_build_nodes) }} + runs-on: "docker-build-${{ matrix.image_build_node }}" continue-on-error: true outputs: file_exists: ${{ steps.get-yaml-path.outputs.file_exists }} diff --git a/.github/workflows/_run-helm-chart.yml b/.github/workflows/_run-helm-chart.yml index 85dc412b2a..d626f4bb14 100644 --- a/.github/workflows/_run-helm-chart.yml +++ b/.github/workflows/_run-helm-chart.yml @@ -20,11 +20,6 @@ on: default: "latest" required: false type: string - mode: - default: "CD" - description: "Whether the test range is CI, CD or CICD" - required: false - type: string version: default: "0-latest" required: false diff --git a/.github/workflows/manual-comps-test.yml b/.github/workflows/manual-comps-test.yml index c8da7a8817..8a69259169 100644 --- a/.github/workflows/manual-comps-test.yml +++ b/.github/workflows/manual-comps-test.yml @@ -15,7 +15,7 @@ on: description: "Build test required images for Comps" required: false type: boolean - build-node: + image_build_nodes: default: "gaudi,xeon" description: "Build test required images for Comps on gaudi,xeon" required: true @@ -53,7 +53,7 @@ jobs: runs-on: ubuntu-latest outputs: services: ${{ steps.get-matrix.outputs.services }} - nodes: ${{ steps.get-matrix.outputs.nodes }} + image_build_nodes: ${{ steps.get-matrix.outputs.image_build_nodes }} steps: - name: Create Matrix id: get-matrix @@ -61,21 +61,20 @@ jobs: services=($(echo ${{ inputs.services }} | tr ',' ' ')) services_json=$(printf '%s\n' "${services[@]}" | sort -u | jq -R '.' | jq -sc '.') echo "services=$services_json" >> $GITHUB_OUTPUT - nodes=($(echo ${{ inputs.build-node }} | tr ',' ' ')) - nodes_json=$(printf '%s\n' "${nodes[@]}" | sort -u | jq -R '.' | jq -sc '.') - echo "nodes=$nodes_json" >> $GITHUB_OUTPUT + image_build_nodes=($(echo ${{ inputs.image_build_nodes }} | tr ',' ' ')) + image_build_nodes_json=$(printf '%s\n' "${image_build_nodes[@]}" | sort -u | jq -R '.' | jq -sc '.') + echo "image_build_nodes=$image_build_nodes_json" >> $GITHUB_OUTPUT run-services: needs: [get-test-matrix] strategy: matrix: service: ${{ fromJson(needs.get-test-matrix.outputs.services) }} - node: ${{ fromJson(needs.get-test-matrix.outputs.nodes) }} fail-fast: false uses: ./.github/workflows/_comps-workflow.yml with: service: ${{ matrix.service }} - node: ${{ matrix.node }} + image_build_nodes: ${{ needs.get-test-matrix.outputs.image_build_nodes }} tag: ${{ inputs.tag }} mode: ${{ inputs.mode }} test_compose: ${{ inputs.test_compose }} From 7555bb14d2d6a3099141102441ca23b55a9e6b67 Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Thu, 10 Apr 2025 23:51:56 +0800 Subject: [PATCH 6/6] Fix issue Signed-off-by: ZePan110 --- .github/workflows/_comps-workflow.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/_comps-workflow.yml b/.github/workflows/_comps-workflow.yml index 3e7d572c9a..eb89342917 100644 --- a/.github/workflows/_comps-workflow.yml +++ b/.github/workflows/_comps-workflow.yml @@ -131,6 +131,5 @@ jobs: uses: ./.github/workflows/_run-helm-chart.yml with: tag: ${{ inputs.tag }} - mode: ${{ inputs.mode }} service: ${{ inputs.service }} secrets: inherit