Unable to use release command on GITLAB_HOSTNAME with leading prefix (www.)

Checklist

  • I'm using the latest version of the extension (Run glab --version)
    • Extension version: 1.57.0, same behaviour on 1.53.0
  • Operating system and version: macOS 15.5, same behaviour on Ubuntu 22.04
  • Gitlab.com or self-managed instance? self-managed instance
  • GitLab version (if self-managed) 18.0.1
  • 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: No useful output

Summary

In an environment with a Gitlab HTTP URL in format www.domain.com/gitlab the glab release command isn't working because it strips the www. prefix in the hostname. This leads to an unauthenticated call to the API, as the stripped hostname host can't be found in the glab configuration file.

Environment

  • OS: Darwin 24.5.0 arm64
  • SHELL: /opt/homebrew/bin/fish
  • TERM: xterm-256color
  • GLAB: glab 1.57.0 (d14f47ce)

Other:

The behaviour was reproduced locally on a MacOS client. The steps to reproduce are the ones that are executed in CI Pipelines in GitLab 18.0.1 when using the release keyword.

For us the release functionality in pipelines is broken because of this bug!

Steps to reproduce

❯ export GITLAB_HOST=https://www.domain.com/gitlab
❯ glab auth login --token glpat-*** --hostname www.domain.com/gitlab --api-protocol https
❯ glab -R path/to/repo release create "0.1.20250526175731-94e98696" --experimental-notes-text-or-file "Debug" --ref "94e98696b15c2f2d1d5a2e222b087bd0b8ec765e" --no-update --no-close-milestone
❯ cat ~/.config/glab-cli/config.yml
...
# Configuration specific for GitLab instances.
    www.nexmart.com/gitlab:
        token: glpat-***
        api_protocol: https

What is the current bug behavior?

glab -R path/to/repo release create "0.1.20250526175731-94e98696" --experimental-notes-text-or-file "Debug" --ref "94e98696076a3da94ca08ed5be89c526d4e5b977" --no-update --no-close-milestone
• Creating or updating release repo=path/to/repo tag=0.1.20250526175731-94e98696
x release failed after 0.13 seconds. error=404 Not Found

What is the expected correct behavior?

The hostname set in GITLAB_HOSTNAME is parsed correctly. The release is created.

Relevant logs and/or screenshots

In Webserver logs it can be seen that the hostname in the api call is "domain.com" not "www.domain.com".

Manually adding an authentication for domain.com fixes the problem as a workaround and confirms the bug behaviour.

❯ export GITLAB_HOST=https://www.domain.com/gitlab
❯ glab auth login --token glpat-*** --hostname domain.com/gitlab --api-protocol https
❯ glab -R dev/apps/playground/application-playground-service release create "0.1.20250526175731-94e98696" --experimental-notes-text-or-file "Debug" --ref "94e98696b15c2f2d1d5a2e222b087bd0b8ec765e" --no-update --no-close-milestone
 • Creating or updating release repo=path/to/repo tag=0.1.20250526175731-94e98696
 ✓ Release created: url=https://www.domain.com/path/to/repo/-/releases/0.1.20250526175731-94e98696
 ✓ Skipping closing milestones ✓ Release succeeded after 0.36 seconds.

Possible fixes

Assignee Loading
Time tracking Loading