Skip to content

Commit

Permalink
CI: add functional_docker_rootless_containerd_ubuntu
Browse files Browse the repository at this point in the history
Fix issue 12456

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Dec 2, 2022
1 parent 6fcb8d8 commit 7e77cc2
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 2 deletions.
119 changes: 119 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,125 @@ jobs:
if [ "$numPass" -lt 36 ];then echo "*** Failed to pass at least 36 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
functional_docker_rootless_containerd_ubuntu:
permissions:
contents: none
needs: [build_minikube]
env:
TIME_ELAPSED: time
JOB_NAME: "functional_docker_rootless_containerd_ubuntu"
GOPOGH_RESULT: ""
SHELL: "/bin/bash" # To prevent https://github.com/kubernetes/minikube/issues/6643
DEBIAN_FRONTEND: noninteractive
# ubuntu-22.04 is needed for cgroup v2
runs-on: ubuntu-22.04
steps:
- name: Install kubectl
shell: bash
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install kubectl /usr/local/bin/kubectl
kubectl version --client=true
# https://rootlesscontaine.rs/getting-started/common/cgroup2/
- name: Set up cgroup v2 delegation
run: |
sudo mkdir -p /etc/systemd/system/user@.service.d
cat <<EOF | sudo tee /etc/systemd/system/user@.service.d/delegate.conf
[Service]
Delegate=cpu cpuset io memory pids
EOF
sudo systemctl daemon-reload
- name: Set up Rootless Docker
run: |
sudo apt-get remove moby-engine-*
curl https://get.docker.com | sudo sh
dockerd-rootless-setuptool.sh install -f
docker context use rootless
- name: Docker Info
shell: bash
run: |
echo "--------------------------"
docker version || true
echo "--------------------------"
docker info || true
echo "--------------------------"
docker system df || true
echo "--------------------------"
docker system info --format='{{json .}}'|| true
echo "--------------------------"
docker ps || true
echo "--------------------------"
- uses: actions/setup-go@d0a58c1c4d2b25278816e339b944508c875f3613
with:
go-version: ${{env.GO_VERSION}}
- name: Install gopogh

shell: bash
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.13.0/gopogh-linux-amd64
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
- name: Download Binaries
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7
with:
name: minikube_binaries
path: minikube_binaries
- name: Run Integration Test
continue-on-error: false
# bash {0} to allow test to continue to next step. in case of
shell: bash {0}
run: |
cd minikube_binaries
mkdir -p report
mkdir -p testhome
chmod a+x e2e-*
chmod a+x minikube-*
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
MINIKUBE_HOME=$(pwd)/testhome ./minikube-linux-amd64 delete --all --purge
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args="--vm-driver=docker --rootless --container-runtime=containerd" -test.run TestFunctional -test.timeout=30m -test.v -timeout-multiplier=1.5 -binary=./minikube-linux-amd64 2>&1 | tee ./report/testout.txt
END_TIME=$(date -u +%s)
TIME_ELAPSED=$(($END_TIME-$START_TIME))
min=$((${TIME_ELAPSED}/60))
sec=$((${TIME_ELAPSED}%60))
TIME_ELAPSED="${min} min $sec seconds "
echo "TIME_ELAPSED=${TIME_ELAPSED}" >> $GITHUB_ENV
- name: Generate HTML Report
shell: bash
run: |
cd minikube_binaries
export PATH=${PATH}:`go env GOPATH`/bin
go tool test2json -t < ./report/testout.txt > ./report/testout.json || true
STAT=$(gopogh -in ./report/testout.json -out_html ./report/testout.html -out_summary ./report/testout_summary.json -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
echo status: ${STAT}
FailNum=$(echo $STAT | jq '.NumberOfFail')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
echo "GOPOGH_RESULT=${GOPOGH_RESULT}" >> $GITHUB_ENV
echo 'STAT<<EOF' >> $GITHUB_ENV
echo "${STAT}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb
with:
name: functional_docker_rootless_containerd_ubuntu
path: minikube_binaries/report
- name: The End Result functional_docker_rootless_containerd_ubuntu
shell: bash
run: |
echo ${GOPOGH_RESULT}
numFail=$(echo $STAT | jq '.NumberOfFail')
numPass=$(echo $STAT | jq '.NumberOfPass')
echo "*******************${numPass} Passes :) *******************"
echo $STAT | jq '.PassedTests' || true
echo "*******************************************************"
echo "---------------- ${numFail} Failures :( ----------------------------"
echo $STAT | jq '.FailedTests' || true
echo "-------------------------------------------------------"
if [ "$numFail" -gt 0 ];then echo "*** $numFail Failed ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
if [ "$numPass" -lt 36 ];then echo "*** Failed to pass at least 36 ! ***";exit 2;fi
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
functional_podman_ubuntu:
permissions:
contents: none
Expand Down
3 changes: 3 additions & 0 deletions test/integration/functional_test_mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) { // no
if HyperVDriver() {
t.Skip("skipping: mount broken on hyperv: https://github.com/kubernetes/minikube/issues/5029")
}
if RootlessDriver() {
t.Skip("skipping: rootless driver does not support mount (because 9p is not mountable inside UserNS)")
}

if runtime.GOOS == "windows" {
t.Skip("skipping: mount broken on windows: https://github.com/kubernetes/minikube/issues/8303")
Expand Down
9 changes: 7 additions & 2 deletions test/integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func PodmanDriver() bool {
return strings.Contains(*startArgs, "--driver=podman") || strings.Contains(*startArgs, "--vm-driver=podman")
}

// Rootless returns whether or not this test is using the rootless KIC driver
func RootlessDriver() bool {
return strings.Contains(*startArgs, "--rootless")
}

// KicDriver returns whether or not this test is using the docker or podman driver
func KicDriver() bool {
return DockerDriver() || PodmanDriver()
Expand All @@ -171,9 +176,9 @@ func arm64Platform() bool {
}

// NeedsPortForward returns access to endpoints with this driver needs port forwarding
// (Docker on non-Linux platforms requires ports to be forwarded to 127.0.0.1)
// (Docker on non-Linux platforms and rootless KIC requires ports to be forwarded to 127.0.0.1)
func NeedsPortForward() bool {
return KicDriver() && (runtime.GOOS == "windows" || runtime.GOOS == "darwin") || detect.IsMicrosoftWSL()
return KicDriver() && (runtime.GOOS == "windows" || runtime.GOOS == "darwin") || detect.IsMicrosoftWSL() || RootlessDriver()
}

// CanCleanup returns if cleanup is allowed
Expand Down

0 comments on commit 7e77cc2

Please sign in to comment.