Skip to content

Commit cbfd394

Browse files
authored
refactor: reimplement in Go (#28)
1 parent c0dad9b commit cbfd394

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+67994
-4408
lines changed

.dockerignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
21
examples/
3-
.venv/
42
.github/
53
.idea/
64
.vscode/
75
.env
86
.gitignore
97
CONTRIBUTING.md
10-
flake8.ini
11-
flake.nix
128
LICENSE.*
139
README.md
14-
__pycache__/*
1510
lib/
16-
.python-version
11+
.secrets

.envrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ has nix && use flake
22
watch_file *.nix
33
dotenv_if_exists .env # You can create a .env file with your env vars for this project. You can also use .secrets if you are using act. See the line below.
44
dotenv_if_exists .secrets # Used by [act](https://nektosact.com/) to load secrets into the pipelines
5+
strict_env
6+
env_vars_required SYSDIG_MCP_API_HOST SYSDIG_MCP_API_SECURE_TOKEN

.gemini/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"sysdig": {
4+
"command": "go",
5+
"args": ["run", "./cmd/server"]
6+
}
7+
}
8+
}

.github/workflows/publish.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
branches:
77
- main
88
paths:
9-
- pyproject.toml
9+
- package.nix
1010

1111
concurrency:
1212
group: 'publish-${{ github.workflow }}'
@@ -24,10 +24,10 @@ jobs:
2424
fetch-tags: true
2525
fetch-depth: 0
2626

27-
- name: Extract version from pyproject.toml
27+
- name: Extract version from package.nix
2828
id: extract
2929
run: |
30-
VERSION=$(grep -m1 '^version\s*=' pyproject.toml | sed -E 's/version\s*=\s*"([^"]+)".*/\1/')
30+
VERSION=$(grep -m1 'version\s*=' package.nix | sed -E 's/.*version\s*=\s*"([^"]+)";.*/\1/')
3131
echo "Extracted version: v$VERSION"
3232
echo "version=v$VERSION" >> $GITHUB_OUTPUT
3333
@@ -59,7 +59,6 @@ jobs:
5959
permissions:
6060
contents: read # required for actions/checkout
6161
packages: write # required for pushing to ghcr.io
62-
id-token: write # required for signing with cosign
6362
steps:
6463
- name: Check out the repo
6564
uses: actions/checkout@v5

.github/workflows/test.yaml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
---
21
name: Test
32

43
on:
54
pull_request:
6-
paths:
7-
- pyproject.toml
8-
- Dockerfile
9-
- "*.py"
10-
- tests/**
11-
- tools/**
12-
- utils/**
5+
branches:
6+
- main
7+
- master
138
workflow_call:
149
workflow_dispatch:
1510

@@ -24,23 +19,30 @@ jobs:
2419
defaults:
2520
run:
2621
shell: nix develop --command bash {0}
27-
permissions:
28-
contents: read # required for actions/checkout
2922
steps:
3023
- name: Check out the repo
3124
uses: actions/checkout@v4
3225

3326
- name: Install nix
3427
uses: DeterminateSystems/nix-installer-action@main
3528

36-
- name: Download dependencies
37-
run: make init
38-
39-
- name: Run ruff
40-
run: make lint
41-
42-
- name: Run Unit Tests
43-
run: make test
29+
- name: Run Checks
30+
run: just check
4431
env:
4532
SYSDIG_MCP_API_HOST: ${{ vars.SYSDIG_MCP_API_HOST }}
4633
SYSDIG_MCP_API_SECURE_TOKEN: ${{ secrets.SYSDIG_MCP_API_SECURE_TOKEN }}
34+
build:
35+
name: Build
36+
runs-on: ubuntu-latest
37+
defaults:
38+
run:
39+
shell: nix develop --command bash {0}
40+
steps:
41+
- name: Check out the repo
42+
uses: actions/checkout@v4
43+
44+
- name: Install nix
45+
uses: DeterminateSystems/nix-installer-action@main
46+
47+
- name: Build
48+
run: go build ./...

.github/workflows/test_image.yaml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@ name: Test Image Build
33

44
on:
55
pull_request:
6-
paths:
7-
- pyproject.toml
8-
- Dockerfile
9-
- "*.py"
10-
- tests/**
11-
- tools/**
12-
- utils/**
13-
- .github/workflows/**
6+
branches:
7+
- main
8+
- master
149
workflow_call:
1510
workflow_dispatch:
1611

@@ -32,23 +27,20 @@ jobs:
3227
ref: ${{ github.sha }} # required for better experience using pre-releases
3328
fetch-depth: "0" # Required due to the way Git works, without it this action won't be able to find any or the correct tags
3429

35-
- name: Log in to GitHub Container Registry
36-
uses: docker/login-action@v3
37-
with:
38-
registry: ghcr.io
39-
username: ${{ github.actor }}
40-
password: ${{ secrets.GITHUB_TOKEN }}
41-
4230
- name: Build Docker image and test push action
4331
id: build-to-test
4432
uses: docker/build-push-action@v6
4533
with:
4634
context: .
4735
load: true
48-
push: true
36+
push: false
4937
tags: |
5038
ghcr.io/sysdiglabs/sysdig-mcp-server:test
5139
40+
- name: Test we can execute the docker image
41+
run: |
42+
docker run --rm ghcr.io/sysdiglabs/sysdig-mcp-server:test --help | grep "Sysdig MCP Server"
43+
5244
- name: Scan Docker image
5345
uses: sysdiglabs/scan-action@v6
5446
with:

.gitignore

Lines changed: 118 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,123 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
1+
# Created by https://www.toptal.com/developers/gitignore/api/go,jetbrains+all,direnv
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=go,jetbrains+all,direnv
53

6-
# C extensions
4+
### direnv ###
5+
.direnv
6+
.secrets
7+
.env
8+
9+
### Go ###
10+
# If you prefer the allow list template instead of the deny list, see community template:
11+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
12+
#
13+
# Binaries for programs and plugins
14+
*.exe
15+
*.exe~
16+
*.dll
717
*.so
18+
*.dylib
819

9-
# Distribution / packaging
10-
.Python
11-
env/
12-
build/
13-
!build/sysdig_client-1.0.0.tar.gz
14-
develop-eggs/
15-
dist/
16-
downloads/
17-
eggs/
18-
.eggs/
19-
lib/
20-
lib64/
21-
parts/
22-
sdist/
23-
var/
24-
*.egg-info/
25-
.installed.cfg
26-
*.egg
27-
.env
20+
# Test binary, built with `go test -c`
21+
*.test
2822

29-
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32-
*.manifest
33-
*.spec
34-
35-
# Installer logs
36-
pip-log.txt
37-
pip-delete-this-directory.txt
38-
39-
# Unit test / coverage reports
40-
htmlcov/
41-
.tox/
42-
.coverage
43-
.coverage.*
44-
.cache
45-
nosetests.xml
46-
coverage.xml
47-
pytest.xml
48-
*,cover
49-
.hypothesis/
50-
venv/
51-
.venv/
52-
.python-version
53-
.pytest_cache
54-
55-
# Translations
56-
*.mo
57-
*.pot
58-
59-
# Django stuff:
60-
*.log
61-
62-
# Sphinx documentation
63-
docs/_build/
64-
65-
# PyBuilder
66-
target/
67-
68-
#Ipython Notebook
69-
.ipynb_checkpoints
70-
71-
# VSCode
72-
.vscode/
73-
74-
# Nix development
75-
.direnv/
76-
.secrets
23+
# Output of the go coverage tool, specifically when used with LiteIDE
24+
*.out
25+
26+
# Dependency directories (remove the comment below to include it)
27+
# vendor/
28+
29+
# Go workspace file
30+
go.work
31+
32+
### JetBrains+all ###
33+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
34+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
35+
36+
# User-specific stuff
37+
.idea/**/workspace.xml
38+
.idea/**/tasks.xml
39+
.idea/**/usage.statistics.xml
40+
.idea/**/dictionaries
41+
.idea/**/shelf
42+
43+
# AWS User-specific
44+
.idea/**/aws.xml
45+
46+
# Generated files
47+
.idea/**/contentModel.xml
48+
49+
# Sensitive or high-churn files
50+
.idea/**/dataSources/
51+
.idea/**/dataSources.ids
52+
.idea/**/dataSources.local.xml
53+
.idea/**/sqlDataSources.xml
54+
.idea/**/dynamic.xml
55+
.idea/**/uiDesigner.xml
56+
.idea/**/dbnavigator.xml
57+
58+
# Gradle
59+
.idea/**/gradle.xml
60+
.idea/**/libraries
61+
62+
# Gradle and Maven with auto-import
63+
# When using Gradle or Maven with auto-import, you should exclude module files,
64+
# since they will be recreated, and may cause churn. Uncomment if using
65+
# auto-import.
66+
# .idea/artifacts
67+
# .idea/compiler.xml
68+
# .idea/jarRepositories.xml
69+
# .idea/modules.xml
70+
# .idea/*.iml
71+
# .idea/modules
72+
# *.iml
73+
# *.ipr
74+
75+
# CMake
76+
cmake-build-*/
77+
78+
# Mongo Explorer plugin
79+
.idea/**/mongoSettings.xml
80+
81+
# File-based project format
82+
*.iws
83+
84+
# IntelliJ
85+
out/
86+
87+
# mpeltonen/sbt-idea plugin
88+
.idea_modules/
89+
90+
# JIRA plugin
91+
atlassian-ide-plugin.xml
92+
93+
# Cursive Clojure plugin
94+
.idea/replstate.xml
95+
96+
# SonarLint plugin
97+
.idea/sonarlint/
98+
99+
# Crashlytics plugin (for Android Studio and IntelliJ)
100+
com_crashlytics_export_strings.xml
101+
crashlytics.properties
102+
crashlytics-build.properties
103+
fabric.properties
104+
105+
# Editor-based Rest Client
106+
.idea/httpRequests
107+
108+
# Android studio 3.1+ serialized cache file
109+
.idea/caches/build_file_checksums.ser
110+
111+
### JetBrains+all Patch ###
112+
# Ignore everything but code style settings and run configurations
113+
# that are supposed to be shared within teams.
114+
115+
.idea/*
116+
117+
!.idea/codeStyles
118+
!.idea/runConfigurations
119+
120+
### Nix ###
77121
result
122+
123+
# End of https://www.toptal.com/developers/gitignore/api/go,jetbrains+all,direnv

0 commit comments

Comments
 (0)