- fix: add missing ClickHouse driver dependency - fix: resolve race condition in orchestrator (single goroutine per source) - feat: add explicit source_type config for Unix socket sources - test: improve coverage from 50.6% to 62.0% - docs: add CHANGELOG.md with release notes - build: update version to 1.0.2 in build scripts and Dockerfiles Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
78 lines
2.8 KiB
Bash
Executable File
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.2}"
|
|
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 ""
|