Skip to content

Commit f1511a0

Browse files
[merge] main into zl/mrib
2 parents fbb54c7 + 16110ce commit f1511a0

22 files changed

Lines changed: 566 additions & 198 deletions

.github/buildomat/jobs/build-interop.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515

1616
set -x
1717
set -e
18+
set -o pipefail
1819

1920
#
2021
# Allow this program to run either under buildomat, or in a local clone:
2122
#
22-
if [[ $CI == true ]]; then
23+
if [[ ${CI:-} == true ]]; then
2324
WORK=/work
2425

2526
pfexec pkg install protobuf git
2627
else
27-
if [[ -z $WORK || ! -d $WORK ]]; then
28+
if [[ -z ${WORK} || ! -d ${WORK} ]]; then
2829
printf 'ERROR: set WORK when running manually\n' >&2
2930
exit 1
3031
fi
@@ -34,11 +35,11 @@ cargo --version
3435
rustc --version
3536

3637
banner 'clone'
37-
mkdir -p "$WORK/ci"
38-
git clone https://github.com/oxidecomputer/testbed "$WORK/ci/testbed"
38+
mkdir -p "${WORK}/ci"
39+
git clone https://github.com/oxidecomputer/testbed "${WORK}/ci/testbed"
3940

4041
banner 'build'
41-
cd "$WORK/ci/testbed"
42+
cd "${WORK}/ci/testbed"
4243
cargo build \
4344
-p interop-lab \
4445
-p wrangler
@@ -50,29 +51,31 @@ mkdir -p out
5051
cp target/debug/{interop,wrangler} out/
5152
# grab just the file ending in the hash, not the file ending in ".d"
5253
TEST=$(find target/debug/deps -maxdepth 1 -type f -name 'baseline-*' -exec ls -t {} + | grep -v -E '.*\.d$' | head -1)
53-
mv "$TEST" 'out/baseline'
54+
mv "${TEST}" 'out/baseline'
5455

5556
banner 'archive'
5657

57-
cd "$WORK/ci"
58+
cd "${WORK}/ci"
5859
cat <<EOF > exclude-file.txt
5960
testbed/.git
6061
testbed/a4x2
6162
testbed/archive
6263
testbed/target
6364
EOF
6465
tar cvzXf exclude-file.txt \
65-
"$WORK/testbed.tar.gz" \
66+
"${WORK}/testbed.tar.gz" \
6667
testbed
6768

6869
banner 'dhcp-server'
6970

70-
git clone https://github.com/oxidecomputer/omicron.git "$WORK/ci/omicron"
71-
cd "$WORK/ci/omicron"
71+
git clone https://github.com/oxidecomputer/omicron.git "${WORK}/ci/omicron"
72+
cd "${WORK}/ci/omicron"
73+
# shellcheck source=/dev/null
7274
source env.sh
73-
if [[ $CI == true ]]; then
75+
if [[ ${CI:-} == true ]]; then
76+
# shellcheck source=/dev/null
7477
source .github/buildomat/ci-env.sh
7578
./tools/install_builder_prerequisites.sh -y
7679
fi
7780
cargo build -p end-to-end-tests --bin dhcp-server --release
78-
cp target/release/dhcp-server "$WORK/"
81+
cp target/release/dhcp-server "${WORK}/"

.github/buildomat/jobs/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ ptime -m cargo build --release
7474

7575
for x in debug release
7676
do
77-
mkdir -p /work/$x
78-
cp target/$x/ddmd /work/$x/ddmd
79-
cp target/$x/ddmadm /work/$x/ddmadm
80-
cp target/$x/mgd /work/$x/mgd
81-
cp target/$x/mgadm /work/$x/mgadm
77+
mkdir -p /work/"${x}"
78+
cp target/"${x}"/ddmd /work/"${x}"/ddmd
79+
cp target/"${x}"/ddmadm /work/"${x}"/ddmadm
80+
cp target/"${x}"/mgd /work/"${x}"/mgd
81+
cp target/"${x}"/mgadm /work/"${x}"/mgadm
8282
done
8383

8484
cp target/release/falcon-lab /work/release/falcon-lab

.github/buildomat/jobs/falcon-lab.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,40 @@
44
#: variety = "basic"
55
#: target = "lab-2.0-gimlet"
66
#: skip_clone = true
7-
#:
7+
#: output_rules = [
8+
#: "/work/*",
9+
#: ]
10+
#:
811
#: [dependencies.build-interop]
912
#: job = "build-interop"
10-
#:
13+
#:
1114
#: [dependencies.build]
1215
#: job = "build"
1316
#:
1417

