Bug 1241535 - Add support to job actions for collecting gecko profiles of performance tests. r=camd (#4128)

This commit is contained in:
Joel Maher 2018-10-12 18:38:18 -04:00 коммит произвёл GitHub
Родитель 2cf1dd44af
Коммит fd20a61c8e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 52 добавлений и 1 удалений

Просмотреть файл

@ -60,6 +60,12 @@ export const isReftest = function isReftest(job) {
.some(name => name.toLowerCase().includes('reftest'));
};
export const isPerfTest = function isPerfTest(job) {
return [job.job_group_name, job.job_type_name]
.some(name => name.toLowerCase().includes('talos') ||
name.toLowerCase().includes('raptor'));
};
export const isClassified = function isClassified(job) {
return !thUnclassifiedIds.includes(job.failure_classification_id);
};

Просмотреть файл

@ -4,7 +4,7 @@ import $ from 'jquery';
import { thEvents } from '../../../helpers/constants';
import { formatTaskclusterError } from '../../../helpers/errorMessage';
import { isReftest } from '../../../helpers/job';
import { isReftest, isPerfTest } from '../../../helpers/job';
import { getInspectTaskUrl, getReftestUrl } from '../../../helpers/url';
import JobModel from '../../../models/job';
import TaskclusterModel from '../../../models/taskcluster';
@ -51,6 +51,7 @@ class ActionBar extends React.Component {
});
this.toggleCustomJobActions = this.toggleCustomJobActions.bind(this);
this.createGeckoProfile = this.createGeckoProfile.bind(this);
this.createInteractiveTask = this.createInteractiveTask.bind(this);
}
@ -64,6 +65,44 @@ class ActionBar extends React.Component {
return selectedJob.state === 'pending' || selectedJob.state === 'running';
}
createGeckoProfile() {
const { user, selectedJob, getGeckoDecisionTaskId } = this.props;
if (!user.isLoggedIn) {
return this.thNotify.send('Must be logged in to create a gecko profile', 'danger');
}
getGeckoDecisionTaskId(
selectedJob.push_id).then(decisionTaskId => (
TaskclusterModel.load(decisionTaskId, selectedJob).then((results) => {
const geckoprofile = results.actions.find(result => result.name === 'geckoprofile');
if (geckoprofile === undefined || !geckoprofile.hasOwnProperty('kind')) {
return this.thNotify.send('Job was scheduled without taskcluster support for GeckoProfiles');
}
TaskclusterModel.submit({
action: geckoprofile,
decisionTaskId,
taskId: results.originalTaskId,
task: results.originalTask,
input: {},
staticActionVariables: results.staticActionVariables,
}).then(() => {
this.thNotify.send(
'Request sent to collect gecko profile job via actions.json',
'success');
}, (e) => {
// The full message is too large to fit in a Treeherder
// notification box.
this.thNotify.send(
formatTaskclusterError(e),
'danger',
{ sticky: true });
});
})
));
}
retriggerJob(jobs) {
const { user, repoName, getGeckoDecisionTaskId } = this.props;
const jobIds = jobs.map(({ id }) => id);
@ -303,6 +342,12 @@ class ActionBar extends React.Component {
onClick={this.createInteractiveTask}
>Create Interactive Task</a>
</li>
{isPerfTest(selectedJob) && <li>
<a
className="dropdown-item"
onClick={this.createGeckoProfile}
>Create Gecko Profile</a>
</li>}
<li>
<a
onClick={this.toggleCustomJobActions}