diff --git a/.packit.yaml b/.packit.yaml index e71616d4..2d8e5b9b 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -1,6 +1,7 @@ jobs: - job: tests trigger: pull_request + identifier: singlehost branch: main targets: #- fedora-branched @@ -12,6 +13,29 @@ jobs: - tmt: context: target_PR_branch: "main" + multihost: "no" +- job: tests + trigger: pull_request + identifier: multihost + branch: main + targets: + - centos-stream-9-x86_64 + skip_build: true + env: + SYNC_DEBUG: "1" + use_internal_tf: True + tf_extra_params: + test: + tmt: + name: "/plans/upstream-keylime-multihost" + environments: + - tmt: + context: + target_PR_branch: "main" + multihost: "yes" + settings: + pipeline: + type: tmt-multihost - job: tests trigger: pull_request branch: rhel-9-main diff --git a/Library/sync/lib.sh b/Library/sync/lib.sh index 9e4f4ad3..88375ce5 100644 --- a/Library/sync/lib.sh +++ b/Library/sync/lib.sh @@ -85,7 +85,10 @@ fi # define XTRA variable if not defined but TMT variables are exposed if [ -z "$XTRA" ] && [ -n "$TMT_TREE" ] && [ -n "$TMT_TEST_SERIAL_NUMBER" ]; then - export XTRA="$(echo $TMT_TREE | sed 's#^.*/run-\([0-9]*\)/.*#\1#')-$TMT_TEST_SERIAL_NUMBER" + # tmt is using run-XXX while Testing Farm uses work-multihostXYZ + # and TF through Packit uses something like work-upstream-keylime-multihostXYZ + __INTERNAL_syncRunID=$( echo $TMT_TREE | sed 's#^.*/\(run-[0-9]*\)/.*#\1#' | sed 's#^.*/\(work-[^/]*multihost[^/]*\)/.*#\1#' ) + export XTRA="$__INTERNAL_syncRunID-$TMT_TEST_SERIAL_NUMBER" fi echo "XTRA=$XTRA" diff --git a/Library/sync/sync-block b/Library/sync/sync-block index 42337cb7..93f1a6ec 100755 --- a/Library/sync/sync-block +++ b/Library/sync/sync-block @@ -62,6 +62,7 @@ function is_blocked() { else # read the status file over the network debug "reading statuses from $PROVIDER" + $SYNC_DEBUG && ping -c 1 $PROVIDER ncat --recv-only $PROVIDER $PORT 2> /dev/null > $TMPFILE fi @@ -104,7 +105,7 @@ function is_blocked() { ROUND=1 DELAYS="1 1 2 3 5 8 13 21" -echo -n "Checking status - round $ROUND: " +echo -n "Checking status - round $ROUND - $(date +'%T')" while is_blocked "$@"; do echo "BLOCKED" @@ -112,7 +113,7 @@ while is_blocked "$@"; do DELAYS=${DELAYS#* } # cut-off current delay for DELAYS list (except the last one) sleep $DELAY ROUND=$(( $ROUND+1 )) - echo -n "Checking status - round $ROUND: " + echo -n "Checking status - round $ROUND - $(date +'%T')" done echo "UNBLOCKED" diff --git a/Multihost/basic-attestation/main.fmf b/Multihost/basic-attestation/main.fmf index c63ef126..34c2d031 100644 --- a/Multihost/basic-attestation/main.fmf +++ b/Multihost/basic-attestation/main.fmf @@ -24,7 +24,7 @@ require: - python3-toml recommend: - keylime -duration: 10m +duration: 30m enabled: true extra-nitrate: TC#0611986 id: 203a463c-5f42-46eb-b3b6-46fca4ca6255 diff --git a/Multihost/basic-attestation/test.sh b/Multihost/basic-attestation/test.sh index 1af9a6df..1c234c32 100755 --- a/Multihost/basic-attestation/test.sh +++ b/Multihost/basic-attestation/test.sh @@ -64,7 +64,8 @@ function assign_server_roles() { export AGENT2=$( echo "$SERVERS $CLIENTS" | awk '{ print $4 }') fi - MY_IP=$( hostname -I | awk '{ print $1 }' ) + MY_IP="${TMT_GUEST['hostname']}" + [ -z "$MY_IP" ] && MY_IP=$( hostname -I | awk '{ print $1 }' ) [ -n "$VERIFIER" ] && export VERIFIER_IP=$( get_IP $VERIFIER ) [ -n "$REGISTRAR" ] && export REGISTRAR_IP=$( get_IP $REGISTRAR ) [ -n "${AGENT}" ] && export AGENT_IP=$( get_IP ${AGENT} ) diff --git a/plans/upstream-keylime-multihost.fmf b/plans/upstream-keylime-multihost.fmf new file mode 100644 index 00000000..268775e6 --- /dev/null +++ b/plans/upstream-keylime-multihost.fmf @@ -0,0 +1,50 @@ +summary: + Multihost test used by Packit/TFT CI on Github to test against upstream keylime + +environment+: + TPM_BINARY_MEASUREMENTS: /var/tmp/binary_bios_measurements + +provision: + - name: verifier + role: verifier + - name: registrar + role: registrar + - name: agent + role: agent + +discover: + - name: agent_setup + how: fmf + where: + - agent + test: + - /setup/configure_tpm_emulator + - /setup/configure_kernel_ima_module/ima_policy_signing + - name: multihost_test + how: fmf + test: + #- /setup/enable_keylime_debug_messages + - /Multihost/basic-attestation + +execute: + how: tmt + +adjust+: + - when: target_PR_branch is defined and target_PR_branch != main + enabled: false + because: we want to run this plan only for PRs targeting the main branch + + - when: multihost != yes + enabled: false + because: we want to run this plan only in the multihost pipeline + + - when: distro != centos-stream-9 + enabled: false + + - when: distro == centos-stream-9 + prepare+: + - how: shell + order: 30 + script: + - rpm -Uv https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm || true +