mirror of
https://github.com/andreicscs/HoneyWire
synced 2026-06-26 12:39:53 +00:00
removed legacy versioning logic for the version endpoint and deleted version file, update docs to reflect changes
This commit is contained in:
@@ -1,83 +0,0 @@
|
||||
name: Manual Beta Hub Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-push-hub:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# -----------------------------------------------------
|
||||
# 1. ENVIRONMENT SETUP
|
||||
# -----------------------------------------------------
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.25'
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
# -----------------------------------------------------
|
||||
# 2. BUILD, TEST, AND PUSH
|
||||
# -----------------------------------------------------
|
||||
- name: Build, Test, and Push Hub
|
||||
run: |
|
||||
# ANSI Color Codes
|
||||
RESET='\033[0m'
|
||||
BOLD='\033[1m'
|
||||
CYAN='\033[0;36m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[0;33m'
|
||||
RED='\033[0;31m'
|
||||
DIM='\033[2m'
|
||||
|
||||
# ---> CHANGED TARGET TO BETA REGISTRY AND 'LATEST' TAG <---
|
||||
TAG="192.168.1.17:5000/honeywire-hub:latest"
|
||||
|
||||
echo -e "${BOLD}Targeting component: HoneyWire Hub${RESET}"
|
||||
|
||||
echo -e "\n${CYAN}========================================${RESET}"
|
||||
echo -e "${CYAN}${BOLD}STAGE 1: Build Vue Frontend${RESET}"
|
||||
echo -e "${CYAN}========================================${RESET}"
|
||||
|
||||
echo -e "${DIM}Installing Node dependencies...${RESET}"
|
||||
cd Hub/ui
|
||||
npm ci
|
||||
echo -e "${DIM}Compiling Vue application for embedding...${RESET}"
|
||||
npm run build
|
||||
cd ../..
|
||||
|
||||
echo -e "\n${CYAN}========================================${RESET}"
|
||||
echo -e "${CYAN}${BOLD}STAGE 2: Go Unit Tests${RESET}"
|
||||
echo -e "${CYAN}========================================${RESET}"
|
||||
|
||||
echo -e "${DIM}Running Hub backend tests...${RESET}"
|
||||
cd Hub
|
||||
# go test -v ./...
|
||||
echo -e "${YELLOW}Tests are currently pending implementation. Skipping...${RESET}"
|
||||
cd ..
|
||||
|
||||
echo -e "\n${CYAN}========================================${RESET}"
|
||||
echo -e "${CYAN}${BOLD}STAGE 3: Building Image -> $TAG${RESET}"
|
||||
echo -e "${CYAN}========================================${RESET}"
|
||||
|
||||
echo -e "${DIM}Running Docker build for the Hub...${RESET}"
|
||||
docker build -t "$TAG" ./Hub
|
||||
|
||||
echo -e "\n${CYAN}========================================${RESET}"
|
||||
echo -e "${CYAN}${BOLD}STAGE 4: Pushing Image${RESET}"
|
||||
echo -e "${CYAN}========================================${RESET}"
|
||||
|
||||
echo -e "${DIM}Pushing to Beta registry...${RESET}"
|
||||
if docker push "$TAG"; then
|
||||
echo -e "\n${GREEN}✅ Hub Build and Push Complete!${RESET}"
|
||||
else
|
||||
echo -e "\n${RED}❌ Failed to push the Hub image!${RESET}"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,146 +0,0 @@
|
||||
name: Manual Beta Sensor Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
sensor:
|
||||
description: "Exact folder name (e.g.FileCanary, TcpTarpit, NetworkScanDetector, WebRouterDecoy) or 'all'"
|
||||
required: true
|
||||
default: "all"
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-test-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# -----------------------------------------------------
|
||||
# 1. ENVIRONMENT SETUP
|
||||
# -----------------------------------------------------
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Setup Python (For MockHub)
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
# -----------------------------------------------------
|
||||
# 2. BUILD, TEST, AND PUSH
|
||||
# -----------------------------------------------------
|
||||
|
||||
- name: Build, Test, and Push Sensors
|
||||
env:
|
||||
SENSOR_INPUT: ${{ inputs.sensor }}
|
||||
run: |
|
||||
# ANSI Color Codes
|
||||
RESET='\033[0m'
|
||||
BOLD='\033[1m'
|
||||
CYAN='\033[0;36m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[0;33m'
|
||||
RED='\033[0;31m'
|
||||
DIM='\033[2m'
|
||||
|
||||
INPUT="$SENSOR_INPUT"
|
||||
if [ -z "$INPUT" ] || [ "$INPUT" == "all" ]; then
|
||||
DIRS=$(find Sensors/official -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)
|
||||
else
|
||||
DIRS="$INPUT"
|
||||
fi
|
||||
|
||||
echo -e "${BOLD}Targeting sensors: $DIRS${RESET}"
|
||||
|
||||
pkill -f scripts/mock_hub.py || true
|
||||
|
||||
echo -e "${DIM}Starting MockHub in background...${RESET}"
|
||||
python scripts/mock_hub.py &
|
||||
MOCK_PID=$!
|
||||
sleep 2
|
||||
|
||||
for SENSOR in $DIRS; do
|
||||
if [ -n "$SENSOR" ]; then
|
||||
SENSOR_PATH="Sensors/official/$SENSOR"
|
||||
LOWER_NAME=$(echo "$SENSOR" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# ---> CHANGED TARGET TO BETA REGISTRY AND 'LATEST' TAG <---
|
||||
TAG="192.168.1.17:5000/honeywire-$LOWER_NAME:latest"
|
||||
|
||||
echo -e "\n${CYAN}========================================${RESET}"
|
||||
echo -e "${CYAN}${BOLD}STAGE 1: Go Unit Tests for $SENSOR${RESET}"
|
||||
echo -e "${CYAN}========================================${RESET}"
|
||||
|
||||
cd "$SENSOR_PATH"
|
||||
go test -v ./...
|
||||
cd - > /dev/null
|
||||
|
||||
echo -e "\n${CYAN}========================================${RESET}"
|
||||
echo -e "${CYAN}${BOLD}STAGE 2: Building Image -> $TAG${RESET}"
|
||||
echo -e "${CYAN}========================================${RESET}"
|
||||
|
||||
docker build -t "$TAG" -f "$SENSOR_PATH/Dockerfile" .
|
||||
|
||||
echo -e "\n${CYAN}========================================${RESET}"
|
||||
echo -e "${CYAN}${BOLD}STAGE 3: MockHub Contract Test${RESET}"
|
||||
echo -e "${CYAN}========================================${RESET}"
|
||||
|
||||
rm -f /tmp/test_passed
|
||||
|
||||
RUNNER_NET=$(docker network ls --format '{{.Name}}' | grep -E 'GITEA-ACTIONS|act-|github_network' | head -n 1 || true)
|
||||
if [ -n "$RUNNER_NET" ]; then
|
||||
NET_OPT="--network $RUNNER_NET"
|
||||
RUNNER_IP=$(hostname -I 2>/dev/null | awk '{print $1}' || hostname -i | awk '{print $1}')
|
||||
HUB_ENDPOINT="http://$RUNNER_IP:8080"
|
||||
echo -e "${DIM}Detected Containerized CI Runner. Linking MockHub via network: $RUNNER_NET ($RUNNER_IP)${RESET}"
|
||||
else
|
||||
NET_OPT="--network host"
|
||||
HUB_ENDPOINT="http://127.0.0.1:8080"
|
||||
echo -e "${DIM}Detected VM CI Runner. Linking MockHub via localhost.${RESET}"
|
||||
fi
|
||||
|
||||
echo -e "${DIM}Launching test container...${RESET}"
|
||||
docker rm -f test-sensor 2>/dev/null || true
|
||||
docker run -d --name test-sensor \
|
||||
-e HW_HUB_ENDPOINT=$HUB_ENDPOINT \
|
||||
-e HW_HUB_KEY=ci-test-key \
|
||||
-e HW_SENSOR_ID=ci-test-sensor \
|
||||
-e HW_TEST_MODE=true \
|
||||
$NET_OPT "$TAG"
|
||||
|
||||
TIMEOUT=30
|
||||
TEST_PASSED=false
|
||||
|
||||
echo -e "${YELLOW}Waiting up to $TIMEOUT seconds for sensor to sync and send valid event...${RESET}"
|
||||
while [ $TIMEOUT -gt 0 ]; do
|
||||
if [ -f /tmp/test_passed ] && grep -q 'success' /tmp/test_passed; then
|
||||
TEST_PASSED=true
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
TIMEOUT=$((TIMEOUT-1))
|
||||
done
|
||||
|
||||
echo -e "${DIM}Cleaning up test container...${RESET}"
|
||||
docker stop test-sensor || true
|
||||
|
||||
if [ "$TEST_PASSED" = true ]; then
|
||||
echo -e "${GREEN}✅ Integration Test Passed! Pushing image to registry...${RESET}"
|
||||
docker push "$TAG"
|
||||
docker rm -f test-sensor || true
|
||||
else
|
||||
echo -e "${RED}❌ Integration Test Failed or Timed Out!${RESET}"
|
||||
echo -e "${YELLOW}--- Sensor Container Logs ---${RESET}"
|
||||
docker logs test-sensor || true
|
||||
docker rm -f test-sensor || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
kill $MOCK_PID || true
|
||||
@@ -37,7 +37,7 @@ func Load() *Config {
|
||||
DashboardPassword: getEnv("HW_DASHBOARD_PASSWORD", ""),
|
||||
DBPath: getEnv("HW_DB_PATH", "honeywire.db"),
|
||||
Port: getEnv("HW_PORT", "8080"),
|
||||
Version: getEnv("HW_VERSION", "1.1.0"),
|
||||
Version: models.HubVersion,
|
||||
Env: getEnv("HW_ENV", "production"),
|
||||
TrustProxy: isProxyTrusted,
|
||||
}
|
||||
|
||||
@@ -166,8 +166,7 @@ Run `honeywire firedrill` to make the HoneyWires send a mock event to the hub to
|
||||
|
||||
## Versioning and API Reference
|
||||
|
||||
- HoneyWire uses a single source of truth version file: `VERSION` in the repo root.
|
||||
- The runtime version is exposed via an env override: `HW_VERSION` (Hub + Sensors), which defaults to `VERSION`.
|
||||
- HoneyWire versions are managed via Git Tags.
|
||||
- `Hub` endpoint:
|
||||
- `GET /api/v1/version` → returns `{ "version": "2.0.0" }`
|
||||
- `GET /api/v1/version` → returns `{ "version": "v2.0.0" }`
|
||||
- API docs file: [API.md](./Docs/architecture/hub/backend/API.md) with full backend route reference and sample payloads.
|
||||
Reference in New Issue
Block a user