1518
set -x
1619
set -e
20+
set -o pipefail
1721

1822
banner 'zpool'
1923

2024
# pick the largest disk available
2125
DISK=$(pfexec diskinfo -pH | sort -k8 -n -r | head -1 | awk '{print $2}')
2226
export DISK
23-
pfexec zpool create -o ashift=12 -f cpool "$DISK"
27+
pfexec zpool create -o ashift=12 -f cpool "${DISK}"
2428
pfexec zfs create -o mountpoint=/ci cpool/ci
2529

26-
if [[ $(curl -s http://catacomb.eng.oxide.computer:12346/trim-me) =~ "true" ]]; then
30+
trim_response=$(curl -s http://catacomb.eng.oxide.computer:12346/trim-me)
31+
if [[ ${trim_response} =~ "true" ]]; then
2732
pfexec zpool trim cpool
28-
while [[ ! $(zpool status -t cpool) =~ "100%" ]]; do sleep 10; done
33+
while true; do
34+
trim_status=$(zpool status -t cpool)
35+
[[ ${trim_status} =~ "100%" ]] && break
36+
sleep 10
37+
done
2938
fi
3039

31-
pfexec chown "$UID" /ci
40+
pfexec chown "${UID}" /ci
3241
cd /ci
3342
export FALCON_DATASET="cpool/falcon"
3443

@@ -50,8 +59,8 @@ export EXT_INTERFACE=${EXT_INTERFACE:-igb0}
5059
first=$(bmat address ls -f extra -Ho first)
5160
last=$(bmat address ls -f extra -Ho last)
5261
gw=$(bmat address ls -f extra -Ho gateway)
53-
server=$(ipadm show-addr "$EXT_INTERFACE"/dhcp -po ADDR | sed 's#/.*##g')
54-
pfexec ./dhcp-server "$first" "$last" "$gw" "$server" &> /work/dhcp-server.log &
62+
server=$(ipadm show-addr "${EXT_INTERFACE}"/dhcp -po ADDR | sed 's#/.*##g')
63+
pfexec ./dhcp-server "${first}" "${last}" "${gw}" "${server}" &> /work/dhcp-server.log &
5564

5665
RUST_LOG=debug pfexec ./falcon-lab run \
5766
trio-unnumbered

.github/buildomat/jobs/image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ tar tvfz out/mg-ddm-gz.tar
5858

5959
banner copy
6060
pfexec mkdir -p /out
61-
pfexec chown "$UID" /out
61+
pfexec chown "${UID}" /out
6262
mv out/mg-ddm-gz.tar /out/mg-ddm-gz.tar
6363
mv out/mg-ddm.tar.gz /out/mg-ddm.tar.gz
6464
mv out/mgd.tar.gz /out/mgd.tar.gz

.github/buildomat/jobs/linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#:
33
#: name = "linux"
44
#: variety = "basic"
5-
#: target = "ubuntu-22.04"
5+
#: target = "ubuntu-24.04"
66
#: rust_toolchain = "stable"
77
#: output_rules = [
88
#: "/work/debug/*",
@@ -61,7 +61,7 @@ function digest {
6161
}
6262

6363
banner "packages"
64-
sudo apt update -y
64+
sudo apt update
6565
sudo apt install -y pkg-config libssl-dev
6666

6767
mkdir -p /work/debug

.github/buildomat/jobs/p5p.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pushd pkg
3737

3838
banner copy
3939
pfexec mkdir -p /out
40-
pfexec chown "$UID" /out
40+
pfexec chown "${UID}" /out
4141
PKG_NAME="/out/mg.p5p"
42-
mv packages/repo/*.p5p "$PKG_NAME"
43-
sha256sum "$PKG_NAME" > "$PKG_NAME.sha256"
42+
mv packages/repo/*.p5p "${PKG_NAME}"
43+
sha256sum "${PKG_NAME}" > "${PKG_NAME}.sha256"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
#:
3+
#: name = "shellcheck"
4+
#: variety = "basic"
5+
#: target = "ubuntu-24.04"
6+
7+
banner "packages"
8+
sudo apt update
9+
sudo apt install -y shellcheck
10+
11+
banner "shellcheck"
12+
failed=0
13+
for script in .github/buildomat/jobs/*.sh; do
14+
if ! shellcheck -x -o all "${script}"; then
15+
echo "${script} failed shellcheck" >&2
16+
failed=1
17+
fi
18+
done
19+
(( failed == 0 )) || exit 1

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ set -e
1515
source .github/buildomat/test-common.sh
1616
pushd bgp
1717
pfexec cargo nextest run -p bgp -p mg-api-types -p mg-api-types-versions
18-
cp *.log /work/
18+
cp ./*.log /work/
1919
popd
2020

2121
pushd mgd
2222
pfexec cargo nextest run -p mgd -p mg-api-types -p mg-api-types-versions
23-
cp *.log /work/
23+
cp ./*.log /work/
2424
popd

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

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,57 +18,58 @@
1818

1919
set -x
2020
set -e
21+
set -o pipefail
2122

2223
ssh() {
23-
if [ -z "$SSH_BIN" ]; then
24-
SSH_BIN=$(which ssh)
24+
if [[ -z "${SSH_BIN}" ]]; then
25+
SSH_BIN=$(command -v ssh)
2526
fi
2627

27-
$SSH_BIN -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"
28+
${SSH_BIN} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"
2829
}
2930

3031
scp() {
31-
if [ -z "$SCP_BIN" ]; then
32-
SCP_BIN=$(which scp)
32+
if [[ -z "${SCP_BIN}" ]]; then
33+
SCP_BIN=$(command -v scp)
3334
fi
3435

35-
$SCP_BIN -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"
36+
${SCP_BIN} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"
3637
}
3738

3839
net_info() {
3940
#
4041
# grab command output to see what's going on from the buildomat logs
4142
#
42-
if [ -z "$ARISTA_IP" ]; then
43+
if [[ -z "${ARISTA_IP}" ]]; then
4344
ARISTA_IF=$(pfexec ./interop exec arista "ip -4 -j route show default | jq '.[0][\"dev\"]' | tr -d '\"'")
44-
ARISTA_IP=$(pfexec ./interop exec arista "ip -4 -br -j addr show dev $ARISTA_IF | jq '.[0][\"addr_info\"][0][\"local\"]' | tr -d '\"'")
45+
ARISTA_IP=$(pfexec ./interop exec arista "ip -4 -br -j addr show dev ${ARISTA_IF} | jq '.[0][\"addr_info\"][0][\"local\"]' | tr -d '\"'")
4546
fi
46-
ssh root@"$ARISTA_IP" "docker exec -t ceos1 Cli -c 'show ip interface brief | no-more'"
47-
ssh root@"$ARISTA_IP" "docker exec -t ceos1 Cli -c 'show ip bgp summary | no-more'"
48-
ssh root@"$ARISTA_IP" "docker exec -t ceos1 Cli -c 'show ip bgp | no-more'"
49-
ssh root@"$ARISTA_IP" "docker exec -t ceos1 Cli -c 'show ip route | no-more'"
47+
ssh root@"${ARISTA_IP}" "docker exec -t ceos1 Cli -c 'show ip interface brief | no-more'"
48+
ssh root@"${ARISTA_IP}" "docker exec -t ceos1 Cli -c 'show ip bgp summary | no-more'"
49+
ssh root@"${ARISTA_IP}" "docker exec -t ceos1 Cli -c 'show ip bgp | no-more'"
50+
ssh root@"${ARISTA_IP}" "docker exec -t ceos1 Cli -c 'show ip route | no-more'"
5051

51-
if [ -z "$JUNIPER_IP" ]; then
52+
if [[ -z "${JUNIPER_IP}" ]]; then
5253
JUNIPER_IF=$(pfexec ./interop exec juniper "ip -j route show default | jq '.[0][\"dev\"]' | tr -d '\"'")
53-
JUNIPER_IP=$(pfexec ./interop exec juniper "ip -4 -br -j addr show dev $JUNIPER_IF | jq '.[0][\"addr_info\"][0][\"local\"]' | tr -d '\"'")
54+
JUNIPER_IP=$(pfexec ./interop exec juniper "ip -4 -br -j addr show dev ${JUNIPER_IF} | jq '.[0][\"addr_info\"][0][\"local\"]' | tr -d '\"'")
5455
fi
55-
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cli -c 'show interfaces terse | no-more'"
56-
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cli -c 'show bgp summary | no-more'"
57-
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cli -c 'show route | no-more'"
56+
ssh root@"${JUNIPER_IP}" "docker exec -t crpd1 cli -c 'show interfaces terse | no-more'"
57+
ssh root@"${JUNIPER_IP}" "docker exec -t crpd1 cli -c 'show bgp summary | no-more'"
58+
ssh root@"${JUNIPER_IP}" "docker exec -t crpd1 cli -c 'show route | no-more'"
5859

59-
if [ -z "$MGD_IP" ]; then
60+
if [[ -z "${MGD_IP}" ]]; then
6061
MGD_IF=$(pfexec ./interop exec mgd "route get -inet default | grep interface | awk '{print \$NF}'")
61-
MGD_IP=$(pfexec ./interop exec mgd "ipadm show-addr $MGD_IF/v4 -p -o addr | cut -d / -f 1")
62+
MGD_IP=$(pfexec ./interop exec mgd "ipadm show-addr ${MGD_IF}/v4 -p -o addr | cut -d / -f 1")
6263
fi
63-
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status neighbors 65100"
64-
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm rib status imported"
65-
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm rib status selected"
66-
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status exported 65100"
64+
ssh root@"${MGD_IP}" "/opt/cargo-bay/mgadm bgp status neighbors 65100"
65+
ssh root@"${MGD_IP}" "/opt/cargo-bay/mgadm rib status imported"
66+
ssh root@"${MGD_IP}" "/opt/cargo-bay/mgadm rib status selected"
67+
ssh root@"${MGD_IP}" "/opt/cargo-bay/mgadm bgp status exported 65100"
6768
}
6869

6970
_exit_trap() {
7071
local status=$?
71-
[[ $status -eq 0 ]] && exit 0
72+
[[ ${status} -eq 0 ]] && exit 0
7273

7374
set +o errexit
7475

@@ -103,25 +104,25 @@ _exit_trap() {
103104
# grab platform-specific logs
104105
# variables set in prior call to net_info
105106
#
106-
ssh root@"$ARISTA_IP" "cp /tmp/init.log /tmp/arista.init.log"
107-
ssh root@"$ARISTA_IP" "docker ps -a > /tmp/arista.docker-ps.log"
108-
ssh root@"$ARISTA_IP" "docker logs ceos1 > /tmp/arista.docker.logs"
109-
ssh root@"$ARISTA_IP" "docker exec -t ceos1 cat /var/log/account.log > /tmp/arista.account.log"
110-
ssh root@"$ARISTA_IP" "docker exec -t ceos1 cat /var/log/messages > /tmp/arista.messages"
111-
ssh root@"$ARISTA_IP" "docker exec -t ceos1 cat /var/log/nginx-error.log > /tmp/arista.nginx-error.log"
112-
ssh root@"$ARISTA_IP" "docker exec -t ceos1 cat /var/log/nginx-access.log > /tmp/arista.nginx-access.log"
113-
scp root@"$ARISTA_IP":/tmp/*.log /work
114-
115-
ssh root@"$JUNIPER_IP" "cp /tmp/init.log /tmp/juniper.init.log"
116-
ssh root@"$JUNIPER_IP" "docker ps -a > /tmp/juniper.docker-ps.log"
117-
ssh root@"$JUNIPER_IP" "docker logs crpd1 > /tmp/juniper.docker-logs.log"
118-
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cat /var/log/messages > /tmp/juniper-messages.log"
119-
ssh root@"$JUNIPER_IP" "docker exec -t crpd1 cat /var/log/na-grpcd > /tmp/juniper-na-grpcd.log"
120-
scp root@"$JUNIPER_IP":/tmp/*.log /work
107+
ssh root@"${ARISTA_IP}" "cp /tmp/init.log /tmp/arista.init.log"
108+
ssh root@"${ARISTA_IP}" "docker ps -a > /tmp/arista.docker-ps.log"
109+
ssh root@"${ARISTA_IP}" "docker logs ceos1 > /tmp/arista.docker.logs"
110+
ssh root@"${ARISTA_IP}" "docker exec -t ceos1 cat /var/log/account.log > /tmp/arista.account.log"
111+
ssh root@"${ARISTA_IP}" "docker exec -t ceos1 cat /var/log/messages > /tmp/arista.messages"
112+
ssh root@"${ARISTA_IP}" "docker exec -t ceos1 cat /var/log/nginx-error.log > /tmp/arista.nginx-error.log"
113+
ssh root@"${ARISTA_IP}" "docker exec -t ceos1 cat /var/log/nginx-access.log > /tmp/arista.nginx-access.log"
114+
scp root@"${ARISTA_IP}":/tmp/*.log /work
115+
116+
ssh root@"${JUNIPER_IP}" "cp /tmp/init.log /tmp/juniper.init.log"
117+
ssh root@"${JUNIPER_IP}" "docker ps -a > /tmp/juniper.docker-ps.log"
118+
ssh root@"${JUNIPER_IP}" "docker logs crpd1 > /tmp/juniper.docker-logs.log"
119+
ssh root@"${JUNIPER_IP}" "docker exec -t crpd1 cat /var/log/messages > /tmp/juniper-messages.log"
120+
ssh root@"${JUNIPER_IP}" "docker exec -t crpd1 cat /var/log/na-grpcd > /tmp/juniper-na-grpcd.log"
121+
scp root@"${JUNIPER_IP}":/tmp/*.log /work
121122

122123
# /tmp filepaths chosen in testbed/interop/src/interop.rs and testbed/interop/cargo-bay/mgd/init.sh
123-
ssh root@"$MGD_IP" "cp /tmp/init.log /tmp/mgd.init.log"
124-
scp root@"$MGD_IP":/tmp/{mgd.init,mgd}.log /work
124+
ssh root@"${MGD_IP}" "cp /tmp/init.log /tmp/mgd.init.log"
125+
scp root@"${MGD_IP}":/tmp/{mgd.init,mgd}.log /work
125126

126127
find /work -ls
127128

@@ -139,15 +140,20 @@ banner 'zpool'
139140
# pick the largest disk available
140141
DISK=$(pfexec diskinfo -pH | sort -k8 -n -r | head -1 | awk '{print $2}')
141142
export DISK
142-
pfexec zpool create -o ashift=12 -f cpool "$DISK"
143+
pfexec zpool create -o ashift=12 -f cpool "${DISK}"
143144
pfexec zfs create -o mountpoint=/ci cpool/ci
144145

145-
if [[ $(curl -s http://catacomb.eng.oxide.computer:12346/trim-me) =~ "true" ]]; then
146+
trim_response=$(curl -s http://catacomb.eng.oxide.computer:12346/trim-me)
147+
if [[ ${trim_response} =~ "true" ]]; then
146148
pfexec zpool trim cpool
147-
while [[ ! $(zpool status -t cpool) =~ "100%" ]]; do sleep 10; done
149+
while true; do
150+
trim_status=$(zpool status -t cpool)
151+
[[ ${trim_status} =~ "100%" ]] && break
152+
sleep 10
153+
done
148154
fi
149155

150-
pfexec chown "$UID" /ci
156+
pfexec chown "${UID}" /ci
151157
cd /ci
152158
export FALCON_DATASET="cpool/falcon"
153159

@@ -158,8 +164,8 @@ tar xvfz /input/build-interop/work/testbed.tar.gz
158164
mkdir -p image/mgd
159165
(cd image/mgd && tar xvfz /input/image/out/mgd.tar.gz)
160166
for bin in mgadm mgd; do
161-
mv "image/mgd/root/opt/oxide/mgd/bin/$bin" \
162-
"testbed/interop/cargo-bay/mgd/$bin"
167+
mv "image/mgd/root/opt/oxide/mgd/bin/${bin}" \
168+
"testbed/interop/cargo-bay/mgd/${bin}"
163169
done
164170
cd testbed
165171
mkdir -p target/debug
@@ -175,14 +181,14 @@ chmod +x dhcp-server
175181
first=$(bmat address ls -f extra -Ho first)
176182
last=$(bmat address ls -f extra -Ho last)
177183
gw=$(bmat address ls -f extra -Ho gateway)
178-
server=$(ipadm show-addr "$EXT_INTERFACE"/dhcp -po ADDR | sed 's#/.*##g')
179-
pfexec ./dhcp-server "$first" "$last" "$gw" "$server" &> /work/dhcp-server.log &
184+
server=$(ipadm show-addr "${EXT_INTERFACE}"/dhcp -po ADDR | sed 's#/.*##g')
185+
pfexec ./dhcp-server "${first}" "${last}" "${gw}" "${server}" &> /work/dhcp-server.log &
180186

181187
banner 'launch'
182188

183189
cd interop
184190
pfexec ./interop launch
185-
cp *.log /work/
191+
cp ./*.log /work/
186192

187193
banner 'status'
188194

0 commit comments

Comments
 (0)