Closed dfl-aeb closed 11 months ago
Can you post your Backstage gitlab configurations?
integrations:
gitlab:
- host: git.company.com
apiBaseUrl: https://git.company.com/gitlab/api/v4
baseUrl: https://git.company.com/gitlab
token: ${GITLAB_TOKEN}
proxy:
'/gitlabci':
target: 'https://git.company.com/gitlab/api/v4'
allowedMethods: ['GET', 'POST']
headers:
PRIVATE-TOKEN: '${GITLAB_TOKEN}'
gitlab: #for gitlab plugin: https://github.com/immobiliare/backstage-plugin-gitlab
defaultCodeOwnersPath: .gitlab/CODEOWNERS
The proxy is not needed anymore you can remove it. The URL you posted is right. PS: the processor doesn't do requests.
can you post the request error ?
The request is a simple get http://localhost:8080/api/gitlab/rest/git.company.com/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker
that results in a 404 not found
I mean the request done by the server. Because the client's request is correct, it should be formed this way.
[1] 2023-11-23T14:34:57.936Z backstage info ::1 - - [23/Nov/2023:14:34:57 +0000] "GET /api/gitlab/rest/git.company.com/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker?? HTTP/1.1" 404 35 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0" type=incomingRequest
[1] 2023-11-23T14:34:57.940Z gitlab debug [HPM] Rewriting path from "/api/gitlab/rest/git.company.com/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker??" to "/gitlab/api/v4/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker??" type=plugin
[1] 2023-11-23T14:34:58.036Z backstage info ::1 - - [23/Nov/2023:14:34:58 +0000] "GET /api/gitlab/rest/git.company.com/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker?? HTTP/1.1" 404 35 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0" type=incomingRequest
[1] 2023-11-23T14:34:58.038Z gitlab debug [HPM] Rewriting path from "/api/gitlab/rest/git.company.com/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker??" to "/gitlab/api/v4/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker??" type=plugin
[1] 2023-11-23T14:34:58.139Z backstage info ::1 - - [23/Nov/2023:14:34:58 +0000] "GET /api/gitlab/rest/git.company.com/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker?? HTTP/1.1" 404 35 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0" type=incomingRequest
The 404 error occurs because the project is prefixed with the subpath from our gitlab instance /gitlab
Rewriting path from "/api/gitlab/rest/git.company.com/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker??" to "/gitlab/api/v4/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker??"
Rewriting path from "/api/gitlab/rest/git.company.com/projects/
+gitlab
%2Fgenc%2Finfrastructure%2Fdocker??"
to
"/gitlab/api/v4/projects/
+gitlab
%2Fgenc%2Finfrastructure%2Fdocker??"
The right path should be /api/gitlab/rest/git.company.com/projects/genc%2Finfrastructure%2Fdocker??
`/api/gitlab/rest/git.company.com/projects/
-gitlab
genc%2Finfrastructure%2Fdocker??`
I think the problem is related to the gitlab configuration only using the host
config value instead of the baseUrl
specified here
mm it is strange, can you post the annonations inside the entity?
'gitlab.com/project-slug'
'gitlab.com/instance'
This error only occurs, when we don't set any annotation.
When setting gitlab.com/project-slug: genc/applications/genc/infrastructure/docker
everthing works as expected
If you go to backstage entity without setting the annotations, you click on three dots in the top right corner, you click inspect entity, and you can see the annotations assigned by the processor. Can you post the values of them?
gitlab.com/instance:
git.company.com/gitlab
gitlab.com/project-slug:
gitlab/genc/applications/genc/infrastructure/docker
Ok, the project slug is wrong. I created a PR to fix it.
Amazing, thanks for your quick help!
@dfl-aeb I created a new prerelease. Can you test it? Let me know if it works now!
That fixed it! Thank you again :)
Ok thank you, I release the new version.
I'm experiencing an issue because our self hosted gitlab instance runs under a subpath. e.g.
git.company.com/gitlab
When trying to access
git.company.com/gitlab/genc/infrastructure/docker
the GitLab Filler Processor tries to callgit.company.com/projects/gitlab/genc/infrastructure/docker
instead ofgit.company.com/gitlab/projects/genc/infrastructure/docker
-->http://localhost:8080/api/gitlab/rest/git.company.com/projects/gitlab%2Fgenc%2Finfrastructure%2Fdocker
Maybe related to: https://github.com/immobiliare/backstage-plugin-gitlab/issues/236
Everything else works fine, just the gitlab filler processor does not.