Skip to content

Commit a7a1eaf

Browse files
taspelundjclulow
andauthored
Add buildomat job for interop testing (#466)
* Add buildomat job for interop testing Signed-off-by: Trey Aspelund <[email protected]> * Fix input filepath for test-interop job Signed-off-by: Trey Aspelund <[email protected]> * fix more filepath stuff for interop testing Signed-off-by: Trey Aspelund <[email protected]> * Remember to install protobuf dependency Signed-off-by: Trey Aspelund <[email protected]> * remember to install propolis Signed-off-by: Trey Aspelund <[email protected]> * test-interop.sh: remove propolis install logic Signed-off-by: Trey Aspelund <[email protected]> * test-interop.sh: get ipadm/dladm output for info Signed-off-by: Trey Aspelund <[email protected]> * more info collection Signed-off-by: Trey Aspelund <[email protected]> * Move to lab-2.0-opte buildomat target Signed-off-by: Trey Aspelund <[email protected]> * Add pkg install git for lab-2.0-opte target Signed-off-by: Trey Aspelund <[email protected]> * buildomat: split interop into build/test stages The interop falcon topology must be run on hardware w/ OPTE, so this needs to be split into a separate job w/ target lab-2.0-opte. Modify the build stage to output a tarball that the test stage can execute on its own. Signed-off-by: Trey Aspelund <[email protected]> * buildomat: Add leading backslash Signed-off-by: Trey Aspelund <[email protected]> * discover what's actually in /input Signed-off-by: Trey Aspelund <[email protected]> * buildomat: fix output path Signed-off-by: Trey Aspelund <[email protected]> * fix buildomat path for reals Signed-off-by: Trey Aspelund <[email protected]> * 3rd time is the charm - fix buildomat path Signed-off-by: Trey Aspelund <[email protected]> * XXX slight adjustment of the timing chain * XXX once again with feeling * XXX would that it were so simple * Add .falcon to tarball Signed-off-by: Trey Aspelund <[email protected]> * get more info Signed-off-by: Trey Aspelund <[email protected]> * more info Signed-off-by: Trey Aspelund <[email protected]> * try tarballing all of the testbed repo Signed-off-by: Trey Aspelund <[email protected]> * update output_rules Signed-off-by: Trey Aspelund <[email protected]> * try, try again Signed-off-by: Trey Aspelund <[email protected]> * fixup some file paths Signed-off-by: Trey Aspelund <[email protected]> * look for propolis uuid file Signed-off-by: Trey Aspelund <[email protected]> * get more .falcon info during build time Signed-off-by: Trey Aspelund <[email protected]> * how many propoli might there be? Signed-off-by: Trey Aspelund <[email protected]> * sigh, sigh again Signed-off-by: Trey Aspelund <[email protected]> * get disk/zfs info Signed-off-by: Trey Aspelund <[email protected]> * Create zpool on disks for falcon Signed-off-by: Trey Aspelund <[email protected]> * build/archive/run test as separate binary Signed-off-by: Trey Aspelund <[email protected]> * fix test filepath Signed-off-by: Trey Aspelund <[email protected]> * rename baseline binary Signed-off-by: Trey Aspelund <[email protected]> * remove deprecated --logfile from test invocation Signed-off-by: Trey Aspelund <[email protected]> * where oh where has my propolis gone Signed-off-by: Trey Aspelund <[email protected]> * get more info on falcon dir Signed-off-by: Trey Aspelund <[email protected]> * ls better Signed-off-by: Trey Aspelund <[email protected]> * check which "mgd.uuid" baseline is trying to open Signed-off-by: Trey Aspelund <[email protected]> * check working dir during test build / execution Signed-off-by: Trey Aspelund <[email protected]> * buildomat: put testbed in same place for build/run Signed-off-by: Trey Aspelund <[email protected]> * cleanup remove references to realpath (not installed) and yank truss Signed-off-by: Trey Aspelund <[email protected]> * interop: grab just the latest test binary Signed-off-by: Trey Aspelund <[email protected]> * collect arista info upon failure Signed-off-by: Trey Aspelund <[email protected]> * try to get more info on the docker failure Signed-off-by: Trey Aspelund <[email protected]> * split interop execs * move some log copying around * even fewer exec commands * get falcon logs * get init.log * add dhcp-server Signed-off-by: Trey Aspelund <[email protected]> * try one more 'gain Signed-off-by: Trey Aspelund <[email protected]> * try using just builder prereqs Signed-off-by: Trey Aspelund <[email protected]> * source env.sh Signed-off-by: Trey Aspelund <[email protected]> * remove cargo-nextest Signed-off-by: Trey Aspelund <[email protected]> * get/fix target dir permissions Signed-off-by: Trey Aspelund <[email protected]> * stat target dirs before and after chown Signed-off-by: Trey Aspelund <[email protected]> * XXX ease the running of build-interop on a local system * install cmake for dhcp-server build Signed-off-by: Trey Aspelund <[email protected]> * fix dhcp-server path Signed-off-by: Trey Aspelund <[email protected]> * remove cmake, as it's now part of the omicron dependency script Signed-off-by: Trey Aspelund <[email protected]> * remove old stuff Signed-off-by: Trey Aspelund <[email protected]> * Use prebuilt cargo-nextest Signed-off-by: Trey Aspelund <[email protected]> * Add ~/.cargo/bin to PATH Signed-off-by: Trey Aspelund <[email protected]> * Use cargo-nextest 0.9.96 Signed-off-by: Trey Aspelund <[email protected]> * Fix URL, use cargo-nextest 0.9.97 Signed-off-by: Trey Aspelund <[email protected]> * buildomat: move info collection to trap handler Signed-off-by: Trey Aspelund <[email protected]> * test trap handler with artificial failure * Dump /work upon failure Signed-off-by: Trey Aspelund <[email protected]> * Avoid serial console when possible Signed-off-by: Trey Aspelund <[email protected]> * Remove intentional failure Signed-off-by: Trey Aspelund <[email protected]> * reformat network info collection Move bgp/interface/route info collection into its own function. Call this function once before the test runs, then again as part of the error handler. Signed-off-by: Trey Aspelund <[email protected]> * buildomat: try lab-2.0-gimlet target Signed-off-by: Trey Aspelund <[email protected]> * buildomat: set DISK to the largest disk available Signed-off-by: Trey Aspelund <[email protected]> * buildomat: disable ssh hostchecking Signed-off-by: Trey Aspelund <[email protected]> * add nop comment to trigger buildomat run Signed-off-by: Trey Aspelund <[email protected]> * remove nop comment, trigger another CI run Signed-off-by: Trey Aspelund <[email protected]> * NOP number 2 Signed-off-by: Trey Aspelund <[email protected]> * remove NOP number 2 Signed-off-by: Trey Aspelund <[email protected]> * buildomat: make shellcheck happy Signed-off-by: Trey Aspelund <[email protected]> * fix escape syntax moving from backticks to $() substitution required different escaping for a variable passed to awk. Signed-off-by: Trey Aspelund <[email protected]> * fix bad syntax for cut Signed-off-by: Trey Aspelund <[email protected]> --------- Signed-off-by: Trey Aspelund <[email protected]> Co-authored-by: Joshua M. Clulow <[email protected]>
1 parent 49cc16a commit a7a1eaf

File tree

6 files changed

+290
-6
lines changed

6 files changed

+290
-6
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
#:
3+
#: name = "build-interop"
4+
#: variety = "basic"
5+
#: target = "helios-2.0"
6+
#: rust_toolchain = "stable"
7+
#: access_repos = [
8+
#: "oxidecomputer/testbed",
9+
#: ]
10+
#: output_rules = [
11+
#: "=/work/testbed.tar.gz",
12+
#: "=/work/dhcp-server",
13+
#: ]
14+
#:
15+
16+
set -x
17+
set -e
18+
19+
#
20+
# Allow this program to run either under buildomat, or in a local clone:
21+
#
22+
if [[ $CI == true ]]; then
23+
top=$PWD
24+
WORK=/work
25+
26+
pfexec pkg install protobuf git
27+
else
28+
if [[ -z $WORK || ! -d $WORK ]]; then
29+
printf 'ERROR: set WORK when running manually\n' >&2
30+
exit 1
31+
fi
32+
33+
#
34+
# Be resilient against someone running this while not in the repository
35+
# root directory:
36+
#
37+
top=$(cd "$(dirname "$0")"/../../.. && pwd)
38+
fi
39+
40+
cargo --version
41+
rustc --version
42+
43+
banner 'clone'
44+
mkdir "$top/ci"
45+
git clone https://github.com/oxidecomputer/testbed "$top/ci/testbed"
46+
47+
banner 'build'
48+
cd "$top/ci/testbed"
49+
cargo build \
50+
-p interop-lab \
51+
-p wrangler
52+
cargo build --tests
53+
54+
banner 'prep'
55+
56+
mkdir out
57+
cp target/debug/{interop,wrangler} out/
58+
# grab just the file ending in the hash, not the file ending in ".d"
59+
TEST=$(find target/debug/deps -maxdepth 1 -type f -name 'baseline-*' -exec ls -t {} + | grep -v -E '.*\.d$' | head -1)
60+
mv "$TEST" 'out/baseline'
61+
62+
banner 'archive'
63+
64+
cd "$top/ci"
65+
cat <<EOF > exclude-file.txt
66+
testbed/.git
67+
testbed/a4x2
68+
testbed/archive
69+
testbed/target
70+
EOF
71+
tar cvzXf exclude-file.txt \
72+
"$WORK/testbed.tar.gz" \
73+
testbed
74+
75+
banner 'dhcp-server'
76+
77+
git clone https://github.com/oxidecomputer/omicron.git "$top/ci/omicron"
78+
cd "$top/ci/omicron"
79+
source env.sh
80+
if [[ $CI == true ]]; then
81+
source .github/buildomat/ci-env.sh
82+
./tools/install_builder_prerequisites.sh -y
83+
fi
84+
cargo build -p end-to-end-tests --bin dhcp-server --release
85+
cp target/release/dhcp-server "$WORK/"

.github/buildomat/jobs/test-bfd.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ set -o xtrace
1616
set -o errexit
1717
set -o pipefail
1818

19+
# NOTE: This version should be in sync with the recommended version in
20+
# .config/nextest.toml. (Maybe build an automated way to pull the recommended
21+
# version in the future.)
22+
NEXTEST_VERSION='0.9.97'
23+
PLATFORM='illumos'
24+
1925
cargo --version
2026
rustc --version
21-
22-
cargo install cargo-nextest
27+
curl -sSfL --retry 10 https://get.nexte.st/"$NEXTEST_VERSION"/"$PLATFORM" | gunzip | tar -xvf - -C ~/.cargo/bin
2328

2429
banner bfd
2530
cargo nextest run -p bfd --nocapture

.github/buildomat/jobs/test-bgp.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@
1515
set -x
1616
set -e
1717

18+
# NOTE: This version should be in sync with the recommended version in
19+
# .config/nextest.toml. (Maybe build an automated way to pull the recommended
20+
# version in the future.)
21+
NEXTEST_VERSION='0.9.97'
22+
PLATFORM='illumos'
23+
1824
cargo --version
1925
rustc --version
20-
21-
cargo install cargo-nextest
26+
curl -sSfL --retry 10 https://get.nexte.st/"$NEXTEST_VERSION"/"$PLATFORM" | gunzip | tar -xvf - -C ~/.cargo/bin
2227

2328
pushd bgp
2429
cargo nextest run
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
#!/bin/bash
2+
#:
3+
#: name = "test-interop"
4+
#: variety = "basic"
5+
#: target = "lab-2.0-gimlet"
6+
#: skip_clone = true
7+
#: output_rules = [
8+
#: "/work/*",
9+
#: ]
10+
#:
11+
#: [dependencies.build-interop]
12+
#: job = "build-interop"
13+
#:
14+
#: [dependencies.image]
15+
#: job = "image"
16+
#:
17+
18+
set -x
19+
set -e
20+
21+
ssh() {
22+
if [ -z "$SSH_BIN" ]; then
23+
SSH_BIN=$(which ssh)
24+
fi
25+
26+
$SSH_BIN -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"
27+
}
28+
29+
net_info() {
30+
#
31+
# grab command output to see what's going on from the buildomat logs
32+
#
33+
if [ -z "$ARISTA_IP" ]; then
34+
ARISTA_IF=$(pfexec ./interop exec arista "ip -4 -j route show default | jq '.[0][\"dev\"]' | tr -d '\"'")
35+
ARISTA_IP=$(pfexec ./interop exec arista "ip -4 -br -j addr show dev $ARISTA_IF | jq '.[0][\"addr_info\"][0][\"local\"]' | tr -d '\"'")
36+
fi
37+
ssh root@"$ARISTA_IP" "docker exec -t ceos1 Cli -c 'show ip interface brief | no-more'"
38+
ssh root@"$ARISTA_IP" "docker exec -t ceos1 Cli -c 'show ip bgp summary | no-more'"
39+
ssh root@"$ARISTA_IP" "docker exec -t ceos1 Cli -c 'show ip bgp | no-more'"
40+
ssh root@"$ARISTA_IP" "docker exec -t ceos1 Cli -c 'show ip route | no-more'"
41+
42+
if [ -z "$JUNIPER_IP" ]; then
43+
JUNIPER_IF=$(pfexec ./interop exec juniper "ip -j route show default | jq '.[0][\"dev\"]' | tr -d '\"'")
44+
JUNIPER_IP=$(pfexec ./interop exec juniper "ip -4 -br -j addr show dev $JUNIPER_IF | jq '.[0][\"addr_info\"][0][\"local\"]' | tr -d '\"'")
45+
fi
46+
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cli -c 'show interfaces terse | no-more'"
47+
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cli -c 'show bgp summary | no-more'"
48+
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cli -c 'show route | no-more'"
49+
50+
if [ -z "$MGD_IP" ]; then
51+
MGD_IF=$(pfexec ./interop exec mgd "route get -inet default | grep interface | awk '{print \$NF}'")
52+
MGD_IP=$(pfexec ./interop exec mgd "ipadm show-addr $MGD_IF/v4 -p -o addr | cut -d / -f 1")
53+
fi
54+
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status neighbors 65100"
55+
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status imported 65100"
56+
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status selected 65100"
57+
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status exported 65100"
58+
}
59+
60+
_exit_trap() {
61+
local status=$?
62+
[[ $status -eq 0 ]] && exit 0
63+
64+
set +o errexit
65+
66+
banner 'debug'
67+
68+
#
69+
# collect general info about runner
70+
#
71+
pfexec df -h
72+
pfexec diskinfo
73+
pfexec zfs list
74+
pfexec zpool list
75+
pfexec ls -l /ci
76+
77+
#
78+
# collect falcon info
79+
#
80+
find /ci/testbed/interop/.falcon -ls
81+
cp /ci/testbed/interop/.falcon/{arista,juniper,mgd}* /work/
82+
83+
#
84+
# check if propolis is running
85+
#
86+
pgrep -lf propolis-server
87+
88+
#
89+
# get network info from nodes
90+
#
91+
net_info
92+
93+
#
94+
# grab platform-specific logs
95+
# variables set in prior call to net_info
96+
#
97+
ssh root@"$ARISTA_IP" "cp /tmp/init.log /tmp/arista.init.log"
98+
ssh root@"$ARISTA_IP" "docker ps -a > /tmp/arista.docker-ps.log"
99+
ssh root@"$ARISTA_IP" "docker logs ceos1 > /tmp/arista.docker.logs"
100+
ssh root@"$ARISTA_IP" "docker exec -t ceos1 cat /var/log/account.log > /tmp/arista.account.log"
101+
ssh root@"$ARISTA_IP" "docker exec -t ceos1 cat /var/log/messages > /tmp/arista.messages"
102+
ssh root@"$ARISTA_IP" "docker exec -t ceos1 cat /var/log/nginx-error.log > /tmp/arista.nginx-error.log"
103+
ssh root@"$ARISTA_IP" "docker exec -t ceos1 cat /var/log/nginx-access.log > /tmp/arista.nginx-access.log"
104+
scp root@"$ARISTA_IP":/tmp/*.log /work
105+
106+
ssh root@"$JUNIPER_IP" "cp /tmp/init.log /tmp/juniper.init.log"
107+
ssh root@"$JUNIPER_IP" "docker ps -a > /tmp/juniper.docker-ps.log"
108+
ssh root@"$JUNIPER_IP" "docker logs crpd1 > /tmp/juniper.docker-logs.log"
109+
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cat /var/log/messages > /tmp/juniper-messages.log"
110+
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cat /var/log/na-grpcd > /tmp/juniper-na-grpcd.log"
111+
scp root@"$JUNIPER_IP":/tmp/*.log /work
112+
113+
# /tmp filepaths chosen in testbed/interop/src/interop.rs and testbed/interop/cargo-bay/mgd/init.sh
114+
ssh root@"$MGD_IP" "cp /tmp/init.log /tmp/mgd.init.log"
115+
scp root@"$MGD_IP":/tmp/{mgd.init,mgd}.log /work
116+
117+
find /work -ls
118+
119+
exit 1
120+
}
121+
122+
trap _exit_trap EXIT
123+
124+
banner 'inputs'
125+
126+
find /input -ls
127+
128+
banner 'zpool'
129+
130+
# pick the largest disk available
131+
DISK=$(pfexec diskinfo -pH | sort -k8 -n -r | head -1 | awk '{print $2}')
132+
export DISK
133+
pfexec zpool create -o ashift=12 -f cpool "$DISK"
134+
pfexec zfs create -o mountpoint=/ci cpool/ci
135+
136+
if [[ $(curl -s http://catacomb.eng.oxide.computer:12346/trim-me) =~ "true" ]]; then
137+
pfexec zpool trim cpool
138+
while [[ ! $(zpool status -t cpool) =~ "100%" ]]; do sleep 10; done
139+
fi
140+
141+
pfexec chown "$UID" /ci
142+
cd /ci
143+
export FALCON_DATASET="cpool/falcon"
144+
145+
banner 'setup'
146+
147+
tar xvfz /input/build-interop/work/testbed.tar.gz
148+
149+
mkdir -p image/mgd
150+
(cd image/mgd && tar xvfz /input/image/out/mgd.tar.gz)
151+
for bin in mgadm mgd; do
152+
mv "image/mgd/root/opt/oxide/mgd/bin/$bin" \
153+
"testbed/interop/cargo-bay/mgd/$bin"
154+
done
155+
cd testbed
156+
mkdir -p target/debug
157+
mv out/{interop,wrangler} target/debug
158+
mv out/baseline interop
159+
160+
banner 'dhcp-server'
161+
162+
export EXT_INTERFACE=${EXT_INTERFACE:-igb0}
163+
164+
cp /input/build-interop/work/dhcp-server .
165+
chmod +x dhcp-server
166+
first=$(bmat address ls -f extra -Ho first)
167+
last=$(bmat address ls -f extra -Ho last)
168+
gw=$(bmat address ls -f extra -Ho gateway)
169+
server=$(ipadm show-addr "$EXT_INTERFACE"/dhcp -po ADDR | sed 's#/.*##g')
170+
pfexec ./dhcp-server "$first" "$last" "$gw" "$server" &> /work/dhcp-server.log &
171+
172+
banner 'launch'
173+
174+
cd interop
175+
pfexec ./interop launch
176+
177+
banner 'status'
178+
179+
net_info
180+
181+
banner 'test'
182+
183+
./baseline --show-output

.github/buildomat/jobs/test-rdb.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@
1515
set -x
1616
set -e
1717

18+
# NOTE: This version should be in sync with the recommended version in
19+
# .config/nextest.toml. (Maybe build an automated way to pull the recommended
20+
# version in the future.)
21+
NEXTEST_VERSION='0.9.97'
22+
PLATFORM='illumos'
23+
1824
cargo --version
1925
rustc --version
20-
21-
cargo install cargo-nextest
26+
curl -sSfL --retry 10 https://get.nexte.st/"$NEXTEST_VERSION"/"$PLATFORM" | gunzip | tar -xvf - -C ~/.cargo/bin
2227

2328
pushd rdb
2429

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
target
2+
ci
23
*.sw*
34
rusty-tags.vi
45
cargo-bay

0 commit comments

Comments
 (0)