diff --git a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json index c05f8807aa..3ceb2ace4f 100644 --- a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json +++ b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json @@ -21,7 +21,7 @@ "@types/request": "^2.48.4", "@typescript-eslint/eslint-plugin": "^4.28.0", "@typescript-eslint/parser": "^4.17.0", - "@vercel/ncc": "0.27.0", + "@vercel/ncc": "^0.29.0", "aws-sdk": "^2.888.0", "eslint": "^7.24.0", "jest": "^26.6.3", @@ -33,4 +33,4 @@ "request": "^2.88.2", "yn": "^4.0.0" } -} \ No newline at end of file +} diff --git a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/src/lambda.ts b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/src/lambda.ts index fce0353d69..d8c7ebc94b 100644 --- a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/src/lambda.ts +++ b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/src/lambda.ts @@ -1,7 +1,7 @@ import { handle } from './syncer/handler'; // eslint-disable-next-line -module.exports.handler = async (event: any, context: any, callback: any): Promise => { +export const handler = async (event: any, context: any, callback: any): Promise => { await handle(); - return callback(); + callback(); }; diff --git a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/yarn.lock b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/yarn.lock index 601f03dee8..c28740559c 100644 --- a/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/yarn.lock +++ b/modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/yarn.lock @@ -890,10 +890,10 @@ "@typescript-eslint/types" "4.28.0" eslint-visitor-keys "^2.0.0" -"@vercel/ncc@0.27.0": - version "0.27.0" - resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.27.0.tgz#c0cfeebb0bebb56052719efa4a0ecc090a932c76" - integrity sha512-DllIJQapnU2YwewIhh/4dYesmMQw3h2cFtabECc/zSJHqUbNa0eJuEkRa6DXbZvh1YPWBtYQoPV17NlDpBw1Vw== +"@vercel/ncc@^0.29.0": + version "0.29.0" + resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.29.0.tgz#ac23fc23f1593b05c72360108bcf6d849d2f317a" + integrity sha512-p+sB835wOSDdgm2mgFgSOcXJF84AqZ+vBEnnGS0sm8veA92Hia7sqH0qEnqeFilPl+cXtxbdh2er+WdlfbVCZA== abab@^2.0.3, abab@^2.0.5: version "2.0.5" diff --git a/modules/runners/lambdas/runners/package.json b/modules/runners/lambdas/runners/package.json index f9d7784a17..953b9d042a 100644 --- a/modules/runners/lambdas/runners/package.json +++ b/modules/runners/lambdas/runners/package.json @@ -20,7 +20,7 @@ "@types/jest": "^26.0.20", "@typescript-eslint/eslint-plugin": "^4.17.0", "@typescript-eslint/parser": "^4.22.0", - "@vercel/ncc": "0.27.0", + "@vercel/ncc": "^0.29.0", "eslint": "^7.22.0", "jest": "^26.6.3", "jest-mock-extended": "^1.0.13", @@ -41,4 +41,4 @@ "typescript": "^4.2.3", "yn": "^4.0.0" } -} \ No newline at end of file +} diff --git a/modules/runners/lambdas/runners/src/lambda.ts b/modules/runners/lambdas/runners/src/lambda.ts index 576daafce2..156ac39f26 100644 --- a/modules/runners/lambdas/runners/src/lambda.ts +++ b/modules/runners/lambdas/runners/src/lambda.ts @@ -1,26 +1,27 @@ -import { scaleUp } from './scale-runners/scale-up'; -import { scaleDown } from './scale-runners/scale-down'; +import { scaleUp as scaleUpAction } from './scale-runners/scale-up'; +import { scaleDown as scaleDownAction } from './scale-runners/scale-down'; import { SQSEvent, ScheduledEvent, Context } from 'aws-lambda'; -module.exports.scaleUp = async (event: SQSEvent, context: Context, callback: any) => { +export const scaleUp = async (event: SQSEvent, context: Context, callback: any): Promise => { console.dir(event, { depth: 5 }); try { for (const e of event.Records) { - await scaleUp(e.eventSource, JSON.parse(e.body)); + await scaleUpAction(e.eventSource, JSON.parse(e.body)); } - return callback(null); + + callback(null); } catch (e) { console.error(e); - return callback('Failed handling SQS event'); + callback('Failed handling SQS event'); } }; -module.exports.scaleDown = async (event: ScheduledEvent, context: Context, callback: any) => { +export const scaleDown = async (event: ScheduledEvent, context: Context, callback: any): Promise => { try { - scaleDown(); - return callback(null); + scaleDownAction(); + callback(null); } catch (e) { console.error(e); - return callback('Failed'); + callback('Failed'); } }; diff --git a/modules/runners/lambdas/runners/yarn.lock b/modules/runners/lambdas/runners/yarn.lock index 8cafa41143..7070c3481b 100644 --- a/modules/runners/lambdas/runners/yarn.lock +++ b/modules/runners/lambdas/runners/yarn.lock @@ -983,10 +983,10 @@ "@typescript-eslint/types" "4.27.0" eslint-visitor-keys "^2.0.0" -"@vercel/ncc@0.27.0": - version "0.27.0" - resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.27.0.tgz#c0cfeebb0bebb56052719efa4a0ecc090a932c76" - integrity sha512-DllIJQapnU2YwewIhh/4dYesmMQw3h2cFtabECc/zSJHqUbNa0eJuEkRa6DXbZvh1YPWBtYQoPV17NlDpBw1Vw== +"@vercel/ncc@^0.29.0": + version "0.29.0" + resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.29.0.tgz#ac23fc23f1593b05c72360108bcf6d849d2f317a" + integrity sha512-p+sB835wOSDdgm2mgFgSOcXJF84AqZ+vBEnnGS0sm8veA92Hia7sqH0qEnqeFilPl+cXtxbdh2er+WdlfbVCZA== abab@^2.0.3, abab@^2.0.5: version "2.0.5" diff --git a/modules/webhook/lambdas/webhook/package.json b/modules/webhook/lambdas/webhook/package.json index 7cb8b17069..babdf1d1f5 100644 --- a/modules/webhook/lambdas/webhook/package.json +++ b/modules/webhook/lambdas/webhook/package.json @@ -21,7 +21,7 @@ "@types/node": "^15.12.2", "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/parser": "^4.22.0", - "@vercel/ncc": "0.27.0", + "@vercel/ncc": "0.29.0", "aws-sdk": "^2.888.0", "body-parser": "^1.19.0", "eslint": "^7.29.0", @@ -33,6 +33,6 @@ }, "dependencies": { "@octokit/rest": "^18.3.5", - "@octokit/webhooks": "^8.5.4" + "@octokit/webhooks": "^9.10.0" } -} \ No newline at end of file +} diff --git a/modules/webhook/lambdas/webhook/src/lambda.ts b/modules/webhook/lambdas/webhook/src/lambda.ts index d5a21a77f1..2a180af231 100644 --- a/modules/webhook/lambdas/webhook/src/lambda.ts +++ b/modules/webhook/lambdas/webhook/src/lambda.ts @@ -1,8 +1,8 @@ -import { handle as githubWebhook } from './webhook/handler'; +import { handle } from './webhook/handler'; -module.exports.githubWebhook = async (event: any, context: any, callback: any) => { - const statusCode = await githubWebhook(event.headers, event.body); - return callback(null, { +export const githubWebhook = async (event: any, context: any, callback: any): Promise => { + const statusCode = await handle(event.headers, event.body); + callback(null, { statusCode: statusCode, }); }; diff --git a/modules/webhook/lambdas/webhook/src/webhook/handler.test.ts b/modules/webhook/lambdas/webhook/src/webhook/handler.test.ts index 3ec25ab5c0..18384a686a 100644 --- a/modules/webhook/lambdas/webhook/src/webhook/handler.test.ts +++ b/modules/webhook/lambdas/webhook/src/webhook/handler.test.ts @@ -92,5 +92,4 @@ describe('handler', () => { expect(resp).toBe(200); expect(sendActionRequest).toBeCalled(); }); - }); diff --git a/modules/webhook/lambdas/webhook/src/webhook/handler.ts b/modules/webhook/lambdas/webhook/src/webhook/handler.ts index 06886677e0..c4d02b30d6 100644 --- a/modules/webhook/lambdas/webhook/src/webhook/handler.ts +++ b/modules/webhook/lambdas/webhook/src/webhook/handler.ts @@ -1,7 +1,7 @@ import { IncomingHttpHeaders } from 'http'; import { Webhooks } from '@octokit/webhooks'; import { sendActionRequest } from '../sqs'; -import { CheckRunEvent } from '@octokit/webhooks-definitions/schema'; +import { CheckRunEvent } from '@octokit/webhooks-types'; import { decrypt } from '../kms'; export const handle = async (headers: IncomingHttpHeaders, payload: any): Promise => { @@ -29,7 +29,7 @@ export const handle = async (headers: IncomingHttpHeaders, payload: any): Promis const webhooks = new Webhooks({ secret: secret, }); - if (!webhooks.verify(payload, signature)) { + if (!(await webhooks.verify(payload, signature))) { console.error('Unable to verify signature!'); return 401; } @@ -41,7 +41,7 @@ export const handle = async (headers: IncomingHttpHeaders, payload: any): Promis if (githubEvent === 'check_run') { const body = JSON.parse(payload) as CheckRunEvent; - const repositoryWhiteListEnv = process.env.REPOSITORY_WHITE_LIST as string || "[]"; + const repositoryWhiteListEnv = (process.env.REPOSITORY_WHITE_LIST as string) || '[]'; const repositoryWhiteList = JSON.parse(repositoryWhiteListEnv) as Array; if (repositoryWhiteList.length > 0) { diff --git a/modules/webhook/lambdas/webhook/yarn.lock b/modules/webhook/lambdas/webhook/yarn.lock index 8203e0edc5..df071cc499 100644 --- a/modules/webhook/lambdas/webhook/yarn.lock +++ b/modules/webhook/lambdas/webhook/yarn.lock @@ -634,20 +634,30 @@ dependencies: "@octokit/openapi-types" "^7.3.2" -"@octokit/webhooks-definitions@3.67.3", "@octokit/webhooks-definitions@^3.67.3": +"@octokit/webhooks-definitions@^3.67.3": version "3.67.3" resolved "https://registry.yarnpkg.com/@octokit/webhooks-definitions/-/webhooks-definitions-3.67.3.tgz#d2a905a90b04af8111982d0c13658a49fc4eecb9" integrity sha512-do4Z1r2OVhuI0ihJhQ8Hg+yPWnBYEBNuFNCrvtPKoYT1w81jD7pBXgGe86lYuuNirkDHb0Nxt+zt4O5GiFJfgA== -"@octokit/webhooks@^8.5.4": - version "8.12.3" - resolved "https://registry.yarnpkg.com/@octokit/webhooks/-/webhooks-8.12.3.tgz#8e30ac3534bbc65be39995664ee25ca6922f9e44" - integrity sha512-rbzBG0XmzYtaLoeXZ2F4wyY3AaBbvnHT5OkSXxaF+OJTJLEdAKE6dtJsNYzB2mr2XYpe9pb198SrTeutKQeiQA== +"@octokit/webhooks-methods@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@octokit/webhooks-methods/-/webhooks-methods-2.0.0.tgz#1108b9ea661ca6c81e4a8bfa63a09eb27d5bc2db" + integrity sha512-35cfQ4YWlnZnmZKmIxlGPUPLtbkF8lr/A/1Sk1eC0ddLMwQN06dOuLc+dI3YLQS+T+MoNt3DIQ0NynwgKPilig== + +"@octokit/webhooks-types@4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@octokit/webhooks-types/-/webhooks-types-4.2.0.tgz#7c3798fe2c469eb62c5fc3440301e34bf288e6b7" + integrity sha512-BbWkXK0ZLE2BXF7OKlrK5B7nCqgawEiZ7orzLls5rLZlepHy1LtFlh2DSe3McqJznlBh0JRk+/eUowgXfmKmIw== + +"@octokit/webhooks@^9.10.0": + version "9.11.0" + resolved "https://registry.yarnpkg.com/@octokit/webhooks/-/webhooks-9.11.0.tgz#e2f491243dd2d0091a4aa24f683ac0958aa040e5" + integrity sha512-0pgBcPtpSIfvJX4COVQbbAL2kndKYLC0kHxnqOEschoVUClLaU7f8xkNX9royJF4vg9dc2AVHVvd9QC8yVrdVw== dependencies: "@octokit/request-error" "^2.0.2" - "@octokit/webhooks-definitions" "3.67.3" + "@octokit/webhooks-methods" "^2.0.0" + "@octokit/webhooks-types" "4.2.0" aggregate-error "^3.1.0" - debug "^4.0.0" "@sinonjs/commons@^1.7.0": version "1.8.3" @@ -909,10 +919,10 @@ "@typescript-eslint/types" "4.27.0" eslint-visitor-keys "^2.0.0" -"@vercel/ncc@0.27.0": - version "0.27.0" - resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.27.0.tgz#c0cfeebb0bebb56052719efa4a0ecc090a932c76" - integrity sha512-DllIJQapnU2YwewIhh/4dYesmMQw3h2cFtabECc/zSJHqUbNa0eJuEkRa6DXbZvh1YPWBtYQoPV17NlDpBw1Vw== +"@vercel/ncc@0.29.0": + version "0.29.0" + resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.29.0.tgz#ac23fc23f1593b05c72360108bcf6d849d2f317a" + integrity sha512-p+sB835wOSDdgm2mgFgSOcXJF84AqZ+vBEnnGS0sm8veA92Hia7sqH0qEnqeFilPl+cXtxbdh2er+WdlfbVCZA== abab@^2.0.3, abab@^2.0.5: version "2.0.5" @@ -1606,7 +1616,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3: dependencies: ms "2.0.0" -debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==