Run OpenCode inside a Azure DevOps Pipeline #2572

Closed
opened 2026-02-16 17:36:17 -05:00 by yindo · 4 comments
Owner

Originally created by @Eckii24 on GitHub (Nov 4, 2025).

Question

We currently try to create a Azure DevOps pipeline, which takes a prompt and a repository, executes opencode with the prompt and commits and pushes all made changes.

When I execute this it stuck when calling opencode:

Executing OpenCode with prompt: 'hi'
Using model: azure/gpt-5-mini

┌  Credentials ~/.local/share/opencode/auth.json
│
└  0 credentials

┌  Environment
│
●  Azure AZURE_RESOURCE_NAME
│
●  Azure AZURE_API_KEY
│
└  2 environment variables

INFO  2025-11-04T10:36:49 +364ms service=default version=1.0.20 args=["run","--model","azure/gpt-5-mini","--print-logs","--log-level","DEBUG","hi"] opencode

It does not execute or log something else than this.

Does anybody have an idea, what the issue might be here?

My pipeline looks something like this:

trigger:
- none

parameters:
  - name: repositoryName
    displayName: 'Repository name to checkout'
    type: string
    default: '<repoName>'
  - name: prompt
    displayName: 'Prompt to execute with OpenCode'
    type: string
    default: ''
  - name: model
    displayName: 'Model to use'
    type: string
    default: 'gpt-5-mini'

steps:
# Install OpenCode
- task: PowerShell@2
  displayName: 'Install OpenCode'
  inputs:
    targetType: inline
    script: |
      Write-Host "Installing OpenCode..."
      curl -fsSL https://opencode.ai/install | bash
      
      $opencodeBinary = Join-Path "$env:HOME" ".opencode/bin"
      $env:PATH = "$env:PATH:$opencodeBinary"

      opencode --version

# Checkout repository and execute OpenCode
- task: PowerShell@2
  displayName: 'Execute OpenCode on Repository'
  inputs:
    targetType: inline
    script: |
      [...] # checkout repo and cd into it
      
      # Prepare model with azure prefix if not already present
      $rawModel = "${{ parameters.model }}"
      if ($rawModel -like "azure/*") {
        $modelToUse = $rawModel
      }
      else {
        $modelToUse = "azure/$rawModel"
      }

      Write-Host "Executing OpenCode with prompt: '${{ parameters.prompt }}'"
      Write-Host "Using model: $modelToUse"
      
      # Execute OpenCode run command with the provided prompt and model
      $opencodeBinary = Join-Path "$env:HOME" ".opencode/bin"
      $env:PATH = "$env:PATH:$opencodeBinary"

      opencode auth list

      opencode run --model "$modelToUse" --print-logs --log-level "DEBUG" "${{ parameters.prompt }}"
      
  env:
    AZURE_API_KEY: $(chatgpt-key)
    AZURE_RESOURCE_NAME: $(ChatGpt.Name)
Originally created by @Eckii24 on GitHub (Nov 4, 2025). ### Question We currently try to create a Azure DevOps pipeline, which takes a prompt and a repository, executes opencode with the prompt and commits and pushes all made changes. When I execute this it stuck when calling opencode: ``` Executing OpenCode with prompt: 'hi' Using model: azure/gpt-5-mini ┌ Credentials ~/.local/share/opencode/auth.json │ └ 0 credentials ┌ Environment │ ● Azure AZURE_RESOURCE_NAME │ ● Azure AZURE_API_KEY │ └ 2 environment variables INFO 2025-11-04T10:36:49 +364ms service=default version=1.0.20 args=["run","--model","azure/gpt-5-mini","--print-logs","--log-level","DEBUG","hi"] opencode ``` It does not execute or log something else than this. Does anybody have an idea, what the issue might be here? My pipeline looks something like this: ```yaml trigger: - none parameters: - name: repositoryName displayName: 'Repository name to checkout' type: string default: '<repoName>' - name: prompt displayName: 'Prompt to execute with OpenCode' type: string default: '' - name: model displayName: 'Model to use' type: string default: 'gpt-5-mini' steps: # Install OpenCode - task: PowerShell@2 displayName: 'Install OpenCode' inputs: targetType: inline script: | Write-Host "Installing OpenCode..." curl -fsSL https://opencode.ai/install | bash $opencodeBinary = Join-Path "$env:HOME" ".opencode/bin" $env:PATH = "$env:PATH:$opencodeBinary" opencode --version # Checkout repository and execute OpenCode - task: PowerShell@2 displayName: 'Execute OpenCode on Repository' inputs: targetType: inline script: | [...] # checkout repo and cd into it # Prepare model with azure prefix if not already present $rawModel = "${{ parameters.model }}" if ($rawModel -like "azure/*") { $modelToUse = $rawModel } else { $modelToUse = "azure/$rawModel" } Write-Host "Executing OpenCode with prompt: '${{ parameters.prompt }}'" Write-Host "Using model: $modelToUse" # Execute OpenCode run command with the provided prompt and model $opencodeBinary = Join-Path "$env:HOME" ".opencode/bin" $env:PATH = "$env:PATH:$opencodeBinary" opencode auth list opencode run --model "$modelToUse" --print-logs --log-level "DEBUG" "${{ parameters.prompt }}" env: AZURE_API_KEY: $(chatgpt-key) AZURE_RESOURCE_NAME: $(ChatGpt.Name) ```
yindo added the opentui label 2026-02-16 17:36:17 -05:00
yindo closed this issue 2026-02-16 17:36:17 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 4, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2297: Feature request for Azure DevOps Integration - discusses similar challenges with running OpenCode in Azure DevOps pipelines and proposes solutions for pipeline integration

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 4, 2025): This issue might be a duplicate of existing issues. Please check: - #2297: Feature request for Azure DevOps Integration - discusses similar challenges with running OpenCode in Azure DevOps pipelines and proposes solutions for pipeline integration Feel free to ignore if none of these address your specific case.
Author
Owner

@Eckii24 commented on GitHub (Nov 4, 2025):

Issue is most probably related to:

ERROR: unexpected status 404 Not Found: {"error":{"code":"NotFound","message":"Azure OpenAI Responses API is not enabled in this region. Please check https://aka.ms/aoai/responsesapi/availability"}}

@Eckii24 commented on GitHub (Nov 4, 2025): Issue is most probably related to: `ERROR: unexpected status 404 Not Found: {"error":{"code":"NotFound","message":"Azure OpenAI Responses API is not enabled in this region. Please check https://aka.ms/aoai/responsesapi/availability"}}`
Author
Owner

@sschuetz2bit commented on GitHub (Jan 27, 2026):

@Eckii24 How did you resolve that or got the logs?
i have exactly the same issue, that it does not execute nor logs

@sschuetz2bit commented on GitHub (Jan 27, 2026): @Eckii24 How did you resolve that or got the logs? i have exactly the same issue, that it does not execute nor logs
Author
Owner

@Eckii24 commented on GitHub (Jan 27, 2026):

@sschuetz2bit we used codex 🙈

@Eckii24 commented on GitHub (Jan 27, 2026): @sschuetz2bit we used codex 🙈
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2572