Release download can't be cancelled via CTRL+C

Checklist

  • I'm using the latest version of the extension (Run glab --version)
  • Operating system and version: Ubuntu 24.04.3 LTS
  • Gitlab.com or self-managed instance? both
  • GitLab version (if self-managed) 18.8.4-ee
  • I have performed glab auth status to check for authentication issues
  • Run the command in debug mode (like DEBUG=true glab mr list) and attach any useful output

Summary

glab release download does not honor context cancellation, e.g. does not interrupt on CTRL+C in the terminal.

Environment

  • OS: Ubuntu 24.04.3 LTS
  • SHELL: /bin/bash
  • TERM: terminator 2.1.5; xterm-256color
  • GLAB: glab 1.81.0 (01fd7984)

Other:

  • Reproduced in unit test using httptest with a canceled context.

Steps to reproduce

  1. Configure glab against any GitLab host and run glab release download.
  2. Trigger cancellation/timeout (for example Ctrl+C, parent context cancel, or short timeout).
  3. Observe behavior during the download request.

What is the current bug behavior?

The HTTP request can continue instead of returning promptly with context cancellation.

What is the expected correct behavior?

The download request should use the command context and return context.Canceled (or timeout error) immediately when canceled.

Possible fixes

Attach context in request creation:

  • internal/commands/release/download/download.go:231
    • Add gitlab.WithContext(ctx) to client.NewRequestToURL(...) options so cancellation propagates. /label typebug devopscreate groupcode review Category:GitLab CLI cli
Assignee Loading
Time tracking Loading