Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration of self hosted gitlab not working #236

Closed
Santonian opened this issue Jun 6, 2023 · 23 comments
Closed

integration of self hosted gitlab not working #236

Santonian opened this issue Jun 6, 2023 · 23 comments
Labels

Comments

@Santonian
Copy link

we have self hosted gitlab and I setup the integration like so:

integrations:
gitlab:
- host: gitlab.xxxxx.de
token: MY-TOKEN
apiBaseUrl: https://gitlab.xxxxx.de/api/v4
baseUrl: http:https://gitlab.xxxxx.de

The basic backstage installation cann work with this and can read catalog files from my gitlab repositories.

But the gitlab plugin gives me all kind of 404, when I try to open the gitlab tab of an entity:

... 1] 2023-06-06T08:27:11.419Z backstage info ::ffff:127.0.0.1 - - [06/Jun/2023:08:27:11 +0000] "GET /api/gitlab/gitlab.com/projects/1415/languages? HTTP/1.1" 404 35 "http:https://localhost:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0" type=incomingRequest [1] 2023-06-06T08:27:11.445Z backstage info ::ffff:127.0.0.1 - - [06/Jun/2023:08:27:11 +0000] "GET /api/gitlab/gitlab.com/projects/1415/merge_requests? HTTP/1.1" 404 35 "http:https://localhost:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0" type=incomingRequest [1] 2023-06-06T08:27:11.468Z backstage info ::ffff:127.0.0.1 - - [06/Jun/2023:08:27:11 +0000] "GET /api/gitlab/gitlab.com/projects/1415? HTTP/1.1" 404 35 "http:https://localhost:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0" type=incomingRequest [1] 2023-06-06T08:27:11.668Z backstage info ::ffff:127.0.0.1 - - [06/Jun/2023:08:27:11 +0000] "GET /api/gitlab/gitlab.com/projects/1415? HTTP/1.1" 404 35 "http:https://localhost:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0" type=incomingRequest [1] 2023-06-06T08:27:11.674Z backstage info ::ffff:127.0.0.1 - - [06/Jun/2023:08:27:11 +0000] "GET /api/gitlab/gitlab.com/projects/1415/repository/contributors?sort=desc HTTP/1.1" 404 35 "http:https://localhost:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0" type=incomingRequest [1] 2023-06-06T08:27:11.679Z backstage info ::ffff:127.0.0.1 - - [06/Jun/2023:08:27:11 +0000] "GET /api/gitlab/gitlab.com/projects/1415? HTTP/1.1" 404 35 "http:https://localhost:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0" type=incomingRequest [ ...

did I miss something or is the plugin not working with self hosted gitlab installations?

@mrs83
Copy link
Contributor

mrs83 commented Jun 7, 2023

same issue here. I followed the migration guide step by step 🤔

@rolandsgs
Copy link

It looks like that is trying to connect to gitlab.com and not to gitlab.xxxx.de. Did you set the gitlab provider under catalog with host value with the same value in host at integrations?

Gitlab Discovery

@antoniomuso
Copy link
Contributor

antoniomuso commented Jun 7, 2023

The plugin works with self hosted gitlab instance. But it seems that you are not using the processor or that processor is now working correctly.
Have you followed section 5. of the readme?

@antoniomuso
Copy link
Contributor

antoniomuso commented Jun 7, 2023

Can you post the value of the annotation gitlab.com/instance? You can find it by going into inspect entity (the three dots in the top right corner) and going on Raw YAML (this should be done on the entity page).

@mrs83
Copy link
Contributor

mrs83 commented Jun 8, 2023

@antoniomuso sure, I will post the value 👍 btw, I have followed section 5 of README.md

@Santonian
Copy link
Author

Ok, this is strange, after removing "integrations.gitlab.baseUrl" from the app-config.yaml it is working. after adding it again, it stops working again.

I don't see why there is a relationship between these two things.. anyway, just glad that it's finally working.

@antoniomuso
Copy link
Contributor

Ok, this is strange, after removing "integrations.gitlab.baseUrl" from the app-config.yaml it is working. after adding it again, it stops working again.

I don't see why there is a relationship between these two things.. anyway, just glad that it's finally working.

Now I am seeing that you have put HTTP for baseUrl and HTTPS for apiBaseUrl is this right?

@Santonian
Copy link
Author

Ok, this is strange, after removing "integrations.gitlab.baseUrl" from the app-config.yaml it is working. after adding it again, it stops working again.
I don't see why there is a relationship between these two things.. anyway, just glad that it's finally working.

Now I am seeing that you have put HTTP for baseUrl and HTTPS for apiBaseUrl is this right?

you are absolutely right. What a stupid thing for me to do. I tried again with https:https://... and now it works even with the baseUrl set.
Still a strange behavior though.

@mrs83
Copy link
Contributor

mrs83 commented Jun 13, 2023

value of gitlab.com/instance was not found in my case, that's probably why it was not working

@antoniomuso
Copy link
Contributor

Can you post your configurations? The processor adds the instance base on backstage.io/source-location What kind of source location do you have?

@mrs83
Copy link
Contributor

mrs83 commented Jun 13, 2023

I can't post the configurations right now but they are almost the same as described by @Santonian . the source location has catalog-info.yaml files that already have gitlab annotation gitlab.com/project-id. adding gitlab.com/instance: 'gitlab.hostname.xyz'to the catalog files made the plugin working for those catalog entities

@antoniomuso
Copy link
Contributor

antoniomuso commented Jun 13, 2023

What kind of entity are you using for the test?

@ccarbonellbh
Copy link

ccarbonellbh commented Jun 29, 2023

I am having a similar issue and had to add gitlab.com/instance and gitlab.com/project-id to annotations for my component. Doing that gets me further along the loading process, but now I get 401s, despite the fact that I'm logging into backstage with gitlab as the auth provider (with no issues). The url it's hitting where I get the 401 is http:https://localhost:7007/api/gitlab/{our.gitlab.instance}/projects/{project_id}?. I see the token in the Authorization header but it's always invalid according to the response. Wondering what I'm missing as I also went through all the non-optional steps in the readme

@kjenney
Copy link

kjenney commented Oct 6, 2023

I have similar issues. I just installed and configured the plugin today with the latest README. There is no mention of apiBaseUrl in the README, but it is required - at least for self-hosted instances.

Without apiBaseUrl everything crashes with:

Backend failed to start up Error: Invalid Gitlab integration config, 'undefined' is not a valid apiBaseUrl

After adding apiBaseUrl I'm getting a bunch of wrong project_slug or project_id errors in the GitLab tab. I've verified that my personal access token does work and that the project_id is correct - both using curl:

curl --header 'PRIVATE-TOKEN: redacted' https://gitlab.private.io/api/v4/projects/2/

I followed all of the required steps - none of the optional steps.

@kjenney
Copy link

kjenney commented Oct 6, 2023

I ended up resolving my issue by adding the gitlab.com/instance: gitlab.private.io annotation. The README lists this as an or but apparently it is not.

Thanks everybody who works on this project!!

@kjenney
Copy link

kjenney commented Oct 6, 2023

Created PR - #319 to update the README.

@antoniomuso
Copy link
Contributor

This is not the right solution, the code should automatically build the gitlab.com/instance annotation

@kjenney
Copy link

kjenney commented Oct 9, 2023

In your opinion this is not the right solution...If you have multiple instances you'd have to differentiate them.

@antoniomuso
Copy link
Contributor

antoniomuso commented Oct 9, 2023

If you post the info regarding your problem, we can find the problem (For example, the requests done in the browser). Because the differentiation of instances is done automatically by code if you use the Backstage GitLab plugin.

@kjenney
Copy link

kjenney commented Oct 9, 2023

If this is a better solution to automatically annotating based on instances set in configuration, please explain how this is done. It is not apparent by reading through the README.

@antoniomuso
Copy link
Contributor

antoniomuso commented Oct 17, 2023

The Gitlab Filler Processor does the auto-annotation. If you want to integrate it, follow point .5 of the Setup:

5. Add the GitLab Filler Processor, this allows auto-filling of the annotations like the project ID and slug:

@kjenney
Copy link

kjenney commented Oct 19, 2023

The Gitlab Filler Processor does the auto-annotation. If you want to integrate it, follow point .5 of the Setup:

5. Add the GitLab Filler Processor, this allows auto-filling of the annotations like the project ID and slug:

Thanks! I see the code here. I'll try it out.

Copy link

github-actions bot commented Dec 5, 2023

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Dec 5, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants