Skip to content

Commit 771483d

Browse files
committed
feat: implement worknode system and refactor workspace to support remote execution
- Introduce Worknode (Runner) system with WebSocket and Redis Bus routing - Refactor Workspace into interface with Local and Remote implementations - Move large output processing from middleware to Workspace layer - Enhance MCP with per-request dynamic headers for authentication - Add APIKeyAuth for direct worknode connections
1 parent bf845f5 commit 771483d

38 files changed

Lines changed: 5265 additions & 0 deletions

.dockerignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Build output
6+
dist/
7+
output/
8+
coverage.out
9+
10+
# IDE
11+
.idea/
12+
.vscode/
13+
*.swp
14+
*.swo
15+
16+
# OS files
17+
.DS_Store
18+
Thumbs.db
19+
20+
# Documentation
21+
*.md
22+
!go.md
23+
24+
# Config examples
25+
*.example
26+
*.sample
27+
28+
# Test files
29+
*_test.go
30+
testdata/

.github/CODEOWNERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Default owners for everything in the repo
2+
* @flashcatcloud/safari-team
3+
4+
# Workflow files
5+
.github/ @flashcatcloud/devops-team
6+
7+
# Security-related files
8+
SECURITY.md @flashcatcloud/security-team
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: "🐛 Bug report"
3+
about: Report a bug or unexpected behavior while using Flashduty Runner
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
### Describe the bug
11+
12+
A clear and concise description of what the bug is.
13+
14+
### Affected version
15+
16+
Please run `flashduty-runner version` and paste the output below:
17+
18+
```
19+
(paste version output here)
20+
```
21+
22+
### Environment
23+
24+
- OS: (e.g., Ubuntu 22.04, macOS 14.0)
25+
- Architecture: (e.g., amd64, arm64)
26+
- Installation method: (binary download / Docker / source build)
27+
28+
### Steps to reproduce the behavior
29+
30+
1. Configure '...'
31+
2. Run command '...'
32+
3. See error
33+
34+
### Expected vs actual behavior
35+
36+
A clear and concise description of what you expected to happen and what actually happened.
37+
38+
### Logs
39+
40+
Paste any available logs. Redact sensitive information like API keys.
41+
42+
```
43+
(paste logs here)
44+
```
45+
46+
### Configuration (if relevant)
47+
48+
```yaml
49+
# Paste relevant config (redact api_key!)
50+
```
51+
52+
### Additional context
53+
54+
Add any other context about the problem here.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: "⭐ Feature request"
3+
about: Suggest a new feature or improvement for Flashduty Runner
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
### Describe the feature or problem you'd like to solve
11+
12+
A clear and concise description of what the feature is or what problem it solves.
13+
14+
### Proposed solution
15+
16+
Describe how you'd like the feature to work.
17+
18+
### Use cases
19+
20+
Describe the scenarios where this feature would be useful:
21+
22+
1. ...
23+
2. ...
24+
3. ...
25+
26+
### Alternatives considered
27+
28+
Describe any alternative solutions or features you've considered.
29+
30+
### Additional context
31+
32+
Add any other context, mockups, or screenshots about the feature request here.

.github/dependabot.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "gomod"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
commit-message:
13+
prefix: "chore(deps)"
14+
15+
- package-ecosystem: "docker"
16+
directory: "/"
17+
schedule:
18+
interval: "weekly"
19+
commit-message:
20+
prefix: "chore(deps)"
21+
22+
- package-ecosystem: "github-actions"
23+
directory: "/"
24+
schedule:
25+
interval: "weekly"
26+
commit-message:
27+
prefix: "chore(ci)"

