|
7 | 7 | build-and-critest-dockershim: |
8 | 8 | strategy: |
9 | 9 | matrix: |
10 | | - os: [ubuntu-18.04] # TODO: Need to add windows-2019 |
11 | | - # It was also disabled in travis ci |
| 10 | + os: [ubuntu-18.04, windows-2019] |
12 | 11 | name: ${{ matrix.os }} |
13 | 12 | runs-on: ${{ matrix.os }} |
14 | 13 | steps: |
@@ -43,31 +42,118 @@ jobs: |
43 | 42 | hack/install-docker.sh |
44 | 43 | working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools |
45 | 44 |
|
46 | | - - name: Build cri-tools |
| 45 | + - name: Build cri-tools on Linux |
| 46 | + if: startsWith(matrix.os, 'ubuntu') |
47 | 47 | run: | |
48 | 48 | make |
49 | 49 | sudo -E PATH=$PATH make install |
50 | 50 | working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools |
51 | 51 |
|
52 | | - - name: Build cri-dockerd |
| 52 | + - name: Build cri-tools on Windows |
| 53 | + if: startsWith(matrix.os, 'windows') |
| 54 | + run: | |
| 55 | + make |
| 56 | + make install |
| 57 | + working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools |
| 58 | + |
| 59 | + - name: Build cri-dockerd on Linux |
| 60 | + if: startsWith(matrix.os, 'ubuntu') |
53 | 61 | run: | |
54 | 62 | sudo -E PATH=$PATH hack/install-cri-dockerd.sh |
55 | 63 | working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools |
56 | 64 |
|
57 | | - - name: Run critest |
| 65 | + - name: Build cri-dockerd on Windows |
| 66 | + if: startsWith(matrix.os, 'windows') |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + set -o errexit |
| 70 | + set -o nounset |
| 71 | + set -o pipefail |
| 72 | +
|
| 73 | + # TODO: This should change when a permanent repo is available. |
| 74 | + git clone https://github.com/dims/cri-dockerd $GOPATH/src/github.com/dims/cri-dockerd |
| 75 | + cd $GOPATH/src/github.com/dims/cri-dockerd |
| 76 | +
|
| 77 | + # Need the flag for errors building on Windows |
| 78 | + # Ref: https://github.com/golang/go/issues/30674 |
| 79 | + # https://github.com/golang/go/issues/40795 |
| 80 | + go install -buildmode=exe . |
| 81 | + mv $GOPATH/bin/cri-dockerd.exe /usr/local/bin |
| 82 | + working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools |
| 83 | + |
| 84 | + - name: Run critest on Linux |
| 85 | + if: startsWith(matrix.os, 'ubuntu') |
58 | 86 | run: | |
59 | 87 | sudo -E PATH=$PATH make install.ginkgo |
60 | 88 | sudo -E PATH=$PATH hack/run-dockershim-critest.sh |
61 | 89 | working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools |
62 | 90 |
|
63 | | - - name: Dump docker logs |
| 91 | + - name: Run critest on Windows |
| 92 | + if: startsWith(matrix.os, 'windows') |
| 93 | + shell: bash |
| 94 | + run: | |
| 95 | + set -o errexit |
| 96 | + set -o nounset |
| 97 | + set -o pipefail |
| 98 | + set -x |
| 99 | +
|
| 100 | + export LANG=C |
| 101 | + export LC_ALL=C |
| 102 | + FOCUS="${FOCUS:-"Conformance"}" |
| 103 | + REPORT_DIR="${REPORT_DIR:-"c/_artifacts"}" |
| 104 | + mkdir -p "${REPORT_DIR}" |
| 105 | +
|
| 106 | + # TODO: Skipping these tests because there are no manifests for windows/amd64 |
| 107 | + SKIP="runtime should support execSync|runtime should support portforward|runtime should support starting container with log|runtime should support execSync with timeout|runtime should support removing running container|runtime should support port mapping with only container port|runtime should support creating container|runtime should support starting container with volume|runtime should support exec with tty=true and stdin=true|runtime should support set hostname|runtime should support removing stopped container|runtime should support removing created container|runtime should support running PodSandbox|runtime should support port mapping with host port and container port|runtime should support exec with tty=false and stdin=false|runtime should support DNS config|runtime should support attach|runtime should support listing container stats|runtime should support reopening container log|runtime should support stopping container|runtime should support starting container with volume when host path is a symlink|runtime should support removing PodSandbox|runtime should support stopping PodSandbox|runtime should support starting container" |
| 108 | +
|
| 109 | + # Start dockershim first |
| 110 | + /usr/local/bin/cri-dockerd --v=10 --network-plugin="" --logtostderr &> "${REPORT_DIR}/dockerd-cri.log" & |
| 111 | + pid=$! |
| 112 | +
|
| 113 | + # Wait a while for dockershim starting. |
| 114 | + sleep 10 |
| 115 | +
|
| 116 | + # Run cri test cases |
| 117 | + /usr/local/bin/critest --ginkgo.focus="${FOCUS}" --ginkgo.skip="${SKIP}" --report-dir="${REPORT_DIR}" --report-prefix="windows" |
| 118 | + ls ${REPORT_DIR} |
| 119 | + TEST_RC1=$? |
| 120 | + test $TEST_RC1 -ne 0 && cat ${REPORT_DIR}/dockerd-cri.log |
| 121 | +
|
| 122 | + # TODO: Disabled as there are no manifests for windows/amd64 |
| 123 | + # Run benchmark test cases |
| 124 | + # /usr/local/bin/critest -benchmark |
| 125 | + # TEST_RC2=$? |
| 126 | + # test $TEST_RC2 -ne 0 && cat ${REPORT_DIR}/dockerd-cri.log |
| 127 | +
|
| 128 | + set -o errexit |
| 129 | + kill -9 $pid |
| 130 | + echo "DOCKER_CRI_DIR=$REPORT_DIR" >> $GITHUB_ENV |
| 131 | +
|
| 132 | + exit ${TEST_RC1} |
| 133 | +
|
| 134 | + - name: Upload docker logs from Windows |
| 135 | + if: startsWith(matrix.os, 'windows') |
| 136 | + uses: actions/upload-artifact@v1 |
| 137 | + with: |
| 138 | + name: dockerd-${{ matrix.os }}-${{github.sha}}.log |
| 139 | + path: ${{env.DOCKER_CRI_DIR}}/dockerd-cri.log |
| 140 | + |
| 141 | + - name: Cleanup temp directory on Windows |
| 142 | + if: startsWith(matrix.os, 'windows') |
| 143 | + shell: bash |
| 144 | + run: | |
| 145 | + echo "Cleanup temp directory ${{env.DOCKER_CRI_DIR}} created for cri tests" |
| 146 | + rm -rf ${{env.DOCKER_CRI_DIR}} |
| 147 | +
|
| 148 | + - name: Dump docker logs from Linux |
| 149 | + if: startsWith(matrix.os, 'ubuntu') |
64 | 150 | run: | |
65 | 151 | mkdir -p ${{ github.workspace }}/logs |
66 | 152 | sudo journalctl -eu docker | sudo tee ${{ github.workspace }}/logs/docker.log |
67 | 153 | ls -atrl ${{ github.workspace }}/logs |
68 | 154 |
|
69 | | - - name: Upload logs |
70 | | - if: always() |
| 155 | + - name: Upload docker logs from Linux |
| 156 | + if: startsWith(matrix.os, 'ubuntu') |
71 | 157 | uses: actions/upload-artifact@v1 |
72 | 158 | with: |
73 | 159 | name: logs |
|
0 commit comments