Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Build and Release Agent
name: Agent Tip Release

on:
push:
branches:
- main
paths:
- "agent/**"
workflow_dispatch:
- ".github/workflows/agent-tip-release.yml"

permissions:
contents: write

jobs:
build:
agent:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -28,10 +28,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: agent/go.mod
cache-dependency-path: agent/go.sum
Expand All @@ -43,21 +43,21 @@ jobs:
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
go build -ldflags="-s -w" -o agent-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/agent
go build -ldflags="-s -w -X techulus/cloud-agent/internal/agent.Version=${{ github.sha }}" -o agent-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/agent

- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: agent-${{ matrix.goos }}-${{ matrix.goarch }}
path: agent/agent-${{ matrix.goos }}-${{ matrix.goarch }}
retention-days: 1

release:
needs: build
needs: agent
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
path: binaries
merge-multiple: true
Expand All @@ -67,7 +67,7 @@ jobs:
cd binaries
sha256sum agent-* > checksums.txt

- name: Delete existing release assets
- name: Update tip release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -76,10 +76,6 @@ jobs:
gh api -X DELETE repos/${{ github.repository }}/releases/assets/$asset_id
done

- name: Upload binaries to Tip release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for binary in binaries/agent-*; do
chmod +x "$binary"
gh release upload tip "$binary" --repo ${{ github.repository }} --clobber
Expand Down
64 changes: 0 additions & 64 deletions .github/workflows/control-plane-release.yml

This file was deleted.

135 changes: 135 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: write
packages: write

jobs:
agent:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: agent/go.mod
cache-dependency-path: agent/go.sum

- name: Build
working-directory: agent
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
go build -ldflags="-s -w -X techulus/cloud-agent/internal/agent.Version=${{ github.ref_name }}" -o agent-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/agent

- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: agent-${{ matrix.goos }}-${{ matrix.goarch }}
path: agent/agent-${{ matrix.goos }}-${{ matrix.goarch }}
retention-days: 1

release:
needs: agent
runs-on: ubuntu-latest
steps:
- name: Download agent artifacts
uses: actions/download-artifact@v8
with:
path: binaries
pattern: agent-*
merge-multiple: true

- name: Generate SHA256 checksums
run: |
cd binaries
sha256sum agent-* > checksums.txt

- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" \
--repo ${{ github.repository }} \
--title "${{ github.ref_name }}" \
--generate-notes \
binaries/agent-* binaries/checksums.txt

web:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: web
push: true
tags: |
ghcr.io/${{ github.repository }}/web:${{ github.ref_name }}
ghcr.io/${{ github.repository }}/web:tip
build-args: |
APP_VERSION=${{ github.ref_name }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=web
cache-to: type=gha,mode=max,scope=web

registry:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: registry
push: true
tags: |
ghcr.io/${{ github.repository }}/registry:${{ github.ref_name }}
ghcr.io/${{ github.repository }}/registry:tip
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=registry
cache-to: type=gha,mode=max,scope=registry
4 changes: 2 additions & 2 deletions agent/MACOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ docker run -d --name buildkitd --privileged moby/buildkit:latest
Then run the agent with the `BUILDKIT_HOST` env var. Use `sudo -E` to preserve environment variables:

```bash
sudo BUILDKIT_HOST=docker-container://buildkitd ./agent --url <control-plane-url> --data-dir /var/lib/techulus-agent
sudo BUILDKIT_HOST=docker-container://buildkitd ./agent --url <control-plane-url>
```

Or with `-E`:

```bash
BUILDKIT_HOST=docker-container://buildkitd sudo -E ./agent --url <control-plane-url> --data-dir /var/lib/techulus-agent
BUILDKIT_HOST=docker-container://buildkitd sudo -E ./agent --url <control-plane-url>
```

## Insecure Registry (HTTP)
Expand Down
13 changes: 6 additions & 7 deletions agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,24 @@ GOOS=linux GOARCH=amd64 go build -o bin/agent-linux-amd64 ./cmd/agent

Worker node:
```bash
sudo ./agent --url <control-plane-url> --token <registration-token> --data-dir /var/lib/techulus-agent
sudo ./agent --url <control-plane-url> --token <registration-token>
```

Proxy node:
```bash
sudo ./agent --url <control-plane-url> --token <registration-token> --data-dir /var/lib/techulus-agent --proxy
sudo ./agent --url <control-plane-url> --token <registration-token> --proxy
```

### Subsequent Runs

Worker node:
```bash
sudo ./agent --url <control-plane-url> --data-dir /var/lib/techulus-agent
sudo ./agent --url <control-plane-url>
```

Proxy node:
```bash
sudo ./agent --url <control-plane-url> --data-dir /var/lib/techulus-agent --proxy
sudo ./agent --url <control-plane-url> --proxy
```

### Run as systemd Service
Expand All @@ -199,7 +199,7 @@ After=network.target buildkitd.service

[Service]
Type=simple
ExecStart=/usr/local/bin/agent --url <control-plane-url> --data-dir /var/lib/techulus-agent
ExecStart=/usr/local/bin/agent --url <control-plane-url>
Restart=always
RestartSec=5
KillMode=process
Expand All @@ -216,7 +216,7 @@ After=network.target traefik.service buildkitd.service

[Service]
Type=simple
ExecStart=/usr/local/bin/agent --url <control-plane-url> --data-dir /var/lib/techulus-agent --proxy
ExecStart=/usr/local/bin/agent --url <control-plane-url> --proxy
Restart=always
RestartSec=5
KillMode=process
Expand All @@ -239,7 +239,6 @@ sudo systemctl start techulus-agent
|------|---------|-------------|
| `--url` | (required) | Control plane URL |
| `--token` | | Registration token (required for first run) |
| `--data-dir` | `/var/lib/techulus-agent` | Data directory for agent state |
| `--logs-endpoint` | | VictoriaLogs endpoint |
| `--proxy` | `false` | Run as proxy node (handles TLS and public traffic) |

Expand Down
Loading
Loading