Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Fix hostnames resolution #667

Merged
merged 1 commit into from
Apr 30, 2021
Merged

Conversation

zemzale
Copy link
Collaborator

@zemzale zemzale commented Mar 25, 2021

Description
When overriding host, we now strip protocol from the URL, since we don't need that and it would break config key lookups.

Related Issue
Resolves #592

How Has This Been Tested?

Locally tested with self-hosted GitLab instance
Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)

@codecov
Copy link

codecov bot commented Mar 25, 2021

Codecov Report

Merging #667 (b520c9c) into trunk (c443358) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            trunk     #667      +/-   ##
==========================================
- Coverage   60.00%   59.98%   -0.02%     
==========================================
  Files          90       90              
  Lines        6458     6460       +2     
==========================================
  Hits         3875     3875              
- Misses       2218     2220       +2     
  Partials      365      365              
Impacted Files Coverage Δ
cmd/glab/main.go 40.22% <0.00%> (-0.95%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c443358...b520c9c. Read the comment docs.

internal/glinstance/host.go Outdated Show resolved Hide resolved
@clemsbot
Copy link
Collaborator

This PR has been automatically marked as stale because it has not had recent activity. This message is just a reminder for the author, reviewers and assignees.

@clemsbot clemsbot added the stale label Apr 26, 2021
When trying to override host with full URLs, config key lookups would
fail. This came down to the fact that we use `my.gitlab.com` as config
key and when providing override as `https://my.gitlab.com/` it would
fail to find this config key.

Issue profclems#592
@zemzale zemzale requested a review from profclems April 28, 2021 10:58
@zemzale zemzale removed the stale label Apr 28, 2021
@zemzale zemzale marked this pull request as ready for review April 28, 2021 14:45
@profclems profclems merged commit 3b1a0d5 into profclems:trunk Apr 30, 2021
profclems added a commit that referenced this pull request Apr 30, 2021
This allows overriding the default protocol of the hostname if a fully qualified url is provided when using the `GITLAB_HOST` environment variable.
For example, if the GITLAB_HOST=http://my.glinstance.org, then the host will be set to my.glinstance.org and the protocol become http, unlike before when the protocol was ignored and only the hostname was considered.

This is a follow-up for #678
and #667
profclems added a commit to olearycrew/glab that referenced this pull request Jun 12, 2021
This allows overriding the default protocol of the hostname if a fully qualified url is provided when using the `GITLAB_HOST` environment variable.
For example, if the GITLAB_HOST=http://my.glinstance.org, then the host will be set to my.glinstance.org and the protocol become http, unlike before when the protocol was ignored and only the hostname was considered.

This is a follow-up for profclems#678
and profclems#667
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GITLAB_{URI,HOST} lead to failure if scheme is provided, documentation doesn't match what code needs
3 participants