Merge pull request #11683 from nodify-at/master

bugfix: provide backstage token for rebuild api call
This commit is contained in:
Patrik Oldsberg
2022-05-30 14:11:18 +02:00
committed by GitHub
2 changed files with 9 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-jenkins-backend': patch
---
bug fix: provide backstage token for rebuild api call
@@ -131,6 +131,9 @@ export async function createRouter(
'/v1/entity/:namespace/:kind/:name/job/:jobFullName/:buildNumber::rebuild',
async (request, response) => {
const { namespace, kind, name, jobFullName } = request.params;
const token = getBearerTokenFromAuthorizationHeader(
request.header('authorization'),
);
const jenkinsInfo = await jenkinsInfoProvider.getInstance({
entityRef: {
kind,
@@ -138,10 +141,8 @@ export async function createRouter(
name,
},
jobFullName,
backstageToken: token,
});
const token = getBearerTokenFromAuthorizationHeader(
request.header('authorization'),
);
const resourceRef = stringifyEntityRef({ kind, namespace, name });
await jenkinsApi.buildProject(jenkinsInfo, jobFullName, resourceRef, {