Skip to content

fix: apply Poetry pin workaround to Azure fork build path#126

Merged
ewega merged 3 commits intomainfrom
copilot/create-implementation-plan
Mar 5, 2026
Merged

fix: apply Poetry pin workaround to Azure fork build path#126
ewega merged 3 commits intomainfrom
copilot/create-implementation-plan

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

  • Add applyPoetryPinWorkaround(repoRoot) call in Azure deploy fork build path
  • Gate workaround to azureRepoURL != "" (temp-clone path only) to avoid mutating a local working tree
  • Remove leading \n from sub-item warning messages (stay tight under parent per terminal output standards)
  • Build, vet, test — all pass
Original prompt

Can you execute on the above plan please

**Chronological Review:** 1. User submitted a request to create an implementation plan for a failed `gh devlake init` Azure deployment 2. Agent read the pasted error log (630 lines) in chunks to understand the failure 3. Agent dispatched an explore task to understand the Docker build flow in the codebase 4. Agent examined specific files: `deploy_local.go` (Poetry workaround), `deploy_azure.go` (missing workaround) 5. Agent confirmed the root cause: Poetry pin workaround exists for local but not Azure fork builds 6. Agent created the plan file and inserted todos into the SQL database 7. Agent exited plan mode with a summary recommending autopilot

Intent Mapping:

  • User wants to understand why gh devlake init failed when deploying to Azure with fork image source
  • User wants a structured implementation plan saved to the session plan file

Technical Inventory:

  • gh-devlake: GitHub CLI extension for deploying Apache DevLake
  • Poetry 2.3.2: Python package manager that fails to install in Docker container
  • Poetry 2.2.1: Known working version, already pinned in local deploy path
  • Azure Container Apps: Target deployment platform
  • Docker: Used to build images from cloned fork repo
  • Go: Language of gh-devlake codebase (cmd package)
  • ACR (Azure Container Registry): Used for fork/custom image builds

Code Archaeology:

  • cmd/deploy_azure.go: Azure deployment flow, lines 150-435 examined. Missing Poetry workaround call between lines 188-189.
  • cmd/deploy_local.go: Local deployment flow, lines 345-404 examined. Contains applyPoetryPinWorkaround() at line 360, rewritePoetryInstallLine() at line 391, and poetryWorkaroundVersion = "2.2.1" constant at line 21.
  • internal/docker/build.go: Docker build/push functions
  • internal/gitclone/clone.go: Git clone with depth=1

Progress Assessment:

  • Complete: Root cause analysis, plan creation, todo insertion
  • Pending: Actual code fix (apply-workaround-azure), validation (validate-build)

Context Validation:

  • All file paths, line numbers, and function names documented
  • The fix location is precisely identified
  • The relationship between local and Azure paths is clear

Recent Commands Analysis:

  • Last commands: create (plan.md), sql (insert todos), exit_plan_mode (with autopilot recommendation)
  • All succeeded; plan mode exited to interactive mode awaiting user prompt
