backstage / community-plugins

Community plugins for Backstage
Apache License 2.0
141 stars 140 forks source link

πŸ› Bug Report: Jenkins Plugin not working #501

Open razvanonet opened 5 months ago

razvanonet commented 5 months ago

πŸ“œ Description

I have set up the Jenkins plugin for frontend using the documentation here and the one for backend using the documentation here. For backend, I have done what's under the New Backend System because we're using the latest version of Backstage. I have set my jenkins configuration in app-config using a token created in Jenkins using the instructions here and the token is in plain text exactly as in the documentation for the plugin.

I have also added this annotation "jenkins.io/job-full-name": MyProject/main and changed it multiple times without luck.

Using the token, I can connect to Jenkins using Basic Authorization

The documentation is outdated and I can't find a way to implement a custom Jenkins Info Provider using the new backend system

πŸ‘ Expected behavior

Successfully connect to Jenkins and show the component inside Backstage CI/CD

πŸ‘Ž Actual Behavior with Screenshots

it doesn't load anything and just returns 404 whatever configuration I do. the call to /projects is always http://localhost:7007/api/jenkins/v1/entity/default/Component/my-backstage/projects and changing the annotations in catalog-info doesn't help

image

πŸ‘Ÿ Reproduction steps

set up the Jenkins plugin for frontend using the documentation here and the one for backend using the documentation here.

πŸ“ƒ Provide the context for the Bug.

No response

πŸ–₯️ Your Environment

No response

πŸ‘€ Have you spent some time to check if this bug has been raised before?

🏒 Have you read the Code of Conduct?

Are you willing to submit PR?

None

freben commented 5 months ago

Did you still do the yarn --cwd packages/backend add @backstage/plugin-jenkins-backend? That's required for both the old and new systems.

Nothing interesting in the backend logs during startup and/or when visiting the page in question?

razvanonet commented 5 months ago

hey @freben. thanks for answering

I did everything in the docs. Installed the backend and frontend plugins and for the backend I've also added it inside index.ts.

namrataahuja commented 3 months ago

Hi I am getting similar issue. Any updates on this?

I see the following in backstage logs: [1] 2024-05-24T06:46:53.121Z backstage info ::1 - - [24/May/2024:06:46:53 +0000] "GET /api/jenkins/v1/entity/default/Component/XXXXX/projects HTTP/1.1" 404 - "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" type=incomingRequest

I used the following backstage-community documentation: https://github.com/backstage/community-plugins/tree/main/workspaces/jenkins

added jenkins (frontend) and jenkins-backend (backend)

Please note, for our application authentication and permission is already added

refaelb commented 3 months ago

Hey I am getting similar issue but I get the following error: {name: "AuthenticationError", message: "Cannot read properties of undefined (reading 'getBaseUrl'

this is configuration on app-config file:

jenkins: baseUrl: 'http://localhost:8080' username: admin apiKey: xxx

vinzscam commented 3 months ago

Hey I am getting similar issue but I get the following error: {name: "AuthenticationError", message: "Cannot read properties of undefined (reading 'getBaseUrl'

this is configuration on app-config file:

jenkins: baseUrl: 'http://localhost:8080' username: admin apiKey: xxx

are you using the new backend system?

jestevez-claro commented 3 months ago

I'm getting similar errors with this:

I've already followed documentation and configured jenkins pluging:

image

But when I click on the Link in the Build column, I get no info about that build:

image

Network tab on Browser's DevTools shows this:

{ "error": { "name": "AuthenticationError", "message": "Missing credentials", "stack": "AuthenticationError: Missing credentials\n at DefaultHttpAuthService.credentials (/root/backstage-app-tse/node_modules/@backstage/backend-app-api/src/services/implementations/httpAuth/httpAuthServiceFactory.ts:150:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)" }, "request": { "method": "GET", "url": "/api/jenkins/v1/entity/default/Component/my-dotnet-api/job/TSE_Cloud/estevez/jenkins-estevez/17" }, "response": { "statusCode": 401 } }

I could query the job through Jenkins API directly, I think the URL that Jenkins plugin is trying to request is not correct.

vinzscam commented 3 months ago

Have you configured an authentication provider? If not, the issue might be related

awanlin commented 3 months ago

This might be fixed by the fetchApi PR in the works, will follow up with details on that.

awanlin commented 2 months ago

Hoping that when this gets released it should be fixed: https://github.com/backstage/community-plugins/pull/584 🀞

awanlin commented 2 months ago

Hi @razvanonet, a new version is out, can you try again with that, please?

github-actions[bot] commented 3 days ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.