mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-09 05:24:49 +09:00
Merge pull request #4 from jhd3197/dev
Fix agent build pipeline and packaging for all platforms
This commit is contained in:
8 files changed
+65
-77
No files matched your search
@@ -280,8 +280,8 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ secrets.DOCKERHUB_USERNAME != '' }}
|
||||
tags: |
|
||||
serverkit/agent:latest
|
||||
serverkit/agent:${{ steps.version.outputs.version }}
|
||||
jhd3197/serverkit-agent:latest
|
||||
jhd3197/serverkit-agent:${{ steps.version.outputs.version }}
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
BUILD_TIME=${{ github.event.repository.updated_at }}
|
||||
@@ -368,8 +368,8 @@ jobs:
|
||||
|
||||
#### Docker
|
||||
```bash
|
||||
docker pull serverkit/agent:${{ steps.version.outputs.version }}
|
||||
docker pull serverkit/agent:latest
|
||||
docker pull jhd3197/serverkit-agent:${{ steps.version.outputs.version }}
|
||||
docker pull jhd3197/serverkit-agent:latest
|
||||
```
|
||||
|
||||
### Quick Install
|
||||
@@ -401,7 +401,7 @@ jobs:
|
||||
docker run -d --name serverkit-agent \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock:ro \
|
||||
-v serverkit-config:/etc/serverkit-agent \
|
||||
serverkit/agent:${{ steps.version.outputs.version }}
|
||||
jhd3197/serverkit-agent:${{ steps.version.outputs.version }}
|
||||
```
|
||||
|
||||
### Verification
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Binaries
|
||||
serverkit-agent
|
||||
serverkit-agent.exe
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Build output
|
||||
/dist/
|
||||
/output/
|
||||
/packages/
|
||||
|
||||
# Test binaries
|
||||
*.test
|
||||
*.test.exe
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
services:
|
||||
agent:
|
||||
image: serverkit/agent:latest
|
||||
image: jhd3197/serverkit-agent:latest
|
||||
container_name: serverkit-agent
|
||||
restart: unless-stopped
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
Build instructions:
|
||||
1. Install WiX Toolset v4
|
||||
2. Run: wix build Product.wxs -o serverkit-agent.msi
|
||||
2. Run: wix build Product.wxs -o serverkit-agent.msi -define Version=1.0.0
|
||||
-->
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<Package
|
||||
Name="ServerKit Agent"
|
||||
Manufacturer="ServerKit"
|
||||
Version="!(bind.FileVersion.ServerKitAgentExe)"
|
||||
Version="$(var.Version)"
|
||||
UpgradeCode="E8B7F3A2-4C5D-4E6F-8A9B-0C1D2E3F4A5B"
|
||||
Scope="perMachine">
|
||||
|
||||
@@ -30,42 +30,12 @@
|
||||
<!-- Media -->
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
||||
<!-- License -->
|
||||
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
|
||||
|
||||
<!-- UI -->
|
||||
<UI>
|
||||
<UIRef Id="WixUI_InstallDir" />
|
||||
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
|
||||
</UI>
|
||||
|
||||
<!-- Feature -->
|
||||
<Feature Id="ProductFeature" Title="ServerKit Agent" Level="1">
|
||||
<ComponentGroupRef Id="ProductComponents" />
|
||||
<ComponentRef Id="ServiceComponent" />
|
||||
<ComponentRef Id="ConfigComponent" />
|
||||
</Feature>
|
||||
|
||||
<!-- Custom Actions -->
|
||||
<CustomAction Id="StopService"
|
||||
Directory="INSTALLFOLDER"
|
||||
ExeCommand="[SystemFolder]net.exe stop ServerKitAgent"
|
||||
Execute="deferred"
|
||||
Impersonate="no"
|
||||
Return="ignore" />
|
||||
|
||||
<CustomAction Id="StartService"
|
||||
Directory="INSTALLFOLDER"
|
||||
ExeCommand="[SystemFolder]net.exe start ServerKitAgent"
|
||||
Execute="deferred"
|
||||
Impersonate="no"
|
||||
Return="ignore" />
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="StopService" Before="InstallFiles">
|
||||
Installed AND NOT UPGRADINGPRODUCTCODE
|
||||
</Custom>
|
||||
</InstallExecuteSequence>
|
||||
</Package>
|
||||
|
||||
<!-- Directory Structure -->
|
||||
@@ -89,40 +59,27 @@
|
||||
<Component Id="MainExecutable" Guid="A1B2C3D4-E5F6-7890-ABCD-EF1234567890">
|
||||
<File Id="ServerKitAgentExe"
|
||||
Source="serverkit-agent.exe"
|
||||
KeyPath="yes">
|
||||
<Shortcut Id="StartMenuShortcut"
|
||||
Directory="ProgramMenuFolder"
|
||||
Name="ServerKit Agent"
|
||||
Description="ServerKit Agent Management"
|
||||
WorkingDirectory="INSTALLFOLDER"
|
||||
Advertise="yes" />
|
||||
</File>
|
||||
KeyPath="yes" />
|
||||
<!-- Windows Service -->
|
||||
<ServiceInstall
|
||||
Id="ServiceInstall"
|
||||
Name="ServerKitAgent"
|
||||
DisplayName="ServerKit Agent"
|
||||
Description="ServerKit Agent - Remote server management service"
|
||||
Type="ownProcess"
|
||||
Start="auto"
|
||||
ErrorControl="normal"
|
||||
Arguments="start" />
|
||||
<ServiceControl
|
||||
Id="ServiceControl"
|
||||
Name="ServerKitAgent"
|
||||
Start="install"
|
||||
Stop="both"
|
||||
Remove="uninstall"
|
||||
Wait="yes" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
|
||||
<!-- Windows Service -->
|
||||
<Component Id="ServiceComponent" Directory="INSTALLFOLDER" Guid="B2C3D4E5-F6A7-8901-BCDE-F23456789012">
|
||||
<File Id="ServiceExe" Source="serverkit-agent.exe" KeyPath="yes" />
|
||||
<ServiceInstall
|
||||
Id="ServiceInstall"
|
||||
Name="ServerKitAgent"
|
||||
DisplayName="ServerKit Agent"
|
||||
Description="ServerKit Agent - Remote server management service"
|
||||
Type="ownProcess"
|
||||
Start="auto"
|
||||
ErrorControl="normal"
|
||||
Arguments="start">
|
||||
<ServiceDependency Id="Tcpip" />
|
||||
</ServiceInstall>
|
||||
<ServiceControl
|
||||
Id="ServiceControl"
|
||||
Name="ServerKitAgent"
|
||||
Start="install"
|
||||
Stop="both"
|
||||
Remove="uninstall"
|
||||
Wait="yes" />
|
||||
</Component>
|
||||
|
||||
<!-- Configuration -->
|
||||
<Component Id="ConfigComponent" Directory="AgentDataFolder" Guid="C3D4E5F6-A7B8-9012-CDEF-345678901234">
|
||||
<File Id="ConfigYaml" Source="config.yaml" KeyPath="yes" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Build .rpm package for ServerKit Agent
|
||||
# Usage: ./build.sh <version> <architecture> <binary_path>
|
||||
# Example: ./build.sh 1.0.0 x86_64 ../../dist/serverkit-agent-linux-amd64
|
||||
# Usage: ./build.sh <version> <architecture> <binary_path> <output_dir>
|
||||
# Example: ./build.sh 1.0.0 x86_64 ../../dist/serverkit-agent-linux-amd64 ./packages
|
||||
|
||||
set -e
|
||||
|
||||
@@ -10,6 +10,12 @@ ARCH="${2:-x86_64}"
|
||||
BINARY_PATH="${3:-../../dist/serverkit-agent-linux-amd64}"
|
||||
PACKAGE_NAME="serverkit-agent"
|
||||
|
||||
# Convert paths to absolute before any cd commands
|
||||
BINARY_PATH="$(cd "$(dirname "$BINARY_PATH")" && pwd)/$(basename "$BINARY_PATH")"
|
||||
OUTPUT_DIR="${4:-./output}"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
OUTPUT_DIR="$(cd "$OUTPUT_DIR" && pwd)"
|
||||
|
||||
# Map Go arch to RPM arch
|
||||
case "$ARCH" in
|
||||
amd64) RPM_ARCH="x86_64" ;;
|
||||
@@ -21,6 +27,7 @@ echo "Building .rpm package..."
|
||||
echo " Version: $VERSION"
|
||||
echo " Architecture: $RPM_ARCH"
|
||||
echo " Binary: $BINARY_PATH"
|
||||
echo " Output: $OUTPUT_DIR"
|
||||
|
||||
# Create build directory structure
|
||||
BUILD_ROOT="$(mktemp -d)"
|
||||
@@ -117,7 +124,6 @@ License: MIT
|
||||
URL: https://github.com/serverkit/serverkit
|
||||
Source0: serverkit-agent-%{version}.tar.gz
|
||||
|
||||
BuildArch: $RPM_ARCH
|
||||
Requires: ca-certificates
|
||||
|
||||
%description
|
||||
@@ -189,12 +195,10 @@ fi
|
||||
- Release $VERSION
|
||||
EOF
|
||||
|
||||
# Build the RPM
|
||||
rpmbuild --define "_topdir $BUILD_ROOT" -bb "$BUILD_ROOT/SPECS/serverkit-agent.spec"
|
||||
# Build the RPM (disable build-id for Go binaries, use --target for cross-arch)
|
||||
rpmbuild --define "_topdir $BUILD_ROOT" --define "_build_id_links none" --target "$RPM_ARCH" -bb "$BUILD_ROOT/SPECS/serverkit-agent.spec"
|
||||
|
||||
# Copy output
|
||||
OUTPUT_DIR="${4:-./output}"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
cp "$BUILD_ROOT/RPMS/$RPM_ARCH"/*.rpm "$OUTPUT_DIR/"
|
||||
|
||||
# Cleanup
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user