Skip to content

Commit 392a3d3

Browse files
Copilotpelikhan
andcommitted
Fix dev mode logic: prioritize build-from-sources over download
- Reorganize gateway installation logic to check dev mode FIRST - In development mode with source files: Always build awmg using make build-awmg - Only fall back to download if NOT in dev mode (or no source files) - Prevents 404 errors when trying to download unreleased binaries in PRs - Order: Dev build -> PATH check -> Local binary -> Download from releases This fixes the CI error where compiled lock files tried to download non-existent binaries in development mode instead of building from sources. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 2ee32d7 commit 392a3d3

3 files changed

Lines changed: 124 additions & 127 deletions

File tree

.github/workflows/dev.lock.yml

Lines changed: 41 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/smoke-copilot.lock.yml

Lines changed: 41 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/workflow/gateway.go

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -121,55 +121,54 @@ func generateMCPGatewayStartStep(config *MCPGatewayConfig, mcpServersConfig map[
121121
" IS_DEV_MODE=\"true\"",
122122
" fi",
123123
" ",
124-
" # Install awmg CLI if not already available",
125-
" if ! command -v awmg &> /dev/null; then",
126-
" # In development mode, build from sources if in gh-aw repo",
127-
" if [ \"$IS_DEV_MODE\" = \"true\" ] && [ -f \"cmd/awmg/main.go\" ] && [ -f \"Makefile\" ]; then",
128-
" echo 'Building awmg from sources (development mode)...'",
129-
" make build-awmg",
130-
" if [ -f \"./awmg\" ]; then",
131-
" echo 'Built awmg successfully'",
132-
" AWMG_CMD=\"./awmg\"",
133-
" else",
134-
" echo 'ERROR: Failed to build awmg from sources'",
135-
" exit 1",
136-
" fi",
137-
" elif [ -f \"./awmg\" ]; then",
138-
" echo 'Using existing local awmg build'",
124+
" # In development mode, always build from sources if possible",
125+
" if [ \"$IS_DEV_MODE\" = \"true\" ] && [ -f \"cmd/awmg/main.go\" ] && [ -f \"Makefile\" ]; then",
126+
" echo 'Building awmg from sources (development mode)...'",
127+
" make build-awmg",
128+
" if [ -f \"./awmg\" ]; then",
129+
" echo 'Built awmg successfully'",
139130
" AWMG_CMD=\"./awmg\"",
140131
" else",
132+
" echo 'ERROR: Failed to build awmg from sources'",
133+
" exit 1",
134+
" fi",
135+
" # Check if awmg is already in PATH",
136+
" elif command -v awmg &> /dev/null; then",
137+
" echo 'awmg is already available in PATH'",
138+
" AWMG_CMD=\"awmg\"",
139+
" # Check for local awmg build",
140+
" elif [ -f \"./awmg\" ]; then",
141+
" echo 'Using existing local awmg build'",
142+
" AWMG_CMD=\"./awmg\"",
143+
" else",
141144
}
142145

143146
stepLines = append(stepLines,
144-
" # Download awmg from releases",
145-
" echo 'Downloading awmg from GitHub releases...'",
146-
" ",
147-
" # Detect platform",
148-
" OS=$(uname -s | tr '[:upper:]' '[:lower:]')",
149-
" ARCH=$(uname -m)",
150-
" if [ \"$ARCH\" = \"x86_64\" ]; then ARCH=\"amd64\"; fi",
151-
" if [ \"$ARCH\" = \"aarch64\" ]; then ARCH=\"arm64\"; fi",
152-
" ",
153-
" AWMG_BINARY=\"awmg-${OS}-${ARCH}\"",
154-
" if [ \"$OS\" = \"windows\" ]; then AWMG_BINARY=\"${AWMG_BINARY}.exe\"; fi",
155-
" ",
156-
" # Download from releases using curl (no gh CLI dependency)",
157-
" RELEASE_URL=\"https://github.com/githubnext/gh-aw/releases/latest/download/$AWMG_BINARY\"",
158-
" echo \"Downloading from $RELEASE_URL\"",
159-
" if curl -L -f -o \"/tmp/$AWMG_BINARY\" \"$RELEASE_URL\"; then",
160-
" chmod +x \"/tmp/$AWMG_BINARY\"",
161-
" AWMG_CMD=\"/tmp/$AWMG_BINARY\"",
162-
" echo 'Downloaded awmg successfully'",
163-
" else",
164-
" echo 'ERROR: Could not find or download awmg binary'",
165-
" echo 'Please ensure awmg is available or download it from:'",
166-
" echo 'https://github.com/githubnext/gh-aw/releases'",
167-
" exit 1",
168-
" fi",
147+
" # Download awmg from releases",
148+
" echo 'Downloading awmg from GitHub releases...'",
149+
" ",
150+
" # Detect platform",
151+
" OS=$(uname -s | tr '[:upper:]' '[:lower:]')",
152+
" ARCH=$(uname -m)",
153+
" if [ \"$ARCH\" = \"x86_64\" ]; then ARCH=\"amd64\"; fi",
154+
" if [ \"$ARCH\" = \"aarch64\" ]; then ARCH=\"arm64\"; fi",
155+
" ",
156+
" AWMG_BINARY=\"awmg-${OS}-${ARCH}\"",
157+
" if [ \"$OS\" = \"windows\" ]; then AWMG_BINARY=\"${AWMG_BINARY}.exe\"; fi",
158+
" ",
159+
" # Download from releases using curl (no gh CLI dependency)",
160+
" RELEASE_URL=\"https://github.com/githubnext/gh-aw/releases/latest/download/$AWMG_BINARY\"",
161+
" echo \"Downloading from $RELEASE_URL\"",
162+
" if curl -L -f -o \"/tmp/$AWMG_BINARY\" \"$RELEASE_URL\"; then",
163+
" chmod +x \"/tmp/$AWMG_BINARY\"",
164+
" AWMG_CMD=\"/tmp/$AWMG_BINARY\"",
165+
" echo 'Downloaded awmg successfully'",
166+
" else",
167+
" echo 'ERROR: Could not find or download awmg binary'",
168+
" echo 'Please ensure awmg is available or download it from:'",
169+
" echo 'https://github.com/githubnext/gh-aw/releases'",
170+
" exit 1",
169171
" fi",
170-
" else",
171-
" echo 'awmg is already available'",
172-
" AWMG_CMD=\"awmg\"",
173172
" fi",
174173
" ",
175174
" # Start MCP gateway in background with config piped via stdin",

0 commit comments

Comments
 (0)