Move MCP gateway volume mounts from shell script to compiler generation#9469
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add Mounts field to MCPGatewayRuntimeConfig struct
- Update ensureDefaultMCPGatewayConfig to set default mounts
- Update container command generation to include volume mounts
- Remove hardcoded mounts from start_mcp_gateway.sh
- Add comprehensive tests for mount generation
- Default mounts: /opt:/opt:ro, /tmp:/tmp:rw, ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}:rw
- Supports custom mount configuration via sandbox.mcp.mounts
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
All lock files now include volume mounts in MCP_GATEWAY_DOCKER_COMMAND:
- -v /opt:/opt:ro
- -v /tmp:/tmp:rw
- -v '${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}:rw'
This completes the migration from hardcoded mounts in the shell script
to compiler-generated mounts in the docker command.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
💀 Blimey! Changeset Generator failed and walked the plank! No treasure today, matey! ☠️ |
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges... |
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
|
@copilot fix the docker command format Validating gateway configuration... Starting gateway with container: docker run -i --rm --network host -e DEBUG="*" -v /opt:/opt:ro -v /tmp:/tmp:rw -v '${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}:rw' ghcr.io/githubnext/gh-aw-mcpg:latest Waiting for gateway to be ready... ERROR: Gateway failed to become ready after 30 attempts Gateway stdout (errors are written here per MCP Gateway Specification): Gateway stderr logs (debug output): Run 'docker run --help' for more information |
The issue was that mounts were being quoted individually with shellQuote()
and then the entire command was quoted again, causing malformed syntax like:
-v '\''${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}:rw'\''
Fixed by not quoting individual mounts since the entire command is wrapped
in quotes. Now generates correct format:
-v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}:rw
Updated test to match the new behavior.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in dd5ed16. The issue was nested quoting - mounts were being quoted individually and then the entire command was quoted again, causing malformed syntax. Now mounts are not individually quoted since the entire command is wrapped in quotes, resulting in correct format: |
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges... |
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
|
💀 Blimey! Changeset Generator failed and walked the plank! No treasure today, matey! ☠️ |
|
@copilot you need fix the inclusion of ${GITHUB_WORKSPACE} --> $GITHUB_WORKSPACE so it gets rendered |
Changed the docker command export format to allow ${GITHUB_WORKSPACE}
to be expanded at runtime. Previously it was wrapped in single quotes
which prevented expansion.
New format: 'docker run ... -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ...'
This closes the single quote before the variable, adds it in double quotes
for expansion, then reopens the single quote. When executed with
$MCP_GATEWAY_DOCKER_COMMAND, ${GITHUB_WORKSPACE} will now be properly
expanded to the actual workspace path.
Added buildDockerCommandWithExpandableVars() function to handle this
special quoting for variables that need runtime expansion.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
... Fixed in 8176f16. Changed the docker command format to allow export MCP_GATEWAY_DOCKER_COMMAND='docker run ... -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ...'This closes the single quote before the variable, adds it in double quotes for expansion, then reopens the single quote. When the shell executes |
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
💀 Blimey! Changeset Generator failed and walked the plank! No treasure today, matey! ☠️ |
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
|
💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges... |
Move MCP Gateway Mounts from Shell Script to Compiler
Completed Tasks
Understand the current implementation
actions/setup/sh/start_mcp_gateway.shlines 105-106/opt:/opt:ro,/tmp:/tmp:rw, and${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}:rwAdd Mounts field to MCPGatewayRuntimeConfig struct
pkg/workflow/tools_types.goto addMounts []stringfieldUpdate compiler to generate mounts in MCP_GATEWAY_DOCKER_COMMAND
pkg/workflow/mcp_servers.goto include mounts when building containerCmdensureDefaultMCPGatewayConfigto set default mounts if not providedUpdate shell script to use mounts from docker command
actions/setup/sh/start_mcp_gateway.shAdd/update tests
pkg/workflow/mcp_gateway_mounts_test.gowith comprehensive testsFix docker command format issue (nested quoting)
docker: Error response from daemon: invalid mode: rw'Fix GITHUB_WORKSPACE variable expansion
${GITHUB_WORKSPACE}to be expanded at runtime'docker run ... -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ...'buildDockerCommandWithExpandableVars()function to handle special variable quotingManual verification
export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -e DEBUG="*" -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/githubnext/gh-aw-mcpg:v0.0.10'Summary
Successfully moved MCP gateway volume mounts from hardcoded shell script to compiler-generated docker command. The mounts are now:
sandbox.mcp.mountsin workflow frontmatter${GITHUB_WORKSPACE}is properly expanded at runtime in the shellOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.