improve support for branches with slashes
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-jenkins-backend': patch
|
||||
---
|
||||
|
||||
Fix handling of slashes in branch names
|
||||
@@ -173,6 +173,7 @@ describe('JenkinsApi', () => {
|
||||
'foo',
|
||||
'bar',
|
||||
'catpants',
|
||||
'with-a/slash',
|
||||
]);
|
||||
|
||||
expect(mockedJenkins).toHaveBeenCalledWith({
|
||||
@@ -192,6 +193,10 @@ describe('JenkinsApi', () => {
|
||||
name: `${jenkinsInfo.jobFullName}/catpants`,
|
||||
tree: expect.anything(),
|
||||
});
|
||||
expect(mockedJenkinsClient.job.get).toHaveBeenCalledWith({
|
||||
name: `${jenkinsInfo.jobFullName}/with-a%2Fslash`,
|
||||
tree: expect.anything(),
|
||||
});
|
||||
expect(result).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ export class JenkinsApiImpl {
|
||||
const job = await Promise.any(
|
||||
branches.map(branch =>
|
||||
client.job.get({
|
||||
name: `${jenkinsInfo.jobFullName}/${branch}`,
|
||||
name: `${jenkinsInfo.jobFullName}/${encodeURIComponent(branch)}`,
|
||||
tree: JenkinsApiImpl.jobTreeSpec.replace(/\s/g, ''),
|
||||
}),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user