loblaw-sre / backstage-plugin-gitlab

Backstage plugin for Gitlab
52 stars 31 forks source link

Feature request: Add log to debug interaction with GitLab #226

Open elucify opened 1 year ago

elucify commented 1 year ago

The instructions in the plugin say to "Link to an existing entity file Example: https://github.com/backstage/backstage/blob/master/catalog-info.yaml"

That URL produces the file in the UI (though not the raw version), but putting that in the Backstage UI produces a 400 from (presumably GitLab?)

Screenshot 2022-11-22 at 5 33 20 PM

There's nothing in the frontend or backend log that indicates what URL it tried to use, or how GitLab responded.

Maybe also the backend should be able to handle repositories URLs (/api/v4/projects/:id/repository/files/:filepath/raw?ref=branch) also. That URL would work, but the Backstage UI complains that it's not a file (I'm guessing because it doesn't end in .yaml).

Screenshot 2022-11-22 at 5 38 39 PM

Basically I have no way to write a URL that gets catalog-info.yaml that will be accepted by both the Backstage UI and the GitLab UI via a personal access token. And I'm kind of in the dark about where the problem is, because Backstage doesn't say what it's trying to do.

elucify commented 1 year ago

Trying the sort of URL recommended by the UI produces this:

Screenshot 2022-11-22 at 5 40 45 PM

Not too surprising, since this is what curl does:

$ curl -D - -H "PRIVATE-TOKEN: $GITLAB_TOKEN" 'https://gitlab.be-md.ncbi.nlm.nih.gov/..../project-slug/blob/backstage/catalog-info.yaml'
HTTP/1.1 302 Found
Server: nginx
Date: Tue, 22 Nov 2022 22:40:10 GMT
Content-Type: text/html; charset=utf-8
Location: https://gitlab.be-md.ncbi.nlm.nih.gov/users/sign_in
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: 01GJGQZBB26P8YTM672X3PV9MT
X-Runtime: 0.037568
X-Ua-Compatible: IE=edge
X-Xss-Protection: 1; mode=block
Strict-Transport-Security: max-age=63072000
Referrer-Policy: strict-origin-when-cross-origin

(Some headers redacted)