Skip to content

Commit 0f25f5c

Browse files
committed
chore(ci): update publish workflow to use package.nix for versioning
1 parent 4ab5f83 commit 0f25f5c

File tree

6 files changed

+44
-49
lines changed

6 files changed

+44
-49
lines changed

.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:

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ COPY . /app
99
# Build the default package from the flake
1010
# This will produce a 'result' symlink in the working directory
1111
RUN nix build .#default
12-
RUN cp ./result/bin/server /app/sysdig-mcp-server
1312

1413
# Final image
1514
# quay.io/sysdig/sysdig-mini-ubi9:1
1615
FROM quay.io/sysdig/sysdig-mini-ubi9@sha256:dcef7a07dc6a8655cbee5e2f3ad7822dea5a0cf4929b1b9effa39e56ce928ca0
1716

1817
# Copy the binary from the builder stage
19-
COPY --from=builder /app/sysdig-mcp-server /sysdig-mcp-server
18+
COPY --from=builder /app/result/bin/sysdig-mcp-server /usr/local/bin/sysdig-mcp-server
2019

2120
# Run as non-root user (numeric ID)
2221
USER 1000
2322

24-
ENTRYPOINT ["/sysdig-mcp-server"]
23+
ENTRYPOINT ["sysdig-mcp-server"]

flake.nix

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,14 @@
3131
with pkgs;
3232
mkShell {
3333
packages = [
34-
pre-commit
35-
basedpyright
3634
ginkgo
3735
go_1_25
3836
gofumpt
37+
golangci-lint
3938
just
4039
mockgen
41-
python3
42-
ruff
40+
pre-commit
4341
sd
44-
sysdig-cli-scanner
45-
uv
4642
];
4743
shellHook = ''
4844
pre-commit install

package.nix

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ buildGoModule }:
1+
{ buildGoModule, versionCheckHook }:
22
buildGoModule (finalAttrs: {
33
pname = "sysdig-mcp-server";
44
version = "0.4.0";
@@ -18,9 +18,16 @@ buildGoModule (finalAttrs: {
1818
doCheck = false;
1919
env.CGO_ENABLED = 0;
2020

21+
postInstall = ''
22+
mv $out/bin/server $out/bin/sysdig-mcp-server
23+
'';
24+
25+
nativeInstallCheckInputs = [ versionCheckHook ];
26+
doInstallCheck = true;
27+
2128
meta = {
2229
description = "Sysdig MCP Server";
2330
homepage = "https://github.com/sysdiglabs/sysdig-mcp-server";
24-
mainProgram = "server";
31+
mainProgram = "sysdig-mcp-server";
2532
};
2633
})

0 commit comments

Comments
 (0)