diff --git a/.github/workflows/_comps-workflow.yml b/.github/workflows/_comps-workflow.yml index 24d911b5df..eb89342917 100644 --- a/.github/workflows/_comps-workflow.yml +++ b/.github/workflows/_comps-workflow.yml @@ -9,6 +9,9 @@ on: service: required: true type: string + image_build_nodes: + required: true + type: string tag: default: "comps" required: false @@ -43,8 +46,10 @@ jobs: # Image Build #################################################################################################### build-images: - if: ${{ !(fromJSON(inputs.test_helmchart)) }} - runs-on: "docker-build-gaudi" + 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 }} @@ -110,7 +115,6 @@ jobs: # Docker Compose Test #################################################################################################### test-service-compose: - needs: [build-images] if: ${{ fromJSON(inputs.test_compose) }} uses: ./.github/workflows/_run-docker-compose.yml with: @@ -127,6 +131,5 @@ jobs: uses: ./.github/workflows/_run-helm-chart.yml with: tag: ${{ inputs.tag }} - mode: ${{ inputs.mode }} service: ${{ inputs.service }} secrets: inherit diff --git a/.github/workflows/_run-helm-chart.yml b/.github/workflows/_run-helm-chart.yml index 5523494f4d..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 @@ -58,7 +53,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 +63,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 @@ -97,9 +93,10 @@ jobs: helm-test: needs: [get-test-case] + # 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) }} - if: ${{ needs.get-test-case.outputs.run_matrix != '[]' }} runs-on: k8s-${{ matrix.hardware }} continue-on-error: true steps: diff --git a/.github/workflows/manual-comps-test.yml b/.github/workflows/manual-comps-test.yml index bedadb9181..8a69259169 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 + image_build_nodes: + 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 }} + image_build_nodes: ${{ steps.get-matrix.outputs.image_build_nodes }} steps: - name: Create Matrix id: get-matrix @@ -55,6 +61,9 @@ jobs: services=($(echo ${{ inputs.services }} | tr ',' ' ')) services_json=$(printf '%s\n' "${services[@]}" | sort -u | jq -R '.' | jq -sc '.') echo "services=$services_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] @@ -65,6 +74,7 @@ jobs: uses: ./.github/workflows/_comps-workflow.yml with: service: ${{ matrix.service }} + image_build_nodes: ${{ needs.get-test-matrix.outputs.image_build_nodes }} tag: ${{ inputs.tag }} mode: ${{ inputs.mode }} test_compose: ${{ inputs.test_compose }}