mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-07 15:53:10 +00:00
Restore working bundle and run scripts
This commit is contained in:
parent
35f3188ad4
commit
a5498068ba
@ -116,11 +116,5 @@ cp "${HOST_EXEC_BIN}" "${bundle_dir}/artifacts/"
|
|||||||
cp "${HOST_CLI_BIN}" "${bundle_dir}/artifacts/"
|
cp "${HOST_CLI_BIN}" "${bundle_dir}/artifacts/"
|
||||||
|
|
||||||
mkdir -p "$(dirname "${OUTPUT}")"
|
mkdir -p "$(dirname "${OUTPUT}")"
|
||||||
if tar --help 2>/dev/null | grep -q -- '--no-mac-metadata'; then
|
|
||||||
tar --no-mac-metadata --no-xattrs -czf "${OUTPUT}" -C "${bundle_dir}" artifacts
|
tar --no-mac-metadata --no-xattrs -czf "${OUTPUT}" -C "${bundle_dir}" artifacts
|
||||||
elif tar --help 2>/dev/null | grep -q -- '--no-xattrs'; then
|
|
||||||
tar --no-xattrs -czf "${OUTPUT}" -C "${bundle_dir}" artifacts
|
|
||||||
else
|
|
||||||
tar -czf "${OUTPUT}" -C "${bundle_dir}" artifacts
|
|
||||||
fi
|
|
||||||
echo "Bundle created at ${OUTPUT}"
|
echo "Bundle created at ${OUTPUT}"
|
||||||
|
|||||||
@ -116,36 +116,10 @@ if [ -z "${DEMO_VALIDATORS}" ] || [ -z "${DEMO_EXECUTORS}" ]; then
|
|||||||
fail_with_usage "validators and executors must be provided via -v/--validators and -e/--executors"
|
fail_with_usage "validators and executors must be provided via -v/--validators and -e/--executors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
choose_tar_path() {
|
|
||||||
if [ -n "${NOMOS_BINARIES_TAR:-}" ]; then
|
|
||||||
echo "${NOMOS_BINARIES_TAR}"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [ "$MODE" = "host" ]; then
|
|
||||||
local candidate
|
|
||||||
candidate="$(ls "${ROOT_DIR}"/.tmp/nomos-binaries-host-*.tar.gz 2>/dev/null | head -n1 || true)"
|
|
||||||
if [ -n "$candidate" ]; then
|
|
||||||
echo "$candidate"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
local candidate
|
|
||||||
candidate="$(ls "${ROOT_DIR}"/.tmp/nomos-binaries-linux-*.tar.gz 2>/dev/null | head -n1 || true)"
|
|
||||||
if [ -n "$candidate" ]; then
|
|
||||||
echo "$candidate"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -f "${ROOT_DIR}/.tmp/nomos-binaries.tar.gz" ]; then
|
|
||||||
echo "${ROOT_DIR}/.tmp/nomos-binaries.tar.gz"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
restore_binaries_from_tar() {
|
restore_binaries_from_tar() {
|
||||||
local tar_path
|
local tar_path="${NOMOS_BINARIES_TAR:-${ROOT_DIR}/.tmp/nomos-binaries.tar.gz}"
|
||||||
tar_path="$(choose_tar_path)"
|
|
||||||
local extract_dir="${ROOT_DIR}/.tmp/nomos-binaries"
|
local extract_dir="${ROOT_DIR}/.tmp/nomos-binaries"
|
||||||
if [ -z "$tar_path" ] || [ ! -f "$tar_path" ]; then
|
if [ ! -f "$tar_path" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "==> Restoring binaries from ${tar_path}"
|
echo "==> Restoring binaries from ${tar_path}"
|
||||||
@ -181,24 +155,6 @@ restore_binaries_from_tar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ensure_host_binaries() {
|
ensure_host_binaries() {
|
||||||
host_bin_matches_arch() {
|
|
||||||
local bin_path="$1"
|
|
||||||
if [ ! -x "$bin_path" ]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
local info expected
|
|
||||||
info="$(file -b "$bin_path" 2>/dev/null || true)"
|
|
||||||
case "$(uname -m)" in
|
|
||||||
x86_64) expected="x86-64|x86_64" ;;
|
|
||||||
aarch64|arm64) expected="arm64|aarch64" ;;
|
|
||||||
*) expected="" ;;
|
|
||||||
esac
|
|
||||||
if [ -n "$expected" ] && echo "$info" | grep -Eqi "$expected"; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Build nomos-node/nomos-executor for the host if not already present.
|
# Build nomos-node/nomos-executor for the host if not already present.
|
||||||
HOST_SRC="${ROOT_DIR}/.tmp/nomos-node-host-src"
|
HOST_SRC="${ROOT_DIR}/.tmp/nomos-node-host-src"
|
||||||
HOST_TARGET="${ROOT_DIR}/.tmp/nomos-node-host-target"
|
HOST_TARGET="${ROOT_DIR}/.tmp/nomos-node-host-target"
|
||||||
@ -212,7 +168,7 @@ ensure_host_binaries() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if host_bin_matches_arch "${HOST_NODE_BIN_DEFAULT}" && host_bin_matches_arch "${HOST_EXEC_BIN_DEFAULT}"; then
|
if [ -x "${HOST_NODE_BIN_DEFAULT}" ] && [ -x "${HOST_EXEC_BIN_DEFAULT}" ]; then
|
||||||
echo "Host binaries already built at ${HOST_TARGET}"
|
echo "Host binaries already built at ${HOST_TARGET}"
|
||||||
NOMOS_NODE_BIN="${HOST_NODE_BIN_DEFAULT}"
|
NOMOS_NODE_BIN="${HOST_NODE_BIN_DEFAULT}"
|
||||||
NOMOS_EXECUTOR_BIN="${HOST_EXEC_BIN_DEFAULT}"
|
NOMOS_EXECUTOR_BIN="${HOST_EXEC_BIN_DEFAULT}"
|
||||||
@ -273,7 +229,7 @@ fi
|
|||||||
|
|
||||||
if [ "$MODE" != "host" ]; then
|
if [ "$MODE" != "host" ]; then
|
||||||
if [ "${RESTORED_BINARIES}" -ne 1 ]; then
|
if [ "${RESTORED_BINARIES}" -ne 1 ]; then
|
||||||
fail_with_usage "NOMOS_BINARIES_TAR not restored; compose/k8s require a bundle (scripts/build-bundle.sh --platform linux)"
|
echo "WARNING: NOMOS_BINARIES_TAR not restored; compose/k8s will rebuild binaries from source" >&2
|
||||||
fi
|
fi
|
||||||
if [ "${NOMOS_SKIP_IMAGE_BUILD:-0}" = "1" ]; then
|
if [ "${NOMOS_SKIP_IMAGE_BUILD:-0}" = "1" ]; then
|
||||||
echo "==> Skipping testnet image rebuild (NOMOS_SKIP_IMAGE_BUILD=1)"
|
echo "==> Skipping testnet image rebuild (NOMOS_SKIP_IMAGE_BUILD=1)"
|
||||||
@ -284,9 +240,7 @@ if [ "$MODE" != "host" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$MODE" = "host" ]; then
|
if [ "$MODE" = "host" ]; then
|
||||||
if [ "${RESTORED_BINARIES}" -ne 1 ]; then
|
if [ "${RESTORED_BINARIES}" -eq 1 ] && [ "$(uname -s)" = "Linux" ]; then
|
||||||
fail_with_usage "NOMOS_BINARIES_TAR not restored; host runs require a bundle (scripts/build-bundle.sh --platform host)"
|
|
||||||
fi
|
|
||||||
tar_node="${ROOT_DIR}/testing-framework/assets/stack/bin/nomos-node"
|
tar_node="${ROOT_DIR}/testing-framework/assets/stack/bin/nomos-node"
|
||||||
tar_exec="${ROOT_DIR}/testing-framework/assets/stack/bin/nomos-executor"
|
tar_exec="${ROOT_DIR}/testing-framework/assets/stack/bin/nomos-executor"
|
||||||
if [ -x "${tar_node}" ] && [ -x "${tar_exec}" ]; then
|
if [ -x "${tar_node}" ] && [ -x "${tar_exec}" ]; then
|
||||||
@ -295,7 +249,11 @@ if [ "$MODE" = "host" ]; then
|
|||||||
NOMOS_EXECUTOR_BIN="${tar_exec}"
|
NOMOS_EXECUTOR_BIN="${tar_exec}"
|
||||||
export NOMOS_NODE_BIN NOMOS_EXECUTOR_BIN
|
export NOMOS_NODE_BIN NOMOS_EXECUTOR_BIN
|
||||||
else
|
else
|
||||||
fail_with_usage "Restored NOMOS_BINARIES_TAR is missing host executables"
|
echo "Restored tarball missing executables for host; building host binaries..."
|
||||||
|
ensure_host_binaries
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
ensure_host_binaries
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user