1. Conversation Overview: - Primary Objectives: User ran `gh devlake init` to deploy to Azure using the fork image source option (cloning `https://github.com/DevExpGBB/incubator-devlake`) and it failed during Docker build. User requested: "I want to create an implementation plan" to fix the failure. - Session Context: Single-phase conversation — user provided error log, agent analyzed the failure, explored the codebase, identified root cause, created plan, and exited plan mode ready for implementation. - User Intent Evolution: Straightforward — diagnose failure → create plan to fix it.
  1. Technical Foundation:

    • gh-devlake: GitHub CLI extension (Go codebase) at C:\Users\eldrickt\Projects\gh-devlake for deploying Apache DevLake
    • Poetry 2.3.2: Latest Poetry version that fails to install inside the Docker container (upstream DevLake Dockerfile line 152: RUN curl -sSL https://install.python-poetry.org | python3 -)
    • Poetry 2.2.1: Known working version, already pinned in local deploy workaround
    • Azure Container Apps: Target deployment platform; uses ACR for custom-built images
    • Docker build flow: Three images built sequentially — devlake-backend, devlake-config-ui, devlake-grafana — backend fails first due to Poetry
    • Image source options: official (Docker Hub, no build), fork (clone + build), custom (pre-built)
  2. Codebase Status:

    • cmd/deploy_azure.go:
      • Purpose: Azure deployment flow for gh devlake init
      • Current State: Missing Poetry pin workaround — this is the bug
      • Key Code: findRepoRoot() (line 378) clones repo; lines 205-229 build/push Docker images without workaround; savePartialAzureState() (line 423) writes early checkpoint for cleanup
      • The fix location: Between lines 188 and 189 (after findRepoRoot() returns repoRoot, before the build loop)
    • cmd/deploy_local.go:
      • Purpose: Local Docker Compose deployment flow
      • Current State: Already has the workaround working correctly
      • Key Code: poetryWorkaroundVersion = "2.2.1" (line 21); applyPoetryPinWorkaround(absDir) called at line 360; rewritePoetryInstallLine() at line 391 replaces the unpinned Poetry install line with a version-pinned one
      • Both function and constant are in the cmd package, so already accessible from deploy_azure.go
    • internal/docker/build.go:
      • Purpose: Docker CLI wrapper functions
      • Key Code: Build() (line 27), TagAndPush() (line 36), `CheckAv...

Created from Copilot CLI via the copilot delegate command.


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

Co-authored-by: ewega <26189114+ewega@users.noreply.github.com>
Copilot AI changed the title [WIP] Create structured implementation plan for Azure deployment failure fix: apply Poetry pin workaround to Azure fork build path Mar 5, 2026
Copilot finished work on behalf of ewega March 5, 2026 12:56
@ewega ewega marked this pull request as ready for review March 5, 2026 13:42
Copilot AI review requested due to automatic review settings March 5, 2026 13:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the existing “pin Poetry to 2.2.1” Dockerfile workaround to the Azure fork/source build path so gh devlake init on Azure no longer fails during backend image builds due to Poetry 2.3.2 crashing.

Changes:

  • Invoke applyPoetryPinWorkaround(repoRoot) in runDeployAzure() before the Azure Docker build loop.

Comment on lines +188 to +193
}
if err := applyPoetryPinWorkaround(repoRoot); err != nil {
fmt.Printf("\n ⚠️ Could not apply temporary Poetry pin workaround: %v\n", err)
} else {
fmt.Printf("\n ⚠️ Applied temporary Poetry pin workaround (poetry==%s) for fork builds\n", poetryWorkaroundVersion)
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applyPoetryPinWorkaround(repoRoot) runs for any Azure image build, including the auto-detect path where repoRoot can be the user’s local working tree (when --repo-url is not set). This will rewrite backend/Dockerfile in-place and can leave unexpected local modifications. Consider gating the workaround to the temp-clone/fork path (e.g., only when azureRepoURL != ""), or applying it to a copied build context rather than mutating a local repo.

Suggested change
}
if err := applyPoetryPinWorkaround(repoRoot); err != nil {
fmt.Printf("\n ⚠️ Could not apply temporary Poetry pin workaround: %v\n", err)
} else {
fmt.Printf("\n ⚠️ Applied temporary Poetry pin workaround (poetry==%s) for fork builds\n", poetryWorkaroundVersion)
}
if err := applyPoetryPinWorkaround(repoRoot); err != nil {
fmt.Printf("\n ⚠️ Could not apply temporary Poetry pin workaround: %v\n", err)
} else {
fmt.Printf("\n ⚠️ Applied temporary Poetry pin workaround (poetry==%s) for fork builds\n", poetryWorkaroundVersion)
}
}

Copilot uses AI. Check for mistakes.
Comment on lines +190 to +192
fmt.Printf("\n ⚠️ Could not apply temporary Poetry pin workaround: %v\n", err)
} else {
fmt.Printf("\n ⚠️ Applied temporary Poetry pin workaround (poetry==%s) for fork builds\n", poetryWorkaroundVersion)
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These warning/status fmt.Printf calls start with a leading \n, which introduces an extra blank line and breaks the “sub-items stay tight under their parent” output pattern used elsewhere in this command (e.g., other indented ⚠️ lines don’t add a preceding blank line). Remove the leading newline and let the surrounding step headers control spacing.

Suggested change
fmt.Printf("\n ⚠️ Could not apply temporary Poetry pin workaround: %v\n", err)
} else {
fmt.Printf("\n ⚠️ Applied temporary Poetry pin workaround (poetry==%s) for fork builds\n", poetryWorkaroundVersion)
fmt.Printf(" ⚠️ Could not apply temporary Poetry pin workaround: %v\n", err)
} else {
fmt.Printf(" ⚠️ Applied temporary Poetry pin workaround (poetry==%s) for fork builds\n", poetryWorkaroundVersion)

Copilot uses AI. Check for mistakes.
@ewega
Copy link
Contributor

ewega commented Mar 5, 2026

@copilot apply changes based on the comments in this thread

Co-authored-by: ewega <26189114+ewega@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 5, 2026

@copilot apply changes based on the comments in this thread

Done in c9d4767. Both issues addressed:

  • applyPoetryPinWorkaround is now gated inside the azureRepoURL != "" block so it only runs on temp-cloned forks, not on a user's local working tree
  • Removed the leading \n from the warning fmt.Printf calls so they stay tight as sub-items under their parent step

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@ewega ewega merged commit 04fa79e into main Mar 5, 2026
11 checks passed
@ewega ewega deleted the copilot/create-implementation-plan branch March 5, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants