|
| 1 | +name: "Run K8s Conformance" |
| 2 | +description: "Run the Kubernetes Conformance tests" |
| 3 | + |
| 4 | +inputs: |
| 5 | + metalk8s-short-version: |
| 6 | + description: "The MetalK8s short version to use in the PR content" |
| 7 | + required: true |
| 8 | + dest: |
| 9 | + description: "Destination directory for results + PR content" |
| 10 | + required: false |
| 11 | + default: "artifacts/conformance" |
| 12 | + |
| 13 | +runs: |
| 14 | + using: "composite" |
| 15 | + steps: |
| 16 | + - name: Create result directory |
| 17 | + shell: bash |
| 18 | + run: | |
| 19 | + result_dir="${{ inputs.dest }}/sonobuoy-results" |
| 20 | + echo "result_dir=$result_dir" >> $GITHUB_ENV |
| 21 | + mkdir -p "$result_dir" |
| 22 | + - name: Retrieve the Kubernetes version |
| 23 | + id: get-k8s-version |
| 24 | + uses: ./.github/actions/run-command-ssh |
| 25 | + with: |
| 26 | + COMMAND: | |
| 27 | + sudo rpm -q --queryformat '%{VERSION}' kubelet | cut -d'.' -f1,2 |
| 28 | + CAPTURE_RESULT: "true" |
| 29 | + - name: Get sonobuoy bin |
| 30 | + shell: bash |
| 31 | + env: |
| 32 | + SONOBUOY_VERSION: "0.56.15" |
| 33 | + run: | |
| 34 | + curl -Lo "sonobuoy.tar.gz" https://github.com/vmware-tanzu/sonobuoy/releases/download/v${SONOBUOY_VERSION}/sonobuoy_${SONOBUOY_VERSION}_linux_amd64.tar.gz |
| 35 | + tar xvf sonobuoy.tar.gz |
| 36 | + - name: Copy sonobuoy bin to Bootstrap node |
| 37 | + uses: ./.github/actions/copy-file-ssh |
| 38 | + with: |
| 39 | + SOURCE_FILE: "sonobuoy" |
| 40 | + - name: Run conformance tests from Bootstrap node |
| 41 | + uses: ./.github/actions/run-command-ssh |
| 42 | + with: |
| 43 | + COMMAND: | |
| 44 | + sudo ./sonobuoy run --kubeconfig=/etc/kubernetes/admin.conf --mode=certified-conformance --wait |
| 45 | + SSH_OPTIONS: "-o ServerAliveInterval=15" |
| 46 | + - name: Retrieve conformance tests result |
| 47 | + uses: ./.github/actions/run-command-ssh |
| 48 | + with: |
| 49 | + COMMAND: | |
| 50 | + sudo ./sonobuoy retrieve --kubeconfig=/etc/kubernetes/admin.conf --filename sonobuoy_result.tar.gz |
| 51 | + - name: Retrieve conformance tests result from Bootstrap node |
| 52 | + uses: ./.github/actions/copy-file-ssh |
| 53 | + with: |
| 54 | + NODE_TO: "" |
| 55 | + NODE_FROM: "bootstrap" |
| 56 | + SOURCE_FILE: "sonobuoy_result.tar.gz" |
| 57 | + DESTINATION_FILE: "${{ env.result_dir }}/" |
| 58 | + - name: Extract conformance tests result |
| 59 | + shell: bash |
| 60 | + working-directory: ${{ env.result_dir }} |
| 61 | + run: tar xvf sonobuoy_result.tar.gz |
| 62 | + - name: Check conformance tests result |
| 63 | + shell: bash |
| 64 | + run: | |
| 65 | + failed_tests=$(./sonobuoy results "$result_dir/sonobuoy_result.tar.gz" --mode=detailed --plugin=e2e | jq 'select(.status=="failed")') |
| 66 | + [ -n "$failed_tests" ] && echo $failed_tests && exit 1 || exit 0 |
| 67 | + - name: Prepare conformance PR content |
| 68 | + shell: bash |
| 69 | + env: |
| 70 | + DIRECTORY: "${{ inputs.dest }}/pr-content" |
| 71 | + SONOBUOY_RES_DIR: "${{ env.result_dir }}" |
| 72 | + K8S_VERSION: "${{ steps.get-k8s-version.outputs.RESULT }}" |
| 73 | + METALK8S_VERSION: "${{ inputs.metalk8s-short-version }}" |
| 74 | + run: | |
| 75 | + .github/scripts/build-conformance-pr-content.sh |
| 76 | + tar cvf "${{ inputs.dest }}/pr-content.tar.gz" -C "$DIRECTORY" "v$K8S_VERSION" |
| 77 | +
|
0 commit comments