Skip to content

Commit

Permalink
DOP-4414 cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Mar 18, 2024
1 parent 41787bf commit 7799369
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 22 deletions.
7 changes: 3 additions & 4 deletions api/controllers/v2/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,19 @@ export const triggerSmokeTestAutomatedBuild = async (event: APIGatewayEvent): Pr
}
}

let returnVal;
try {
returnVal = await createAndInsertJob();
await createAndInsertJob();
} catch (err) {
return {
statusCode: 500,
headers: { 'Content-Type': 'text/plain' },
body: returnVal + err,
body: err,
};
}
return {
statusCode: 202,
headers: { 'Content-Type': 'text/plain' },
body: 'Jobs Queued ' + returnVal,
body: 'Smoke Test Jobs Queued ',
};
};

Expand Down
13 changes: 3 additions & 10 deletions api/controllers/v2/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ConsoleLogger, ILogger } from '../../../src/services/logger';
import { SlackConnector } from '../../../src/services/slack';
import { JobRepository } from '../../../src/repositories/jobRepository';
import { APIGatewayEvent, APIGatewayProxyResult } from 'aws-lambda';
import { JobStatus } from '../../../src/entities/job';
import { EnhancedPayload, JobStatus } from '../../../src/entities/job';
import {
buildEntitledBranchList,
getQSString,
Expand Down Expand Up @@ -81,7 +81,6 @@ const deployHelper = (deployable, payload, jobTitle, jobUserName, jobUserEmail)
// For every repo/branch selected to be deployed, return an array of jobs with the payload data
// needed for a successful build.
export const getDeployableJobs = async (
consoleLogger,
values,
entitlement,
repoBranchesRepository: RepoBranchesRepository,
Expand Down Expand Up @@ -212,13 +211,7 @@ export const DeployRepo = async (event: APIGatewayEvent): Promise<APIGatewayProx

const values = slackConnector.parseSelection(stateValues);

const deployable = await getDeployableJobs(
consoleLogger,
values,
entitlement,
repoBranchesRepository,
docsetsRepository
);
const deployable = await getDeployableJobs(values, entitlement, repoBranchesRepository, docsetsRepository);
if (deployable.length > 0) {
await deployRepo(deployable, consoleLogger, jobRepository, c.get('jobsQueueUrl'));
}
Expand Down Expand Up @@ -263,7 +256,7 @@ function createPayload(
};
}

function createJob(payload: any, jobTitle: string, jobUserName: string, jobUserEmail: string) {
function createJob(payload: EnhancedPayload, jobTitle: string, jobUserName: string, jobUserEmail: string) {
return {
title: jobTitle,
user: jobUserName,
Expand Down
7 changes: 1 addition & 6 deletions src/commands/src/shared/next-gen-stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface StageParams {
}

export async function nextGenStage({ job, bucket, url }: StageParams): Promise<CommandExecutorResponse> {
const { mutPrefix, branchName, project, newHead, patchId, action } = job.payload;
const { mutPrefix, branchName, project, newHead, patchId } = job.payload;

if (!bucket) {
console.log(`nextGenStage has failed. Variable for S3 bucket address was undefined.`);
Expand All @@ -29,10 +29,7 @@ export async function nextGenStage({ job, bucket, url }: StageParams): Promise<C
};
}

console.log(mutPrefix);
let prefix = mutPrefix || project;
console.log(prefix);

let hostedAtUrl = `${url}/${prefix}/${DOCS_WORKER_USER}/${branchName}/`;

const commandArgs = ['public', bucket, '--stage'];
Expand All @@ -44,8 +41,6 @@ export async function nextGenStage({ job, bucket, url }: StageParams): Promise<C
hostedAtUrl = `${url}/${newHead}/${patchId}/${mutPrefix}/${DOCS_WORKER_USER}/${branchName}/`;
}

console.log(hostedAtUrl);

commandArgs.push(`--prefix=${prefix}`);

const repoDir = getRepoDir(job.payload.repoName, job.payload.directory);
Expand Down
1 change: 0 additions & 1 deletion src/job/jobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export abstract class JobHandler {
const pathPrefix = await this.getPathPrefix();
// TODO: Can empty string check be removed?
if (pathPrefix || pathPrefix === '') {
this._logger.save(this.currJob._id, 'Path prefix raw' + pathPrefix);
this.currJob.payload.pathPrefix = pathPrefix;
const mutPrefix = pathPrefix.split(`/${server_user}`)[0];
this.currJob.payload.mutPrefix = mutPrefix;
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/projectsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BaseRepository } from './baseRepository';
import { ILogger } from '../services/logger';

/**
* Manages metadata for parser builds.
* Project information from docs_metadata.projects for parser builds.
*/
export class ProjectsRepository extends BaseRepository {
constructor(db: Db, config: IConfig, logger: ILogger) {
Expand Down

0 comments on commit 7799369

Please sign in to comment.