Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 6d3c87c

Browse files
committed
untidying because its angry
1 parent df24d8e commit 6d3c87c

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

api/controllers/v1/jobs.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ async function NotifyBuildSummary(jobId: string): Promise<any> {
162162
const githubToken = c.get<string>('githubSecret');
163163

164164
const jobRepository = new JobRepository(db, c, consoleLogger);
165-
// TODO: Make fullDocument be of type Job, validate existence
165+
166166
const fullDocument = await jobRepository.getJobById(jobId);
167167
if (!fullDocument) {
168168
consoleLogger.error('Cannot find job entry in db', '');
@@ -175,13 +175,17 @@ async function NotifyBuildSummary(jobId: string): Promise<any> {
175175

176176
// Github comment
177177
await githubConnector.getParentPRs(fullDocument.payload).then(function (results) {
178-
for (const result of results) {
179-
const commentid = githubConnector.getPullRequestCommentId(fullDocument.payload, result).then(function (id) {
178+
for (const pr of results) {
179+
githubConnector.getPullRequestCommentId(fullDocument.payload, pr).then(function (id) {
180180
console.log(`The comment ID is: ${id}`);
181181
if (id != undefined) {
182-
githubConnector.updateComment(fullDocument.payload, id, '* next log link');
182+
prepGithubComment(fullDocument, c.get<string>('dashboardUrl'), true).then(function (ghmessage) {
183+
githubConnector.updateComment(fullDocument.payload, id, ghmessage);
184+
});
183185
} else {
184-
githubConnector.postComment(fullDocument.payload, result, 'This is a new comment ooh aah');
186+
prepGithubComment(fullDocument, c.get<string>('dashboardUrl'), false).then(function (ghmessage) {
187+
githubConnector.postComment(fullDocument.payload, pr, ghmessage);
188+
});
185189
}
186190
});
187191
}
@@ -237,7 +241,7 @@ async function prepSummaryMessage(
237241
failed = false
238242
): Promise<string> {
239243
const urls = extractUrlFromMessage(fullDocument);
240-
let mms_urls = ['', ''];
244+
let mms_urls = [null, null];
241245
// mms-docs needs special handling as it builds two sites (cloudmanager & ops manager)
242246
// so we need to extract both URLs
243247
if (repoName === 'mms-docs') {
@@ -301,10 +305,10 @@ async function NotifyBuildProgress(jobId: string): Promise<any> {
301305
const jobRepository = new JobRepository(db, c, consoleLogger);
302306
// TODO: Make fullDocument be of type Job, validate existence
303307
const fullDocument = await jobRepository.getJobById(jobId);
304-
if (!fullDocument) {
305-
consoleLogger.error('Cannot find job in db.', '');
306-
return;
307-
}
308+
// if (!fullDocument) {
309+
// consoleLogger.error('Cannot find job in db.', '');
310+
// return;
311+
// }
308312
const jobTitle = fullDocument.title;
309313
const username = fullDocument.user;
310314
const repoEntitlementRepository = new RepoEntitlementsRepository(db, c, consoleLogger);
@@ -356,10 +360,10 @@ async function SubmitArchiveJob(jobId: string) {
356360
branches: new BranchRepository(db, c, consoleLogger),
357361
};
358362
const job = await models.jobs.getJobById(jobId);
359-
if (!job) {
360-
consoleLogger.error('Cannot find job in db', JSON.stringify({ jobId }));
361-
return;
362-
}
363+
// if (!job) {
364+
// consoleLogger.error('Cannot find job in db', JSON.stringify({ jobId }));
365+
// return;
366+
// }
363367
const repo = await models.branches.getRepo(job.payload.repoName);
364368

365369
/* NOTE

0 commit comments

Comments
 (0)