.github/pull_request_template.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!--
2+
Thank you for contributing to Flashduty Runner!
3+
Please reference an existing issue: `Closes #NUMBER`
4+
5+
Screenshots or videos of changed behavior is incredibly helpful and always appreciated.
6+
Consider addressing the following:
7+
- Tradeoffs: List tradeoffs you made to take on or pay down tech debt.
8+
- Alternatives: Describe alternative approaches you considered and why you discarded them.
9+
-->
10+
11+
## Summary
12+
13+
Brief description of what this PR does.
14+
15+
## Related Issue
16+
17+
Closes #
18+
19+
## Type of Change
20+
21+
- [ ] Bug fix (non-breaking change which fixes an issue)
22+
- [ ] New feature (non-breaking change which adds functionality)
23+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
24+
- [ ] Documentation update
25+
- [ ] Refactoring (no functional changes)
26+
27+
## Checklist
28+
29+
- [ ] My code follows the project's coding standards
30+
- [ ] I have run `make fmt` and `make lint`
31+
- [ ] I have added tests that prove my fix is effective or that my feature works
32+
- [ ] New and existing unit tests pass locally with my changes
33+
- [ ] I have updated the documentation accordingly
34+
- [ ] I have added entries to the changelog (if applicable)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
schedule:
9+
- cron: "0 6 * * 1"
10+
11+
permissions:
12+
actions: read
13+
contents: read
14+
security-events: write
15+
16+
jobs:
17+
analyze:
18+
name: Analyze
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language: ["go"]
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version-file: "go.mod"
34+
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v3
37+
with:
38+
languages: ${{ matrix.language }}
39+
40+
- name: Autobuild
41+
uses: github/codeql-action/autobuild@v3
42+
43+
- name: Perform CodeQL Analysis
44+
uses: github/codeql-action/analyze@v3
45+
with:
46+
category: "/language:${{ matrix.language }}"
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Docker Publish
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
tags: ["v*.*.*"]
7+
pull_request:
8+
branches: ["main"]
9+
10+
env:
11+
REGISTRY: registry.flashcat.cloud
12+
IMAGE_NAME: public/flashduty-runner
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
id-token: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install cosign
27+
if: github.event_name != 'pull_request'
28+
uses: sigstore/cosign-installer@v3
29+
with:
30+
cosign-release: "v2.2.4"
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
35+
- name: Log into registry ${{ env.REGISTRY }}
36+
if: github.event_name != 'pull_request'
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ secrets.TCR_USERNAME }}
41+
password: ${{ secrets.TCR_PASSWORD }}
42+
43+
- name: Extract Docker metadata
44+
id: meta
45+
uses: docker/metadata-action@v5
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
tags: |
49+
type=ref,event=branch
50+
type=ref,event=tag
51+
type=ref,event=pr
52+
type=semver,pattern={{version}}
53+
type=semver,pattern={{major}}.{{minor}}
54+
type=semver,pattern={{major}}
55+
type=sha
56+
type=raw,value=latest,enable=${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
57+
58+
- name: Go Build Cache for Docker
59+
uses: actions/cache@v4
60+
with:
61+
path: go-build-cache
62+
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }}
63+
64+
- name: Inject go-build-cache
65+
uses: reproducible-containers/buildkit-cache-dance@v3
66+
with:
67+
cache-source: go-build-cache
68+
69+
- name: Build and push Docker image
70+
id: build-and-push
71+
uses: docker/build-push-action@v6
72+
with:
73+
context: .
74+
push: ${{ github.event_name != 'pull_request' }}
75+
tags: ${{ steps.meta.outputs.tags }}
76+
labels: ${{ steps.meta.outputs.labels }}
77+
cache-from: type=gha
78+
cache-to: type=gha,mode=max
79+
platforms: linux/amd64,linux/arm64
80+
build-args: |
81+
VERSION=${{ github.ref_name }}
82+
83+
- name: Sign the published Docker image
84+
if: ${{ github.event_name != 'pull_request' }}
85+
env:
86+
TAGS: ${{ steps.meta.outputs.tags }}
87+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
88+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.github/workflows/go.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and Test
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
steps:
18+
- name: Check out code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version-file: "go.mod"
25+
26+
- name: Download dependencies
27+
run: go mod download
28+
29+
- name: Run unit tests
30+
run: go test -race -coverprofile=coverage.out ./...
31+
32+
- name: Build
33+
run: go build -v ./cmd
34+
35+
- name: Upload coverage
36+
if: matrix.os == 'ubuntu-latest'
37+
uses: codecov/codecov-action@v4
38+
with:
39+
files: coverage.out
40+
fail_ci_if_error: false

0 commit comments

Comments
 (0)