Add integration test target and docs #265
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: End-to-End Tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
e2e-test: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 240 | |
steps: | |
- name: Set up Go 1.19.10 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.19.10 | |
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: Checkout cri-dockerd | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{ github.repository }} | |
path: src/github.com/Mirantis/cri-dockerd | |
- 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 |