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

fix repo override -R | --repo #591

Merged
merged 3 commits into from
Jan 27, 2021
Merged

fix repo override -R | --repo #591

merged 3 commits into from
Jan 27, 2021

Conversation

profclems
Copy link
Owner

@profclems profclems commented Jan 27, 2021

Description

  1. Ensures repo override supports HOST/GROUP/NAMESPACE/REPO.

  2. Support for GROUP/NAMESPACE/REPO

    First, checks if the first part matches the default instance host (i.e. gitlab.com) or the overridden default host (mostly from the GITLAB_HOST env variable).

    Dots (.) are allowed in group names by GitLab. So we check if the first part contains a dot.
    However, it could be that the user is specifying a hostname but we can't be sure of that. So we check in the list of authenticated hosts and see if it matches any. if not, we assume it is a group name that contains a dot.

    if the first part is not a valid URL and does not match an authenticated hostname then we assume it is in the format GROUP/NAMESPACE/REPO

  3. Removes support for project ID

  4. Use PersistentPreRunE instead of PersistentPreRun to ensure errors are printed

Related Issue
Closes #589

- Ensures repo override supports HOST/GROUP/NAMESPACE/REPO.

**Support for GROUP/NAMESPACE/REPO**
First, checks if the first part matches the default instance host (i.e. gitlab.com) or the overridden default host (mostly from the GITLAB_HOST env variable).

Dots (.) are allowed in group names by GitLab.
So we check if if the first part contains a dot.
However, it could be that the user is specifying a hostname but we can't be sure of that
So we check in the list of authenticated hosts and see if it matches any
if not, we assume it is a group name that contains a dot

if the first part is not a valid URL, and does not match an
authenticated hostname then we assume it is in
the format GROUP/NAMESPACE/REPO
@codecov
Copy link

codecov bot commented Jan 27, 2021

Codecov Report

Merging #591 (1bd14ea) into trunk (d1770b5) will increase coverage by 0.00%.
The diff coverage is 64.44%.

Impacted file tree graph

@@           Coverage Diff           @@
##            trunk     #591   +/-   ##
=======================================
  Coverage   54.63%   54.64%           
=======================================
  Files         103      103           
  Lines        6946     6980   +34     
=======================================
+ Hits         3795     3814   +19     
- Misses       2791     2804   +13     
- Partials      360      362    +2     
Impacted Files Coverage Δ
commands/cmdutils/repo_override.go 0.00% <0.00%> (ø)
internal/git/url.go 100.00% <ø> (ø)
internal/utils/utils.go 40.62% <0.00%> (-4.99%) ⬇️
internal/glrepo/repo.go 96.84% <90.62%> (-3.16%) ⬇️
commands/release/list/release_list.go 75.60% <0.00%> (-4.88%) ⬇️

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 d1770b5...1bd14ea. Read the comment docs.

@profclems profclems requested review from maxice8 and zemzale January 27, 2021 03:02
@profclems profclems added the Fix This fixes a bug or incorrect documentation label Jan 27, 2021
Only public projects can be found using the project ID
@profclems profclems merged commit 17ef404 into trunk Jan 27, 2021
@profclems profclems deleted the fix-repo-override branch January 27, 2021 03:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fix This fixes a bug or incorrect documentation size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected behaviour of repo argument with other values than url
1 participant