-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker provider e2e test #2188
Open
stevenhorsman
wants to merge
5
commits into
confidential-containers:main
Choose a base branch
from
stevenhorsman:docker-provider-e2e-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Docker provider e2e test #2188
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
916f54e
workflows: use a common debugger (ci-e2e-debug-fail.sh)
wainersm 6a0fcc3
workflows: add test e2e workflow for docker
wainersm bb3c7f3
workflows: enable docker e2e test in e2e_run_all
wainersm 4094640
workflows/docker: Remove installation directory
stevenhorsman 483a246
workflows/docker: switch to CRI-O
wainersm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# (C) Copyright Confidential Containers Contributors 2024. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Run docker e2e tests. | ||
name: (Callable) docker e2e tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
podvm_image: | ||
required: true | ||
type: string | ||
caa_image: | ||
description: The cloud-api-adaptor OCI image (including tag) to test | ||
type: string | ||
install_directory_artifact: | ||
description: The archive name of the install directory | ||
default: '' | ||
required: false | ||
type: string | ||
git_ref: | ||
default: 'main' | ||
description: Git ref to checkout the cloud-api-adaptor repository. Defaults to main. | ||
required: false | ||
type: string | ||
container_runtime: | ||
default: 'containerd' | ||
description: Name of the container runtime. Either containerd or crio. | ||
required: false | ||
type: string | ||
|
||
env: | ||
CLOUD_PROVIDER: docker | ||
CLUSTER_NAME: peer-pods | ||
DEBIAN_FRONTEND: noninteractive | ||
|
||
defaults: | ||
run: | ||
working-directory: src/cloud-api-adaptor | ||
|
||
jobs: | ||
test-docker: | ||
runs-on: ubuntu-22.04 | ||
# TODO: remove this when the job gets stable | ||
continue-on-error: true | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ inputs.git_ref }} | ||
|
||
- name: Rebase the code | ||
if: github.event_name == 'pull_request_target' | ||
working-directory: ./ | ||
run: | | ||
./hack/ci-helper.sh rebase-atop-of-the-latest-target-branch | ||
|
||
- name: Login to quay Container Registry | ||
if: ${{ startsWith(inputs.podvm_image, 'quay.io') }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
- name: Login to the ghcr Container registry | ||
if: ${{ startsWith(inputs.podvm_image, 'ghcr.io') }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Read properties from versions.yaml | ||
run: | | ||
sudo snap install yq | ||
go_version="$(yq '.tools.golang' versions.yaml)" | ||
[ -n "$go_version" ] | ||
echo "GO_VERSION=${go_version}" >> "$GITHUB_ENV" | ||
|
||
- name: Setup Golang version ${{ env.GO_VERSION }} | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Install kustomize | ||
run: | | ||
command -v kustomize >/dev/null || \ | ||
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | \ | ||
sudo bash -s /usr/local/bin | ||
|
||
- name: Update kustomization configuration | ||
run: | | ||
cd "install/overlays/docker" | ||
kustomize edit set image "cloud-api-adaptor=${{ inputs.caa_image }}" | ||
# Print for debugging | ||
echo "::group::docker kustomization" | ||
cat kustomization.yaml | ||
echo "::endgroup::" | ||
|
||
- name: Config docker | ||
run: | | ||
cat <<- EOF > docker.properties | ||
DOCKER_PODVM_IMAGE="${{ inputs.podvm_image }}" | ||
DOCKER_HOST="unix:///var/run/docker.sock" | ||
DOCKER_NETWORK_NAME="kind" | ||
CONTAINER_RUNTIME="${{ inputs.container_runtime }}" | ||
EOF | ||
# For debugging | ||
cat docker.properties | ||
|
||
- name: run tests | ||
id: runTests | ||
run: | | ||
export CLOUD_PROVIDER=docker | ||
export CONTAINER_RUNTIME="${{ inputs.container_runtime }}" | ||
export DEPLOY_KBS=false | ||
export TEST_PROVISION=yes | ||
export TEST_TEARDOWN=no | ||
export TEST_PROVISION_FILE="$PWD/docker.properties" | ||
export TEST_PODVM_IMAGE="${{ inputs.podvm_image }}" | ||
export TEST_E2E_TIMEOUT="50m" | ||
|
||
make test-e2e | ||
|
||
- name: Debug tests failure | ||
if: failure() && steps.runTests.outcome == 'failure' | ||
working-directory: ./ | ||
run: | | ||
export KUBECONFIG="${HOME}/kube_${CLUSTER_NAME}" | ||
kind get kubeconfig -n "$CLUSTER_NAME" > "$KUBECONFIG" | ||
./hack/ci-e2e-debug-fail.sh | ||
# Avoid running with `set -e` as command fails should be allowed | ||
shell: bash {0} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# (C) Copyright Confidential Containers Contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Primarily used on Github workflows to debug failed pipelines. | ||
# | ||
# NOTE: if you want a debugger for MY_PROVIDER provider then you just need | ||
# to create the debug_MY_PROVIDER function. Nothing else is needed. | ||
# | ||
# Not setting errexit, nounset, and pipefail because it is fine and should | ||
# continue if any command fail. | ||
|
||
CLOUD_PROVIDER=${CLOUD_PROVIDER:-} | ||
|
||
# Get common debug information. | ||
# | ||
debug_common() { | ||
echo "::group::KBS installation" | ||
kubectl get pods -n coco-tenant | ||
kubectl describe pods -n coco-tenant | ||
echo "::endgroup::" | ||
|
||
echo "::group::CoCo and Peer Pods installation" | ||
kubectl get pods -n confidential-containers-system | ||
kubectl describe pods -n confidential-containers-system | ||
echo "::endgroup::" | ||
|
||
echo "::group::cloud-api-adaptor logs" | ||
kubectl logs -l app=cloud-api-adaptor --tail=-1 -n confidential-containers-system | ||
echo "::endgroup::" | ||
|
||
echo "::group::kbs logs" | ||
kubectl logs deployment/kbs -n coco-tenant | ||
echo "::endgroup::" | ||
|
||
for ns in $(kubectl get ns -o name 2>/dev/null | sed 's#namespace/##' | grep "^coco-pp-"); do | ||
for pod in $(kubectl get pods -o name -n "$ns" 2>/dev/null); do | ||
echo "::group::Describe $pod (namespace/$ns)" | ||
kubectl describe "$pod" -n "$ns" | ||
echo "::endgroup::" | ||
done | ||
done | ||
|
||
for worker in $(kubectl get node -o name -l node.kubernetes.io/worker 2>/dev/null); do | ||
echo "::group::journalctl -t kata ($worker)" | ||
kubectl debug --image quay.io/prometheus/busybox -q -i \ | ||
"$worker" -- chroot /host journalctl -x -t kata --no-pager | ||
echo "::endgroup::" | ||
done | ||
} | ||
|
||
# Debugger for Libvirt. | ||
# | ||
debug_libvirt() { | ||
echo "::group::Libvirt domains" | ||
sudo virsh list | ||
echo "::endgroup::" | ||
|
||
for podvm in $(sudo virsh list --name | grep "podvm-"); do | ||
echo "::group::podvm $podvm" | ||
sudo virsh dominfo "$podvm" | ||
sudo virsh domifaddr "$podvm" | ||
echo "::endgroup::" | ||
done | ||
|
||
echo "::group::podvm base volume" | ||
sudo virsh vol-info --pool default podvm-base.qcow2 | ||
ls -lh /var/lib/libvirt/images/podvm-base.qcow2 | ||
echo "::endgroup::" | ||
|
||
echo "::group::Check podvm base volume integrity" | ||
sudo qemu-img check /var/lib/libvirt/images/podvm-base.qcow2 | ||
echo "::endgroup::" | ||
} | ||
|
||
main() { | ||
debug_common | ||
|
||
if [ -n "$CLOUD_PROVIDER" ]; then | ||
if ! type -a "debug_${CLOUD_PROVIDER}" &>/dev/null; then | ||
echo "INFO: Cannot get further information as debugger for ${CLOUD_PROVIDER} is not implemented" | ||
else | ||
"debug_${CLOUD_PROVIDER}" | ||
fi | ||
fi | ||
} | ||
|
||
main "$@" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to enable KBS tests with sample attester in a follow-on PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that makes sense, unless you want us to try it in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to add anything that may delay the release :-) .. Follow-on PR is fine..