-
Notifications
You must be signed in to change notification settings - Fork 195
snp: added snp unencrypted test #5594
Changes from all commits
e579c8d
a2f8709
a4017f6
da31671
625f300
c58061a
330f0fc
c040815
280e0f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
# Copyright 2022 Advanced Micro Devices, Inc. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
set -o errtrace | ||
|
||
cidir=$(dirname "$0") | ||
source "${cidir}/lib.sh" | ||
|
||
main() { | ||
build_static_artifact_and_install x86_64-ovmf | ||
} | ||
|
||
main "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,12 @@ cc-sev-kubernetes: | |
K8S_TEST_UNION="confidential/sev.bats" \ | ||
bash integration/kubernetes/run_kubernetes_tests.sh | ||
|
||
# Run the Confidential Containers AMD SNP specific tests. | ||
cc-snp-kubernetes: | ||
bash -f .ci/install_bats.sh | ||
K8S_TEST_UNION="confidential/snp.bats" \ | ||
bash integration/kubernetes/run_kubernetes_tests.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this be redundant with the GHA tests? Will those run on CCv0 now that we have rebased? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GHA tests will not run on CCv0, those are specific to the |
||
|
||
log-parser: | ||
make -C cmd/log-parser | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,7 @@ configure_cc_containerd() { | |
sudo systemctl stop containerd | ||
sleep 5 | ||
[ -n "$saved_containerd_conf_file" ] && \ | ||
cp -f "$containerd_conf_file" "$saved_containerd_conf_file" | ||
sudo cp -f "$containerd_conf_file" "$saved_containerd_conf_file" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @ryansavino , double-checking it is really needed. Because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i was getting errors in my test env from this line and the script was stopping. In the CI env, this file ends up being owned by root from some process:
|
||
sudo systemctl start containerd | ||
waitForProcess 30 5 "sudo crictl info >/dev/null" | ||
|
||
|
@@ -353,3 +353,90 @@ setup_credentials_files() { | |
CREDENTIAL="${auth_json}" envsubst < "${SHARED_FIXTURES_DIR}/offline-fs-kbc/aa-offline_fs_kbc-resources.json.in" > "${dest_file}" | ||
cp_to_guest_img "etc" "${dest_file}" | ||
} | ||
|
||
############################################################################### | ||
|
||
# simple-kbs | ||
|
||
SIMPLE_KBS_DIR="${SIMPLE_KBS_DIR:-/tmp/simple-kbs}" | ||
KBS_DB_USER="${KBS_DB_USER:-kbsuser}" | ||
KBS_DB_PW="${KBS_DB_PW:-kbspassword}" | ||
KBS_DB="${KBS_DB:-simple_kbs}" | ||
#KBS_DB_TYPE="{KBS_DB_TYPE:-mysql}" | ||
|
||
# Run the simple-kbs | ||
simple_kbs_run() { | ||
# Retrieve simple-kbs repo and tag from versions.yaml | ||
local simple_kbs_url=$(get_test_version "externals.simple-kbs.url") | ||
local simple_kbs_tag=$(get_test_version "externals.simple-kbs.tag") | ||
|
||
# Cleanup and create installation directory | ||
esudo rm -rf "${SIMPLE_KBS_DIR}" | ||
mkdir -p "${SIMPLE_KBS_DIR}" | ||
pushd "${SIMPLE_KBS_DIR}" | ||
|
||
# Clone and run | ||
git clone "${simple_kbs_url}" --branch main | ||
pushd simple-kbs | ||
|
||
# Checkout, build and start | ||
git checkout -b "branch_${simple_kbs_tag}" "${simple_kbs_tag}" | ||
esudo docker-compose build | ||
esudo docker-compose up -d | ||
|
||
# Wait for simple-kbs to start | ||
waitForProcess 15 1 "esudo docker-compose top | grep -q simple-kbs" | ||
popd | ||
|
||
# Get simple-kbs database container ip | ||
local kbs_db_host=$(simple_kbs_get_db_ip) | ||
|
||
# Confirm connection to the database is possible | ||
waitForProcess 5 1 "mysql -u${KBS_DB_USER} -p${KBS_DB_PW} -h ${kbs_db_host} -D ${KBS_DB} -e '\q'" | ||
popd | ||
} | ||
|
||
# Stop simple-kbs and database containers | ||
simple_kbs_stop() { | ||
(cd ${SIMPLE_KBS_DIR}/simple-kbs && esudo docker-compose down 2>/dev/null) | ||
} | ||
|
||
# Delete all test inserted data in the simple-kbs | ||
simple_kbs_delete_data() { | ||
# Get simple-kbs database container ip | ||
local kbs_db_host=$(simple_kbs_get_db_ip) | ||
|
||
# Delete all data with 'id = 10' | ||
mysql -u${KBS_DB_USER} -p${KBS_DB_PW} -h ${kbs_db_host} -D ${KBS_DB} <<EOF | ||
DELETE FROM secrets WHERE id = 10; | ||
DELETE FROM policy WHERE id = 10; | ||
EOF | ||
} | ||
|
||
# Get the ip of the simple-kbs database docker container | ||
simple_kbs_get_db_ip() { | ||
esudo docker network inspect simple-kbs_default \ | ||
| jq -r '.[].Containers[] | select(.Name | test("simple-kbs[_-]db.*")).IPv4Address' \ | ||
| sed "s|/.*$||g" | ||
} | ||
|
||
# Add key and keyset to database | ||
# If measurement is provided, add policy with measurement to database | ||
simple_kbs_add_key_to_db() { | ||
local encryption_key="${1}" | ||
local measurement="${2}" | ||
|
||
# Get simple-kbs database container ip | ||
local kbs_db_host=$(simple_kbs_get_db_ip) | ||
|
||
if [ -n "${measurement}" ]; then | ||
mysql -u${KBS_DB_USER} -p${KBS_DB_PW} -h ${kbs_db_host} -D ${KBS_DB} <<EOF | ||
INSERT INTO secrets VALUES (10, 'default/key/ssh-demo', '${encryption_key}', 10); | ||
INSERT INTO policy VALUES (10, '["${measurement}"]', '[]', 0, 0, '[]', now(), NULL, 1); | ||
EOF | ||
else | ||
mysql -u${KBS_DB_USER} -p${KBS_DB_PW} -h ${kbs_db_host} -D ${KBS_DB} <<EOF | ||
INSERT INTO secrets VALUES (10, 'default/key/ssh-demo', '${encryption_key}', NULL); | ||
EOF | ||
fi | ||
} |
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.
Sorry, just notice this
CC_SNP_CRI_CONTAINERD_K8S
.... usually we haveCC_CRI_CONTAINERD_K8S_SOME_SPECIFIC_CONFIG
. So it should beCC_CRI_CONTAINERD_K8S_SNP
.CC_SEV_CRI_CONTAINERD_K8S
above seems wrong but better not change it right now.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.
@wainersm changing this will need changes to be made in the CI repo as well. So do you think it is safer to do that in a different PR? I can open one as soon as this gets merged. I already have a PR open in ci repo. What do you think?
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.
@UnmeshDeodhar Indeed it is safer to do that change on a follow up PR.