Skip to content

Commit

Permalink
Bug 1896687 - Switch Treeherder production to use the new Treestatus …
Browse files Browse the repository at this point in the history
…hosts
  • Loading branch information
Archaeopteryx committed May 14, 2024
1 parent 0d72ce8 commit 3b40cf7
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 49 deletions.
17 changes: 10 additions & 7 deletions tests/ui/job-view/AppHistory_test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ describe('history', () => {
fetchMock.get(getApiUrl('/performance/framework/'), {});
fetchMock.get(getApiUrl('/user/'), []);
fetchMock.get(getApiUrl('/failureclassification/'), []);
fetchMock.get('begin:https://treestatus.mozilla-releng.net/trees/', {
result: {
message_of_the_day: '',
reason: '',
status: 'open',
tree: repoName,
fetchMock.get(
'begin:https://treestatus.prod.lando.prod.cloudops.mozgcp.net/trees/',
{
result: {
message_of_the_day: '',
reason: '',
status: 'open',
tree: repoName,
},
},
});
);
fetchMock.get(
`begin:${getProjectUrl('/push/?full=true&count=', repoName)}`,
{
Expand Down
17 changes: 10 additions & 7 deletions tests/ui/job-view/App_test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ describe('App', () => {

beforeAll(() => {
// tests will pass without this, but a lot of console warnings/errors
fetchMock.get('begin:https://treestatus.mozilla-releng.net/trees/', {
result: {
message_of_the_day: '',
reason: '',
status: 'open',
tree: repoName,
fetchMock.get(
'begin:https://treestatus.prod.lando.prod.cloudops.mozgcp.net/trees/',
{
result: {
message_of_the_day: '',
reason: '',
status: 'open',
tree: repoName,
},
},
});
);

fetchMock.get(getApiUrl('/repository/'), reposFixture);
fetchMock.get(getApiUrl('/performance/framework/'), {});
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/job-view/Filtering_test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Filtering', () => {
fetchMock.get(getApiUrl('/failureclassification/'), []);
fetchMock.get(`begin:${bzBaseUrl}rest/bug`, emptyBzResponse);
fetchMock.get(
'begin:https://treestatus.mozilla-releng.net/trees/',
'begin:https://treestatus.prod.lando.prod.cloudops.mozgcp.net/trees/',
treeStatusResponse,
);
fetchMock.get(
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/job-view/SecondaryNavBar_test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const router = { location: history.location };

beforeEach(() => {
fetchMock.get(
'https://treestatus.dev.lando.nonprod.cloudops.mozgcp.net/trees/autoland',
'https://treestatus.prod.lando.prod.cloudops.mozgcp.net/trees/autoland',
{
result: {
message_of_the_day: '',
Expand Down
17 changes: 10 additions & 7 deletions tests/ui/push-health/PlatformConfig_test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ const { jobs } = pushHealth;
const testFailure = pushHealth.metrics.tests.details.needInvestigation[2];

beforeEach(() => {
fetchMock.get('https://treestatus.mozilla-releng.net/trees/autoland', {
result: {
message_of_the_day: '',
reason: '',
status: 'open',
tree: 'autoland',
fetchMock.get(
'https://treestatus.prod.lando.prod.cloudops.mozgcp.net/trees/autoland',
{
result: {
message_of_the_day: '',
reason: '',
status: 'open',
tree: 'autoland',
},
},
});
);
setUrlParam('repo', repoName);
fetchMock.get(getProjectUrl('/jobs/285857770/', repoName), fullJob);
fetchMock.get(getProjectUrl('/jobs/285852303/', repoName), fullJob);
Expand Down
2 changes: 1 addition & 1 deletion treeherder/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"font-src 'self' https://fonts.gstatic.com",
# The `data:` is required for images that were inlined by webpack's url-loader (as an optimisation).
"img-src 'self' data:",
"connect-src 'self' https://community-tc.services.mozilla.com https://firefox-ci-tc.services.mozilla.com https://*.taskcluster-artifacts.net https://taskcluster-artifacts.net https://treestatus.mozilla-releng.net https://treestatus.dev.lando.nonprod.cloudops.mozgcp.net https://bugzilla.mozilla.org https://auth.mozilla.auth0.com https://stage.taskcluster.nonprod.cloudops.mozgcp.net https://insights-api.newrelic.com https://prototype.treeherder.nonprod.cloudops.mozgcp.net https://treeherder.allizom.org",
"connect-src 'self' https://community-tc.services.mozilla.com https://firefox-ci-tc.services.mozilla.com https://*.taskcluster-artifacts.net https://taskcluster-artifacts.net https://lando.services.mozilla.com https://bugzilla.mozilla.org https://auth.mozilla.auth0.com https://stage.taskcluster.nonprod.cloudops.mozgcp.net https://insights-api.newrelic.com https://prototype.treeherder.nonprod.cloudops.mozgcp.net https://treeherder.allizom.org",
# Required since auth0-js performs session renewals in an iframe.
"frame-src 'self' https://auth.mozilla.auth0.com",
]
Expand Down
24 changes: 2 additions & 22 deletions ui/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,21 @@ import closedTreeFavicon from '../img/tree_closed.png';
export const thHosts = {
production: {
host: 'treeherder.mozilla.org',
treestatus: {
uiUrl: 'https://treestatus.mozilla-releng.net/static/ui/treestatus/',
apiUrl: 'https://treestatus.mozilla-releng.net/',
},
},
stage: {
host: 'treeherder.allizom.org',
treestatus: {
uiUrl: 'https://ui.dev.lando.nonprod.cloudops.mozgcp.net/treestatus/',
apiUrl: 'https://treestatus.dev.lando.nonprod.cloudops.mozgcp.net/',
},
},
prototype: {
host: 'prototype.treeherder.nonprod.cloudops.mozgcp.net',
treestatus: {
uiUrl: 'https://ui.dev.lando.nonprod.cloudops.mozgcp.net/treestatus/',
apiUrl: 'https://treestatus.dev.lando.nonprod.cloudops.mozgcp.net/',
},
},
localhost: {
host: 'localhost',
treestatus: {
uiUrl: 'https://ui.dev.lando.nonprod.cloudops.mozgcp.net/treestatus/',
apiUrl: 'https://treestatus.dev.lando.nonprod.cloudops.mozgcp.net/',
},
},
default: {
host: null,
treestatus: {
uiUrl: 'https://treestatus.mozilla-releng.net/static/ui/treestatus/',
apiUrl: 'https://treestatus.mozilla-releng.net/',
/*
uiUrl: 'https://ui.dev.lando.nonprod.cloudops.mozgcp.net/treestatus/',
apiUrl: 'https://treestatus.dev.lando.nonprod.cloudops.mozgcp.net/',
*/
uiUrl: 'https://lando.services.mozilla.com/treestatus/',
apiUrl: 'https://treestatus.prod.lando.prod.cloudops.mozgcp.net/',
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion ui/job-view/headerbars/WatchedRepo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default class WatchedRepo extends React.Component {
)}
<DropdownItem
tag="a"
href={`${treeStatusUiUrl()}show/${watchedRepo}`}
href={`${treeStatusUiUrl()}${watchedRepo}`}
target="_blank"
rel="noopener noreferrer"
>
Expand Down
4 changes: 2 additions & 2 deletions ui/models/treeStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ let _treeStatusApiUrl;
let _treeStatusUiUrl;
for (const [hostPrettyName, config] of Object.entries(thHosts)) {
if (config.host === window.location.hostname) {
_treeStatusApiUrl = thHosts[hostPrettyName].treestatus.apiUrl;
_treeStatusUiUrl = thHosts[hostPrettyName].treestatus.uiUrl;
_treeStatusApiUrl = thHosts[hostPrettyName]?.treestatus?.apiUrl;
_treeStatusUiUrl = thHosts[hostPrettyName]?.treestatus?.uiUrl;
}
}
if (_treeStatusApiUrl === undefined) {
Expand Down

0 comments on commit 3b40cf7

Please sign in to comment.