f-55: lab: fichiers des nœuds sur un ISO dédié, envoi des binaires compilés en local #55

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-12 15:50:54 +02:00
commit aceffe7b58
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
16 changed files with 181 additions and 58 deletions

45
test/e2e/build.sh Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
E2E_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_DIR="$(cd "${E2E_DIR}/../.." && pwd)"
BIN_DIR="${BIN_DIR:-${E2E_DIR}/topologies/bin}"
BINARIES="agent dhcp metadata"
usage () {
cat >&2 <<USAGE
usage: ${0##*/} [--clean]
sans option : compile ${BINARIES} pour linux/amd64 depuis l'arbre courant dans ${BIN_DIR} ;
le prochain lab les installe par-dessus la release de la topologie
--clean : vide ${BIN_DIR} ; le prochain lab teste la release seule
USAGE
exit 2
}
clean () {
local binary
for binary in ${BINARIES}; do
rm -f "${BIN_DIR}/${binary}" || return 1
done
}
build () {
local binary
for binary in ${BINARIES}; do
echo "== ${binary}" >&2
(cd "${REPO_DIR}" && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "${BIN_DIR}/${binary}" "./cmd/${binary}") || return 1
done
(cd "${BIN_DIR}" && sha256sum ${BINARIES} 2>/dev/null || shasum -a 256 ${BINARIES})
}
main () {
case "${1:-}" in
"") build ;;
--clean) clean ;;
*) usage ;;
esac
}
if [[ "${BASH_SOURCE[0]}" == "${0}" || -z "${BASH_SOURCE[0]}" ]]; then
main "$@"
fi

View file

View file

@ -22,10 +22,10 @@ nodes:
hv1:
{ role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay],
addresses: { underlay: 192.168.14.11 }, frr: frr/hv1.conf, provision: provision/hypervisor.sh,
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml },
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin },
services: [agent.service] }
hv2:
{ role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay],
addresses: { underlay: 192.168.14.12 }, frr: frr/hv2.conf, provision: provision/hypervisor.sh,
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml },
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml, bin: bin },
services: [agent.service] }

View file

@ -22,15 +22,15 @@ nodes:
hv1:
{ role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay],
addresses: { underlay: 192.168.14.11 }, frr: frr/hv1.conf, provision: provision/hypervisor.sh,
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml },
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/two.yml, bin: bin },
services: [agent.service] }
hv2:
{ role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay],
addresses: { underlay: 192.168.14.12 }, frr: frr/hv2.conf, provision: provision/hypervisor.sh,
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml },
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml, bin: bin },
services: [agent.service] }
hv3:
{ role: host, image: debian12, cpus: 4, memory: 16384, segments: [underlay],
addresses: { underlay: 192.168.14.13 }, frr: frr/hv3.conf, provision: provision/hypervisor.sh,
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml },
post_provision: provision/hypervisor-post.sh, files: { agent.yml: agent/bgp.yml, bin: bin },
services: [agent.service] }

View file

@ -17,3 +17,10 @@ for script in deploy.sh bootstrap_kvm.sh; do
done
chmod 0755 deploy.sh bootstrap_kvm.sh
bash ./deploy.sh --noup_script -i -u "${LAB_UPLINK}" -t "${RELEASE}"
for binary in "${LAB_FILES}"/bin/*; do
[ -f "${binary}" ] || continue
name=$(basename "${binary}")
install -D -m 0755 "${binary}" "/opt/two/local/bin/${name}"
ln -sfn "/opt/two/local/bin/${name}" "/opt/two/bin/${name}"
echo "lab: ${name} compilé en local remplace celui de la release ${RELEASE}"
done