mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-20 10:20:39 +00:00
Merge pull request #7913 from fidencio/topic/add-functional-docker-tests
ci: Add a very basic docker sanity test
This commit is contained in:
commit
b020912629
8
.github/workflows/ci.yaml
vendored
8
.github/workflows/ci.yaml
vendored
@ -73,6 +73,14 @@ jobs:
|
|||||||
platforms: linux/amd64, linux/s390x
|
platforms: linux/amd64, linux/s390x
|
||||||
file: tests/integration/kubernetes/runtimeclass_workloads/confidential/unencrypted/Dockerfile
|
file: tests/integration/kubernetes/runtimeclass_workloads/confidential/unencrypted/Dockerfile
|
||||||
|
|
||||||
|
run-docker-tests-on-garm:
|
||||||
|
needs: publish-kata-deploy-payload-amd64
|
||||||
|
uses: ./.github/workflows/run-docker-tests-on-garm.yaml
|
||||||
|
with:
|
||||||
|
tarball-suffix: -${{ inputs.tag }}
|
||||||
|
commit-hash: ${{ inputs.commit-hash }}
|
||||||
|
target-branch: ${{ inputs.target-branch }}
|
||||||
|
|
||||||
run-kata-deploy-tests-on-aks:
|
run-kata-deploy-tests-on-aks:
|
||||||
needs: publish-kata-deploy-payload-amd64
|
needs: publish-kata-deploy-payload-amd64
|
||||||
uses: ./.github/workflows/run-kata-deploy-tests-on-aks.yaml
|
uses: ./.github/workflows/run-kata-deploy-tests-on-aks.yaml
|
||||||
|
56
.github/workflows/run-docker-tests-on-garm.yaml
vendored
Normal file
56
.github/workflows/run-docker-tests-on-garm.yaml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: CI | Run docker integration tests
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
tarball-suffix:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
commit-hash:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
target-branch:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-docker-tests:
|
||||||
|
strategy:
|
||||||
|
# We can set this to true whenever we're 100% sure that
|
||||||
|
# all the tests are not flaky, otherwise we'll fail them
|
||||||
|
# all due to a single flaky instance.
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
vmm:
|
||||||
|
- clh
|
||||||
|
- qemu
|
||||||
|
runs-on: garm-ubuntu-2304
|
||||||
|
env:
|
||||||
|
KATA_HYPERVISOR: ${{ matrix.vmm }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ inputs.commit-hash }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Rebase atop of the latest target branch
|
||||||
|
run: |
|
||||||
|
./tests/git-helper.sh "rebase-atop-of-the-latest-target-branch"
|
||||||
|
env:
|
||||||
|
TARGET_BRANCH: ${{ inputs.target-branch }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bash tests/integration/docker/gha-run.sh install-dependencies
|
||||||
|
|
||||||
|
- name: get-kata-tarball
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: kata-static-tarball-amd64${{ inputs.tarball-suffix }}
|
||||||
|
path: kata-artifacts
|
||||||
|
|
||||||
|
- name: Install kata
|
||||||
|
run: bash tests/integration/docker/gha-run.sh install-kata kata-artifacts
|
||||||
|
|
||||||
|
- name: Run docker smoke test
|
||||||
|
timeout-minutes: 5
|
||||||
|
run: bash tests/integration/docker/gha-run.sh run
|
54
tests/integration/docker/gha-run.sh
Executable file
54
tests/integration/docker/gha-run.sh
Executable file
@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
kata_tarball_dir="${2:-kata-artifacts}"
|
||||||
|
docker_dir="$(dirname "$(readlink -f "$0")")"
|
||||||
|
source "${docker_dir}/../../common.bash"
|
||||||
|
|
||||||
|
function install_dependencies() {
|
||||||
|
info "Installing the dependencies needed for running the docker smoke test"
|
||||||
|
|
||||||
|
# Add Docker's official GPG key:
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get -y install ca-certificates curl gnupg
|
||||||
|
sudo install -m 0755 -d /etc/apt/keyrings
|
||||||
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||||
|
sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
||||||
|
|
||||||
|
# Add the repository to Apt sources:
|
||||||
|
echo \
|
||||||
|
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
||||||
|
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
|
||||||
|
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
sudo apt-get update
|
||||||
|
|
||||||
|
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
info "Running docker smoke test tests using ${KATA_HYPERVISOR} hypervisor"
|
||||||
|
|
||||||
|
enabling_hypervisor
|
||||||
|
|
||||||
|
sudo docker run --rm --runtime io.containerd.kata.v2 alpine ping -c 2 www.github.com
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
action="${1:-}"
|
||||||
|
case "${action}" in
|
||||||
|
install-dependencies) install_dependencies ;;
|
||||||
|
install-kata) install_kata ;;
|
||||||
|
run) run ;;
|
||||||
|
*) >&2 die "Invalid argument" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
Loading…
Reference in New Issue
Block a user