Skip to content

Commit 24f9e68

Browse files
author
Yi He
committed
ci: add ci workflow
Signed-off-by: Yi He <[email protected]>
1 parent f624290 commit 24f9e68

File tree

9 files changed

+484
-6
lines changed

9 files changed

+484
-6
lines changed

.packit.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,15 @@ jobs:
118118
# because they are the only ones officially released with golang >= 1.25.0
119119
- job: tests
120120
trigger: pull_request
121-
identifier: e2e-fedora
122-
tmt_plan: test/fmf/plans/e2e
121+
identifier: rpm-e2e-fedora
122+
tmt_plan: test/fmf/plans/rpm-e2e
123+
packages: [go-fdo-server-fedora]
124+
targets: *copr_fedora_targets
125+
126+
- job: tests
127+
trigger: pull_request
128+
identifier: bootc-e2e-fedora
129+
tmt_plan: test/fmf/plans/bootc-e2e
123130
packages: [go-fdo-server-fedora]
124131
targets: *copr_fedora_targets
125132

@@ -155,7 +162,7 @@ jobs:
155162
#
156163
- job: tests
157164
trigger: pull_request
158-
identifier: e2e-centos
159-
tmt_plan: test/fmf/plans/e2e
165+
identifier: rpm-e2e-centos
166+
tmt_plan: test/fmf/plans/rpm-e2e
160167
packages: [go-fdo-server-centos]
161168
targets: *copr_centos_targets

test/bootc/test-onboarding.sh

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#!/bin/bash
2+
set -euox pipefail
3+
4+
# Import util functions
5+
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/utils.sh"
6+
7+
# Configuration
8+
ssh_options=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5)
9+
ssh_key="id_rsa"
10+
sudo ssh-keygen -f id_rsa -N "" -q -t rsa-sha2-256 -b 2048 <<< y
11+
ssh_key_pub=$(cat "${ssh_key}.pub")
12+
manufacturer_ip="192.168.100.1"
13+
rendezvous_ip="192.168.100.1"
14+
owner_ip="192.168.100.1"
15+
16+
source /etc/os-release
17+
log_info "Detected OS: ${ID} ${VERSION_ID}"
18+
19+
case "${ID}-${VERSION_ID}" in
20+
"fedora-43")
21+
os_variant="fedora-unknown"
22+
base_image_url="quay.io/fedora/fedora-bootc:43"
23+
bib_url="quay.io/centos-bootc/bootc-image-builder:latest"
24+
boot_args="uefi"
25+
;;
26+
"fedora-44")
27+
os_variant="fedora-rawhide"
28+
base_image_url="quay.io/fedora/fedora-bootc:44"
29+
bib_url="quay.io/centos-bootc/bootc-image-builder:latest"
30+
boot_args="uefi"
31+
;;
32+
"centos-9")
33+
os_variant="centos-stream9"
34+
base_image_url="quay.io/centos-bootc/centos-bootc:stream9"
35+
bib_url="quay.io/centos-bootc/bootc-image-builder:latest"
36+
boot_args="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no"
37+
;;
38+
"centos-10")
39+
os_variant="centos-stream9"
40+
base_image_url="quay.io/centos-bootc/centos-bootc:stream10"
41+
bib_url="quay.io/centos-bootc/bootc-image-builder:latest"
42+
boot_args="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no"
43+
;;
44+
*)
45+
log_error "Unsupported distro: ${ID}-${VERSION_ID}"
46+
exit 1
47+
;;
48+
esac
49+
50+
run_test() {
51+
52+
log_info "Setting the error trap handler"
53+
trap on_failure ERR
54+
55+
log_info "Environment variables"
56+
show_env
57+
58+
log_info "Creating directories"
59+
create_directories
60+
61+
log_info "Generating service certificates"
62+
generate_service_certs
63+
64+
log_info "Adding host entries for FDO services in host machine"
65+
echo -e "${manufacturer_ip} manufacturer\n${rendezvous_ip} rendezvous\n${owner_ip} owner" | sudo tee -a /etc/hosts > /dev/null
66+
67+
log_info "Build and install 'go-fdo-server' binary"
68+
install_server
69+
70+
log_info "Configuring services"
71+
configure_services
72+
73+
log_info "Start services"
74+
start_services
75+
76+
log_info "Wait for the services to be ready"
77+
wait_for_services_ready
78+
79+
log_info "Setting or updating Rendezvous Info (RendezvousInfo)"
80+
set_or_update_rendezvous_info "${manufacturer_url}" "${rendezvous_service_name}" "${rendezvous_dns}" "${rendezvous_port}"
81+
82+
log_info "Build bootc container from bootc base image"
83+
install_client $base_image_url $bib_url
84+
85+
log_info "Run Device Initialization"
86+
run_device_initialization $os_variant $boot_args
87+
88+
log_info "Get device initialization voucher guid"
89+
guid=$(get_voucher_guid)
90+
log_info "Device initialized with GUID: ${guid}"
91+
92+
log_info "Sending Ownership Voucher to the Owner"
93+
send_manufacturer_ov_to_owner "${manufacturer_url}" "${guid}" "${owner_url}"
94+
95+
log_info "Setting or updating Owner Redirect Info (RVTO2Addr)"
96+
set_or_update_owner_redirect_info "${owner_url}" "${owner_service_name}" "${owner_dns}" "${owner_port}"
97+
98+
sleep 60
99+
100+
log_info "Running FIDO Device Onboard"
101+
run_fido_device_onboard || log_error "Onboarding failed!"
102+
103+
log_info "Unsetting the error trap handler"
104+
trap - ERR
105+
test_pass
106+
107+
}
108+
109+
# Allow running directly
110+
[[ "${BASH_SOURCE[0]}" != "$0" ]] || { run_test; cleanup; }

0 commit comments

Comments
 (0)