Skip to content
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

Enable multihost test execution on main branch #523

Merged
merged 3 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
jobs:
- job: tests
trigger: pull_request
identifier: singlehost
branch: main
targets:
#- fedora-branched
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Library/sync/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
5 changes: 3 additions & 2 deletions Library/sync/sync-block
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -104,15 +105,15 @@ 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"
DELAY=${DELAYS%% *} # current delay
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"
2 changes: 1 addition & 1 deletion Multihost/basic-attestation/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion Multihost/basic-attestation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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']}"
Dismissed Show dismissed Hide dismissed
[ -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} )
Expand Down
50 changes: 50 additions & 0 deletions plans/upstream-keylime-multihost.fmf
Original file line number Diff line number Diff line change
@@ -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