Skip to content

Commit ac6618d

Browse files
authored
Merge pull request #22006 from medyagh/prowkvm_containerd
ci: add kvm containerd to prow test
2 parents 8650e01 + a71cfce commit ac6618d

File tree

7 files changed

+114
-4
lines changed

7 files changed

+114
-4
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Copyright 2025 The Kubernetes Authors All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -e
18+
set -x
19+
20+
OS="linux"
21+
ARCH="amd64"
22+
DRIVER="kvm2"
23+
CONTAINER_RUNTIME="containerd"
24+
# in prow, if you want libvirtd to be run, you have to start a privileged container as root
25+
EXTRA_START_ARGS=""
26+
EXTRA_TEST_ARGS=""
27+
JOB_NAME="KVM_Containerd_Linux_X86-64"
28+
# marking all directories ('*') as trusted, since .git belongs to root, not minikube user
29+
git config --global --add safe.directory '*'
30+
COMMIT=$(git rev-parse HEAD)
31+
MINIKUBE_LOCATION=$COMMIT
32+
echo "running test in $(pwd)"
33+
34+
set +e
35+
sleep 5 # wait for libvirtd to be running
36+
echo "=========libvirtd status=========="
37+
sudo systemctl status libvirtd
38+
echo "=========Check virtualization support=========="
39+
grep -E -q 'vmx|svm' /proc/cpuinfo && echo yes || echo no
40+
echo "=========virt-host-validate=========="
41+
virt-host-validate
42+
43+
set -e
44+
source ./hack/prow/common.sh
File renamed without changes.

hack/prow/minitest/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ var deployers = map[string]func(string) deployer.MiniTestDeployer{
3434
"docker": deployer.NewMiniTestDockerDeployerFromConfigFile,
3535
}
3636
var testers = map[string]tester.MiniTestTester{
37-
"kvm-docker-linux-amd64-integration": &tester.KVMDockerLinuxAmd64IntegrationTester{},
38-
"none-docker-linux-amd64-integration": &tester.NoneDockerLinuxAmd64IntegrationTester{},
37+
"kvm-docker-linux-amd64-integration": &tester.KVMDockerLinuxAmd64IntegrationTester{},
38+
"kvm-containerd-linux-amd64-integration": &tester.KVMContainerdLinuxAmd64IntegrationTester{},
39+
"none-docker-linux-amd64-integration": &tester.NoneDockerLinuxAmd64IntegrationTester{},
3940
}
4041

4142
func main() {
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package tester
18+
19+
import (
20+
"fmt"
21+
"os"
22+
23+
"k8s.io/klog/v2"
24+
)
25+
26+
var _ MiniTestTester = &KVMDockerLinuxAmd64IntegrationTester{}
27+
28+
// this runs the integration tests with kvm2 driver and a docker container runtime.
29+
type KVMContainerdLinuxAmd64IntegrationTester struct {
30+
}
31+
32+
// Run implements MiniTestTester.
33+
func (k *KVMContainerdLinuxAmd64IntegrationTester) Run(runner MiniTestRunner) error {
34+
35+
if up, err := runner.IsUp(); err != nil || !up {
36+
klog.Errorf("tester: deployed environment is not up: %v", err)
37+
}
38+
if err := runner.SyncToRemote(".", "~/minikube", []string{".cache"}); err != nil {
39+
klog.Errorf("failed to sync file in docker deployer: %v", err)
40+
}
41+
pr := os.Getenv("PULL_NUMBER")
42+
43+
var testErr error
44+
// install docker and libvirtd first then run the test in a new shell
45+
if err := runner.Execute("cd minikube && ./hack/prow/integration_pre_install.sh"); err != nil {
46+
klog.Errorf("failed to install docker in env: %v", err)
47+
return err
48+
}
49+
if testErr = runner.Execute(fmt.Sprintf("cd minikube && PULL_NUMBER=\"%s\" ./hack/prow/integration_kvm_containerd_linux_x86-64.sh", pr)); testErr != nil {
50+
klog.Errorf("failed to execute command in env: %v", testErr)
51+
// don't return here, we still want to collect the test reports
52+
}
53+
54+
// prow requires result file to be copied to $ARTIFACTS. All other files will not be persisted.
55+
if err := copyFileToArtifact(runner); err != nil {
56+
return err
57+
}
58+
return testErr
59+
60+
}

hack/prow/minitest/tester/kvm_docker_linux_amd64_integration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (k *KVMDockerLinuxAmd64IntegrationTester) Run(runner MiniTestRunner) error
4242

4343
var testErr error
4444
// install docker and libvirtd first then run the test in a new shell
45-
if err := runner.Execute("cd minikube && ./hack/prow/integration_kvm_docker_linux_x86-64_pre.sh"); err != nil {
45+
if err := runner.Execute("cd minikube && ./hack/prow/integration_pre_install.sh"); err != nil {
4646
klog.Errorf("failed to install docker in env: %v", err)
4747
return err
4848
}

hack/prow/minitest/tester/none_docker_linux_amd64_integration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (k *NoneDockerLinuxAmd64IntegrationTester) Run(runner MiniTestRunner) error
4242

4343
var testErr error
4444
// install docker and libvirtd first then run the test in a new shell
45-
if err := runner.Execute("cd minikube && ./hack/prow/integration_kvm_docker_linux_x86-64_pre.sh"); err != nil {
45+
if err := runner.Execute("cd minikube && ./hack/prow/integration_pre_install.sh"); err != nil {
4646
klog.Errorf("failed to install docker in env: %v", err)
4747
return err
4848
}

hack/prow/prow.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ integration-prow-kvm-docker-linux-x86-64: setup-prow-gcp-ssh-keys build-mini-tes
1919
./hack/prow/minikube_cross_build.sh $(GO_VERSION) linux amd64
2020
./out/minitest --deployer boskos --tester kvm-docker-linux-amd64-integration --config hack/prow/bosksos-nested.json
2121

22+
.PHONY: integration-prow-kvm-containerd-linux-x86-64
23+
integration-prow-kvm-containerd-linux-x86-64: setup-prow-gcp-ssh-keys build-mini-test
24+
./hack/prow/minikube_cross_build.sh $(GO_VERSION) linux amd64
25+
./out/minitest --deployer boskos --tester kvm-containerd-linux-amd64-integration --config hack/prow/bosksos-nested.json
26+
2227
.PHONY: build-mini-test
2328
build-mini-test: # build minitest binary
2429
GOTOOLCHAIN=auto go build -C ./hack/prow/minitest -o $(PWD)/out/minitest .

0 commit comments

Comments
 (0)