community-plugins icon indicating copy to clipboard operation
community-plugins copied to clipboard

🐛 Bug Report: Jenkins Plugin not working

Open razvanonet opened this issue 1 year ago • 10 comments

📜 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?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

None

razvanonet avatar Apr 09 '24 10:04 razvanonet

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?

freben avatar Apr 11 '24 13:04 freben

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.

razvanonet avatar Apr 12 '24 11:04 razvanonet

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

namrataahuja avatar May 24 '24 06:05 namrataahuja

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

refaelb avatar May 30 '24 09:05 refaelb

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?

vinzscam avatar Jun 04 '24 18:06 vinzscam

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.

jestevez-claro avatar Jun 08 '24 01:06 jestevez-claro

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

vinzscam avatar Jun 10 '24 09:06 vinzscam

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

awanlin avatar Jun 18 '24 14:06 awanlin

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

awanlin avatar Jul 02 '24 14:07 awanlin

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

awanlin avatar Jul 16 '24 14:07 awanlin

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.

github-actions[bot] avatar Sep 14 '24 18:09 github-actions[bot]