-
Notifications
You must be signed in to change notification settings - Fork 295
148 lines (126 loc) · 4.73 KB
/
e2e.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: End-to-End Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_call:
jobs:
e2e-test:
runs-on: ubuntu-20.04
timeout-minutes: 240
steps:
- name: Checkout cri-dockerd
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
path: src/github.com/Mirantis/cri-dockerd
- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: src/github.com/Mirantis/cri-dockerd/.github/.env
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Setup Go binary path
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Install docker
shell: bash
run: |
arch=$(dpkg --print-architecture)
# Workarounds for error "Failed to fetch https://packagecloud.io/github/git-lfs/ubuntu/dists/trusty/InRelease"
# TODO: remove it after the issue fixed in git-lfs.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157
sudo apt-get update
# Install prereqs
sudo apt-get install -y \
conntrack iptables iproute2 ethtool socat util-linux mount ebtables udev kmod \
libseccomp2
# Install docker.
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl socat \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=$arch] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-cache madison docker-ce
sudo apt-get install docker-ce docker-ce-cli containerd.io
# Restart docker daemon.
sudo service docker restart
- name: Build cri-dockerd
working-directory: src/github.com/Mirantis/cri-dockerd
run: |
go build
sudo mv ./cri-dockerd /usr/local/bin
- name: Start cri-dockerd
shell: bash
run: |
set -x
export LANG=C
export LC_ALL=C
# Install nsenter
docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter
# Start cri-dockerd first
logs_dir="${{ github.workspace }}/logs"
mkdir -p $logs_dir
sudo /usr/local/bin/cri-dockerd --log-level warn --network-plugin="" >$logs_dir/cri-dockerd.log 2>&1 &
# Wait a while for cri-dockerd starting.
sleep 10
- name: Check out kubernetes
uses: actions/checkout@v2
with:
repository: kubernetes/kubernetes
path: src/k8s.io/kubernetes
ref: 84c8abfb8bf900ce36f7ebfbc52794bad972d8cc
- name: Checkout test-infra for kubetest
uses: actions/checkout@v2
with:
repository: kubernetes/test-infra
path: src/k8s.io/test-infra
- name: Build kubetest
working-directory: src/k8s.io/test-infra
shell: bash
run: |
set -x
go install k8s.io/test-infra/kubetest
sudo mv $GOPATH/bin/kubetest /usr/local/bin
- name: Start up a cluster
working-directory: src/k8s.io/kubernetes
shell: bash
run: |
set -x
make all WHAT="cmd/kubectl test/e2e/e2e.test vendor/github.com/onsi/ginkgo/ginkgo"
hack/install-etcd.sh
export PATH="$(pwd)/third_party/etcd:${PATH}"
mkdir -p ${{ github.workspace }}/logs
IP=$(ip addr show dev docker0 | grep -w inet | awk '{print $2}' | cut -f1 -d/)
sudo env PATH=$PATH \
GOPATH=$GOPATH \
ENABLE_DAEMON=true \
LOG_DIR=${{ github.workspace }}/logs \
ALLOW_PRIVILEGED=true \
API_HOST_IP=$IP \
HOSTNAME_OVERRIDE=$IP \
KUBELET_HOST=$IP \
CONTAINER_RUNTIME=remote \
CONTAINER_RUNTIME_ENDPOINT="unix:///var/run/cri-dockerd.sock" \
hack/local-up-cluster.sh 2>&1 | tee ${{ github.workspace }}/logs/local-up-cluster.log
- name: Cleanup processes and containers
if: always()
shell: bash
run: |
(docker rm -f $(docker ps -a -q)) || true
(docker rmi -f $(docker images -q -a)) || true
(docker system prune --all --volumes -f) || true
(ps -ef | grep -i -e kube- -e etcd -e dockerd | grep -v grep | awk '{print $2}' | xargs sudo kill -9) || true