Files
pulse/build-release.sh
T
Pulse Monitor afcf9e4772 fix: properly address syslog spam on non-clustered nodes (#322)
- Mark deprecated poll functions that cause duplicate GetNodes() calls
- Add warnings when deprecated functions are called directly
- Previous fix only created WithNodes versions but didn't prevent the originals from being called
- This completes the fix started in commit fcd782370
- Reduces API calls and prevents certificate verification spam in syslog

The deprecated functions (pollVMs, pollContainers, pollStorage, pollStorageBackups)
still exist for backward compatibility but log warnings if called.
2025-08-17 17:03:48 +00:00

109 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build script for Pulse releases
# Creates release archives for different architectures
set -euo pipefail
# Use Go 1.23 if available
if [ -x /usr/local/go/bin/go ]; then
export PATH=/usr/local/go/bin:$PATH
fi
VERSION=${1:-$(cat VERSION)}
BUILD_DIR="build"
RELEASE_DIR="release"
echo "Building Pulse v${VERSION}..."
# Clean previous builds
rm -rf $BUILD_DIR $RELEASE_DIR
mkdir -p $BUILD_DIR $RELEASE_DIR
# Build frontend
echo "Building frontend..."
cd frontend-modern
npm ci
npm run build
cd ..
# Copy frontend to api directory for embedding
echo "Copying frontend for embedding..."
sudo rm -rf internal/api/frontend-modern
sleep 1 # Give filesystem time to sync
cp -r frontend-modern internal/api/
# Build for different architectures
declare -A builds=(
["linux-amd64"]="GOOS=linux GOARCH=amd64"
["linux-arm64"]="GOOS=linux GOARCH=arm64"
["linux-armv7"]="GOOS=linux GOARCH=arm GOARM=7"
)
for build_name in "${!builds[@]}"; do
echo "Building for $build_name..."
# Get build environment
build_env="${builds[$build_name]}"
# Build binary
env $build_env go build \
-ldflags="-s -w" \
-trimpath \
-o "$BUILD_DIR/pulse-$build_name" \
./cmd/pulse
# Create release archive with proper structure
tar_name="pulse-v${VERSION}-${build_name}.tar.gz"
# Create staging directory
staging_dir="$BUILD_DIR/staging-$build_name"
rm -rf "$staging_dir"
mkdir -p "$staging_dir/bin"
# Copy binary and VERSION file
cp "$BUILD_DIR/pulse-$build_name" "$staging_dir/bin/pulse"
echo "$VERSION" > "$staging_dir/VERSION"
# Create tarball from staging directory
cd "$staging_dir"
tar -czf "../../$RELEASE_DIR/$tar_name" .
cd ../..
# Cleanup staging
rm -rf "$staging_dir"
echo "Created $RELEASE_DIR/$tar_name"
done
# Create universal tarball with all binaries
echo "Creating universal tarball..."
universal_dir="$BUILD_DIR/universal"
rm -rf "$universal_dir"
mkdir -p "$universal_dir"
# Copy all binaries
for build_name in "${!builds[@]}"; do
cp "$BUILD_DIR/pulse-$build_name" "$universal_dir/"
done
# Add VERSION file
echo "$VERSION" > "$universal_dir/VERSION"
# Create universal tarball
cd "$universal_dir"
tar -czf "../../$RELEASE_DIR/pulse-v${VERSION}.tar.gz" .
cd ../..
# Cleanup
rm -rf "$universal_dir"
# Generate checksums
cd $RELEASE_DIR
sha256sum *.tar.gz > checksums.txt
cd ..
echo
echo "Release build complete!"
echo "Archives created in $RELEASE_DIR/"
ls -lh $RELEASE_DIR/