Files
logcorrelator/build.sh
Jacquin Antoine 514cb553ef feat: release v1.0.3 with flattened JSON output structure
- breaking: remove apache and network subdivisions from JSON output
- feat: all log fields now merged into single-level JSON structure
- feat: custom MarshalJSON() implementation for flat output
- chore: update ClickHouse schema to use single fields JSON column
- docs: update CHANGELOG.md and README.md with v1.0.3 changes
- build: bump version to 1.0.3 in build.sh and RPM spec

Migration notes:
- Existing ClickHouse tables need schema migration to use fields JSON column
- Replace apache JSON and network JSON columns with fields JSON column

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-28 22:26:20 +01:00

78 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# Build script - everything runs in Docker containers
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
VERSION="${VERSION:-1.0.3}"
OUTPUT_DIR="${SCRIPT_DIR}/dist"
echo "=============================================="
echo " logcorrelator - Docker Build Pipeline"
echo "=============================================="
echo ""
# Create output directory
mkdir -p "${OUTPUT_DIR}"
# Step 1: Build and test
echo "[1/4] Building and running tests in container..."
docker build \
--target builder \
-t logcorrelator-builder:latest \
-f Dockerfile .
# Step 2: Build runtime image
echo "[2/4] Building runtime image..."
docker build \
--target runtime \
-t logcorrelator:${VERSION} \
-t logcorrelator:latest \
-f Dockerfile .
# Step 3: Build RPM packages
echo "[3/4] Building RPM packages in container..."
docker build \
--target output \
--build-arg VERSION="${VERSION}" \
-t logcorrelator-packager:latest \
-f Dockerfile.package .
# Extract packages from builder container
echo "[4/4] Extracting packages..."
mkdir -p "${OUTPUT_DIR}/rpm/rocky8" "${OUTPUT_DIR}/rpm/rocky9" "${OUTPUT_DIR}/rpm/almalinux10"
docker run --rm -v "${OUTPUT_DIR}:/output" logcorrelator-packager:latest \
sh -c 'cp -r /packages/rpm/rocky8 /output/rpm/ && cp -r /packages/rpm/rocky9 /output/rpm/ && cp -r /packages/rpm/almalinux10 /output/rpm/'
echo ""
echo "=============================================="
echo " Build Complete!"
echo "=============================================="
echo ""
echo "Artifacts:"
echo " - Runtime image: logcorrelator:${VERSION}"
echo " - RPM Rocky 8: ${OUTPUT_DIR}/rpm/rocky8/logcorrelator-${VERSION}-1.el8.x86_64.rpm"
echo " - RPM Rocky 9: ${OUTPUT_DIR}/rpm/rocky9/logcorrelator-${VERSION}-1.el9.x86_64.rpm"
echo " - RPM AlmaLinux 10: ${OUTPUT_DIR}/rpm/almalinux10/logcorrelator-${VERSION}-1.el10.x86_64.rpm"
echo ""
echo "Usage:"
echo " # Run with Docker:"
echo " docker run -d --name logcorrelator \\"
echo " -v /var/run/logcorrelator:/var/run/logcorrelator \\"
echo " -v /var/log/logcorrelator:/var/log/logcorrelator \\"
echo " -v ./config.yml:/etc/logcorrelator/logcorrelator.yml \\"
echo " logcorrelator:latest"
echo ""
echo " # Install RPM on Rocky Linux 8/9:"
echo " sudo dnf install -y ${OUTPUT_DIR}/rpm/rocky8/logcorrelator-${VERSION}-1.el8.x86_64.rpm"
echo " sudo dnf install -y ${OUTPUT_DIR}/rpm/rocky9/logcorrelator-${VERSION}-1.el9.x86_64.rpm"
echo " sudo systemctl enable logcorrelator"
echo " sudo systemctl start logcorrelator"
echo ""
echo " # Install RPM on AlmaLinux 10:"
echo " sudo dnf install -y ${OUTPUT_DIR}/rpm/almalinux10/logcorrelator-${VERSION}-1.el10.x86_64.rpm"
echo " sudo systemctl enable logcorrelator"
echo " sudo systemctl start logcorrelator"
echo ""