Skip to content

Commit 096f2bf

Browse files
authored
Merge pull request #634 from hickeyma/fix/docker-critest-win
Dockershim critest on Windows
2 parents 7d3b28a + 334447f commit 096f2bf

File tree

3 files changed

+96
-9
lines changed

3 files changed

+96
-9
lines changed

.github/workflows/dockershim.yml

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ jobs:
77
build-and-critest-dockershim:
88
strategy:
99
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]
1211
name: ${{ matrix.os }}
1312
runs-on: ${{ matrix.os }}
1413
steps:
@@ -43,31 +42,118 @@ jobs:
4342
hack/install-docker.sh
4443
working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools
4544

46-
- name: Build cri-tools
45+
- name: Build cri-tools on Linux
46+
if: startsWith(matrix.os, 'ubuntu')
4747
run: |
4848
make
4949
sudo -E PATH=$PATH make install
5050
working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools
5151

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')
5361
run: |
5462
sudo -E PATH=$PATH hack/install-cri-dockerd.sh
5563
working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools
5664

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')
5886
run: |
5987
sudo -E PATH=$PATH make install.ginkgo
6088
sudo -E PATH=$PATH hack/run-dockershim-critest.sh
6189
working-directory: ${{ github.workspace }}/src/github.com/kubernetes-sigs/cri-tools
6290

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')
64150
run: |
65151
mkdir -p ${{ github.workspace }}/logs
66152
sudo journalctl -eu docker | sudo tee ${{ github.workspace }}/logs/docker.log
67153
ls -atrl ${{ github.workspace }}/logs
68154
69-
- name: Upload logs
70-
if: always()
155+
- name: Upload docker logs from Linux
156+
if: startsWith(matrix.os, 'ubuntu')
71157
uses: actions/upload-artifact@v1
72158
with:
73159
name: logs

images/image-user/cloudbuild-images.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# See https://cloud.google.com/cloud-build/docs/build-config
2+
# Building test images for cri-tools
23

34
timeout: 1200s
45
options:

images/image-user/cloudbuild-manifests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# See https://cloud.google.com/cloud-build/docs/build-config
2-
# Building multi-arch images for non-x86 architecture
2+
# Building multi-arch test images for non-x86 architecture
33

44
timeout: 1200s
55
options:

0 commit comments

Comments
 (0)