-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
130 lines (112 loc) · 7.85 KB
/
Taskfile.yaml
File metadata and controls
130 lines (112 loc) · 7.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
version: '3'
# MCP_MODE controls the server mode:
# - stdio (default): Standard input/output mode for local usage
# - http: HTTP streaming mode for remote multi-client access
#
# Usage examples:
# task docker:run # Runs in stdio mode (default)
# task docker:run MCP_MODE=http # Runs in HTTP mode
# task docker:run MCP_MODE=http MCP_SERVER_PORT=9000 # Docker HTTP mode on port 9000
# task docker:run RP_TLS_CA_CERT=/path/to/ca.pem # Trust custom CA (mounts PEM into container at fixed path)
# task docker:run RP_INSECURE_TLS=true # Skip TLS certificate verification (do not combine with RP_TLS_CA_CERT)
vars:
# >= v2.4 required for go.mod `go 1.25` (see golangci-lint changelog / FAQ)
GOLANGCI_LINT_VERSION: 'v2.11.4'
GOLANG_CI: "docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{{.GOLANGCI_LINT_VERSION}} golangci-lint"
IMAGE_NAME: "reportportal-mcp-server"
IMAGE_NAME_DEBUG: "reportportal-mcp-server-debug"
INSPECTOR: "npx @modelcontextprotocol/inspector"
DLV_PORT: '{{.DLV_PORT | default "52202"}}'
MCP_MODE: '{{.MCP_MODE | default "stdio"}}'
MCP_SERVER_PORT: '{{.MCP_SERVER_PORT | default "8080"}}'
MCP_SERVER_HOST: '{{.MCP_SERVER_HOST | default ""}}'
RP_INSECURE_TLS: '{{.RP_INSECURE_TLS | default "false"}}'
RP_TLS_CA_CERT: '{{.RP_TLS_CA_CERT | default ""}}'
dotenv: [ '.env' ]
tasks:
fmt:
desc: "Runs formatter"
cmd: "{{.GOLANG_CI}} fmt ./..."
lint:
desc: "Runs GolangCI linter"
cmd: "{{.GOLANG_CI}} run ./..."
checks:
desc: "Runs checks (formatter and linter)"
cmd: |
go mod tidy && {{.GOLANG_CI}} fmt ./... && {{.GOLANG_CI}} run ./...
test:
desc: "Runs tests"
cmd: "go test ./..."
test:integration:
desc: "Runs integration tests"
cmd: "go test ./internal/integration/... -v"
test:json-report:
desc: "Runs tests and outputs results in JSON format"
cmd: "go test -json ./..."
test:junit-report:
desc: "Runs tests and outputs results in JUnit format. Requires gotestsum to be installed."
vars:
JUNIT_REPORT_FILE: '{{.JUNIT_REPORT_FILE| default "junit-report.xml"}}'
cmd: "gotestsum --junitfile={{.JUNIT_REPORT_FILE}} ./..."
app:build:
desc: "Builds application"
env:
CGO_ENABLED: 0
cmd: |
go build -o bin/reportportal-mcp-server cmd/reportportal-mcp-server/main.go
app:build-debug:
desc: "Builds application with debug symbols for debugging"
env:
CGO_ENABLED: 0
cmd: |
go build -gcflags "all=-N -l" -o bin/reportportal-mcp-server-debug cmd/reportportal-mcp-server/main.go
debug:stop:
desc: "Stops any running debug processes on port {{.DLV_PORT}}"
cmd: powershell -Command '$conns = Get-NetTCPConnection -LocalPort {{.DLV_PORT}} -ErrorAction SilentlyContinue; if ($conns) { $conns | Select-Object -ExpandProperty OwningProcess -Unique | ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }; Write-Host "Stopped processes on port {{.DLV_PORT}}" } else { Write-Host "No process found on port {{.DLV_PORT}}" }'
debug:
desc: "Runs the MCP server locally in debug mode with Delve ({{.MCP_MODE}}). Debugger listens on port {{.DLV_PORT}}. Use DLV_PORT env var to change port."
deps: [app:build-debug]
cmd: >
{{if eq .MCP_MODE "http"}}
powershell -Command '$env:PATH += ";$env:USERPROFILE\go\bin"; $dlvPath = if (Get-Command dlv -ErrorAction SilentlyContinue) { "dlv" } else { "$env:USERPROFILE\go\bin\dlv.exe" }; & $dlvPath exec --headless --listen=:{{.DLV_PORT}} --api-version=2 --accept-multiclient -- bin/reportportal-mcp-server-debug --rp-host="$env:RP_HOST" --project="$env:RP_PROJECT" --port={{.MCP_SERVER_PORT}} {{if .MCP_SERVER_HOST}}--host={{.MCP_SERVER_HOST}}{{end}} --log-level=debug'
{{else}}
powershell -Command '$env:PATH += ";$env:USERPROFILE\go\bin"; $dlvPath = if (Get-Command dlv -ErrorAction SilentlyContinue) { "dlv" } else { "$env:USERPROFILE\go\bin\dlv.exe" }; & $dlvPath exec --headless --listen=:{{.DLV_PORT}} --api-version=2 --accept-multiclient -- bin/reportportal-mcp-server-debug --rp-host="$env:RP_HOST" --project="$env:RP_PROJECT" --token="$env:RP_API_TOKEN" --log-level=debug'
{{end}}
docker:build:
deps: [ app:build ]
desc: "Builds docker image"
cmd: "docker build -t {{.IMAGE_NAME}} ."
docker:build-debug:
deps: [ app:build ]
desc: "Builds docker image with dlv for debugging"
cmd: "docker build -f debug.dockerfile -t {{.IMAGE_NAME_DEBUG}} ."
docker:run:
desc: "Runs docker mcp server in {{.MCP_MODE}} mode"
deps: [ docker:build ]
cmd: >
{{if eq .MCP_MODE "http"}}
docker run -i --rm -p {{.MCP_SERVER_PORT}}:{{.MCP_SERVER_PORT}} -e "RP_API_TOKEN=$RP_API_TOKEN" -e "RP_PROJECT=$RP_PROJECT" -e "RP_HOST=$RP_HOST" {{if .MCP_SERVER_HOST}}-e "MCP_SERVER_HOST={{.MCP_SERVER_HOST}}"{{end}} -e "MCP_SERVER_PORT={{.MCP_SERVER_PORT}}" -e "MCP_MODE={{.MCP_MODE}}" {{if .RP_TLS_CA_CERT}}-v "{{.RP_TLS_CA_CERT}}:/etc/ssl/certs/rp-custom-ca.pem:ro" -e "RP_TLS_CA_CERT=/etc/ssl/certs/rp-custom-ca.pem" {{end}}-e "RP_INSECURE_TLS={{.RP_INSECURE_TLS}}" {{.IMAGE_NAME}}
{{else}}
docker run -i --rm -e "RP_API_TOKEN=$RP_API_TOKEN" -e "RP_PROJECT=$RP_PROJECT" -e "RP_HOST=$RP_HOST" -e "MCP_MODE={{.MCP_MODE}}" {{if .RP_TLS_CA_CERT}}-v "{{.RP_TLS_CA_CERT}}:/etc/ssl/certs/rp-custom-ca.pem:ro" -e "RP_TLS_CA_CERT=/etc/ssl/certs/rp-custom-ca.pem" {{end}}-e "RP_INSECURE_TLS={{.RP_INSECURE_TLS}}" {{.IMAGE_NAME}}
{{end}}
inspector:
desc: "Runs inspector in production mode ({{.MCP_MODE}})"
deps: [ docker:build ]
cmd: >
{{if eq .MCP_MODE "http"}}
{{.INSPECTOR}} -- docker run -i --rm -p {{.MCP_SERVER_PORT}}:{{.MCP_SERVER_PORT}} -e "RP_API_TOKEN=$RP_API_TOKEN" -e "RP_PROJECT=$RP_PROJECT" -e "RP_HOST=$RP_HOST" {{if .MCP_SERVER_HOST}}-e "MCP_SERVER_HOST={{.MCP_SERVER_HOST}}"{{end}} -e "MCP_SERVER_PORT={{.MCP_SERVER_PORT}}" -e "MCP_MODE={{.MCP_MODE}}" {{if .RP_TLS_CA_CERT}}-v "{{.RP_TLS_CA_CERT}}:/etc/ssl/certs/rp-custom-ca.pem:ro" -e "RP_TLS_CA_CERT=/etc/ssl/certs/rp-custom-ca.pem" {{end}}-e "RP_INSECURE_TLS={{.RP_INSECURE_TLS}}" {{.IMAGE_NAME}}
{{else}}
{{.INSPECTOR}} -- docker run -i --rm -e "RP_API_TOKEN=$RP_API_TOKEN" -e "RP_PROJECT=$RP_PROJECT" -e "RP_HOST=$RP_HOST" -e "MCP_MODE={{.MCP_MODE}}" {{if .RP_TLS_CA_CERT}}-v "{{.RP_TLS_CA_CERT}}:/etc/ssl/certs/rp-custom-ca.pem:ro" -e "RP_TLS_CA_CERT=/etc/ssl/certs/rp-custom-ca.pem" {{end}}-e "RP_INSECURE_TLS={{.RP_INSECURE_TLS}}" {{.IMAGE_NAME}}
{{end}}
inspector-debug:
desc: "Runs inspector with the MCP server in debug mode ({{.MCP_MODE}})"
deps: [ docker:build-debug ]
cmd: >
{{if eq .MCP_MODE "http"}}
{{.INSPECTOR}} -- docker run -p {{.DLV_PORT}}:{{.DLV_PORT}} -p {{.MCP_SERVER_PORT}}:{{.MCP_SERVER_PORT}} -i --rm -e "RP_API_TOKEN=$RP_API_TOKEN" -e "RP_PROJECT=$RP_PROJECT" -e "RP_HOST=$RP_HOST" {{if .MCP_SERVER_HOST}}-e "MCP_SERVER_HOST={{.MCP_SERVER_HOST}}"{{end}} -e "MCP_SERVER_PORT={{.MCP_SERVER_PORT}}" -e "MCP_MODE={{.MCP_MODE}}" {{if .RP_TLS_CA_CERT}}-v "{{.RP_TLS_CA_CERT}}:/etc/ssl/certs/rp-custom-ca.pem:ro" -e "RP_TLS_CA_CERT=/etc/ssl/certs/rp-custom-ca.pem" {{end}}-e "RP_INSECURE_TLS={{.RP_INSECURE_TLS}}" {{.IMAGE_NAME_DEBUG}}
{{else}}
{{.INSPECTOR}} -- docker run -p {{.DLV_PORT}}:{{.DLV_PORT}} -i --rm -e "RP_API_TOKEN=$RP_API_TOKEN" -e "RP_PROJECT=$RP_PROJECT" -e "RP_HOST=$RP_HOST" -e "MCP_MODE={{.MCP_MODE}}" {{if .RP_TLS_CA_CERT}}-v "{{.RP_TLS_CA_CERT}}:/etc/ssl/certs/rp-custom-ca.pem:ro" -e "RP_TLS_CA_CERT=/etc/ssl/certs/rp-custom-ca.pem" {{end}}-e "RP_INSECURE_TLS={{.RP_INSECURE_TLS}}" {{.IMAGE_NAME_DEBUG}}
{{end}}
verify:testdata:
desc: "Verifies all JSON test fixtures in internal/integration/testdata/ (recursively) against running MCP server at http://localhost:{{.MCP_SERVER_PORT}}/mcp (requires server to be running, RP_API_TOKEN and RP_PROJECT env vars)"
cmd: go run cmd/verify-testdata/main.go -url "http://localhost:{{.MCP_SERVER_PORT}}/mcp"