Skip to content

Commit 5aa4f93

Browse files
committed
Bug 1972705 - use treestatus for git repository variant
1 parent efaa441 commit 5aa4f93

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

tests/ui/job-view/SecondaryNavBar_test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ const router = { location: history.location };
1919

2020
beforeEach(() => {
2121
fetchMock.get(
22-
'https://treestatus.prod.lando.prod.cloudops.mozgcp.net/trees/autoland',
22+
'https://treestatus.prod.lando.prod.cloudops.mozgcp.net/trees/firefox-autoland',
2323
{
2424
result: {
2525
message_of_the_day: '',
2626
reason: '',
2727
status: 'open',
28-
tree: 'autoland',
28+
tree: 'firefox-autoland',
2929
},
3030
},
3131
);

ui/models/treeStatus.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import { thHosts } from '../helpers/constants';
22

3+
const repoMap = new Map(
4+
Object.entries({
5+
autoland: 'firefox-autoland',
6+
'mozilla-central': 'firefox-main',
7+
'mozilla-beta': 'firefox-beta',
8+
'mozilla-release': 'firefox-release',
9+
}),
10+
);
11+
312
let _treeStatusApiUrl;
413
let _treeStatusUiUrl;
514
for (const [hostPrettyName, config] of Object.entries(thHosts)) {
@@ -23,7 +32,13 @@ const apiUrl = `${_treeStatusApiUrl}trees/`;
2332

2433
export default class TreeStatusModel {
2534
static get(repoName) {
26-
return fetch(`${apiUrl}${repoName}`)
35+
let repoNameGit = repoName;
36+
if (repoMap.has(repoName)) {
37+
repoNameGit = repoMap.get(repoName);
38+
} else if (repoName.includes('-esr')) {
39+
repoNameGit = `firefox-esr${repoName.split('-esr')[1]}`;
40+
}
41+
return fetch(`${apiUrl}${repoNameGit}`)
2742
.then(async (resp) => {
2843
if (resp.ok) {
2944
return resp.json();
@@ -35,7 +50,7 @@ export default class TreeStatusModel {
3550
status: 'unsupported',
3651
message_of_the_day: '',
3752
reason: '',
38-
tree: repoName,
53+
tree: repoNameGit,
3954
},
4055
});
4156
}
@@ -47,7 +62,7 @@ export default class TreeStatusModel {
4762
status: 'error',
4863
message_of_the_day: `Unable to connect to the ${apiUrl} API`,
4964
reason: reason.toString(),
50-
tree: repoName,
65+
tree: repoNameGit,
5166
},
5267
}),
5368
);

0 commit comments

Comments
 (0)