Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

Support self-hosted Gitlab instances #2

Closed
aboyett opened this issue Dec 18, 2019 · 4 comments
Closed

Support self-hosted Gitlab instances #2

aboyett opened this issue Dec 18, 2019 · 4 comments
Labels
Milestone

Comments

@aboyett
Copy link

aboyett commented Dec 18, 2019

A number of organizations host their own Gitlab instances rather than use gitlab.com, including both Debian[1] and GNOME[2]. I would like to be able to use citop with multiple Gitlab instances.

It looks like the gitlab provider code in citop does not support a URL field to map a given gitlab provider/API key to a specific instance of gitlab. I would like to see an addition of such a field, so I could define the following providers in citop.toml

[[providers.gitlab]]
name = "gitlab.com"
url = "https://gitlab.com"
token = "myToken"

[[providers.gitlab]]
name = "debian"
url = "https://salsa.debian.org"
token = "myDebianToken"

[[providers.gitlab]]
name = "gnome"
url = "https://gitlab.gnome.org"
token = "myGnomeToken"

Using url as the field name keeps the definition consistent with the existing implementation in the Travis provider.

Let me know if you would prefer this come in as a community contribution, I could have a go at adding support.

[1] https://salsa.debian.org/public
[2] https://gitlab.gnome.org/

@nbedos
Copy link
Owner

nbedos commented Dec 19, 2019

Thanks for the suggestion. This should be fixed in version 0.1.1: you can now specify url = "https://custom.gitlab.instance.com" in the configuration file.

@aboyett
Copy link
Author

aboyett commented Dec 19, 2019

Thanks for the quick response. I have a project that exists both on gitlab.com and a private gitlab instance and my local git repo is configured with two remotes pointing to both of them. I am now running citop 0.1.1 and have both [[providers.gitlab]] sections defined in citop.toml. When on a branch that has been pushed to both instances, running citop only shows the gitlab.com pipeline corresponding to the current commit; this persists even when I swap the order of gitlab provider definitions in the config. If I run citop -r url_to_private_gitlab_repo then I see the pipeline corresponding to the current commit on the private gitlab instance.

I expected to see both the gitlab.com and private gitlab instance pipelines when running citop without arguments, do you consider this expected behaviour reasonable?

@nbedos
Copy link
Owner

nbedos commented Dec 19, 2019

I expected to see both the gitlab.com and private gitlab instance pipelines when running citop without arguments, do you consider this expected behaviour reasonable?

It's a restriction that made things simpler but it's not ideal. I've opened #3 on this subject and will look into it:

Currently citop supports monitoring just one repository:

* When running `citop`, the repository monitored is the one associated to the remote named `origin` of the current git repository

* When running `citop -r <URL>`, only a single URL is accepted

It would be desirable to monitor all the remotes of a local repository and accept multiple URLs on the command line.

From your comment I understand that you can successfully monitor the pipelines on multiple GitLab instances (but not at the same time for now) so I will close this issue. Thanks for your help!

@nbedos nbedos closed this as completed Dec 19, 2019
@aboyett
Copy link
Author

aboyett commented Dec 19, 2019

Thank you for implementing so promptly! I'll track #3

@nbedos nbedos added this to the 0.1.1 milestone Dec 20, 2019
@nbedos nbedos added the enhancement New feature or request label Dec 20, 2019
@nbedos nbedos added the GitLab label Jan 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants