From 729dc988878b043938ffb16013bb25c1aa32a4df Mon Sep 17 00:00:00 2001 From: Cory Sanin Date: Tue, 14 Jan 2025 19:18:44 -0500 Subject: [PATCH] pass all arguments along to build container --- src/BuildController.ts | 8 ++++++-- src/DB.ts | 1 - src/Web.ts | 9 +++++++++ views/footer.ejs | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/BuildController.ts b/src/BuildController.ts index 20f71d9..ad1bc78 100644 --- a/src/BuildController.ts +++ b/src/BuildController.ts @@ -129,12 +129,16 @@ class BuildController extends EventEmitter { } private createBuildParams = (build: Build) => { - // TODO: implement patch const params = ['run', '--rm', '-e', `REPO=${build.repo}`]; + if (build.dependencies) { + params.push('-e', `DEP=${build.dependencies}`); + } if (build.commit) { - // TODO: implement COMMIT params.push('-e', `COMMIT=${build.commit}`); } + if (build.patch) { + params.push('-e', `PATCH=${build.patch}`); + } params.push('--name', getContainerName(build.id)); params.push(docker_images[build.distro]); return params; diff --git a/src/DB.ts b/src/DB.ts index 67e5090..a40deee 100644 --- a/src/DB.ts +++ b/src/DB.ts @@ -233,7 +233,6 @@ class DB { public async dequeue(): Promise { return await this.build.findOne({ - attributes: SELECT, order: [['id', 'ASC']], where: { status: 'queued' diff --git a/src/Web.ts b/src/Web.ts index 81c7093..a85e934 100644 --- a/src/Web.ts +++ b/src/Web.ts @@ -145,6 +145,15 @@ class Web { res.set('Content-Type', 'text/plain').send(log); }); + app.get('/build/:num/patch/?', async (req, res) => { + const build = await this.db.getBuild(parseInt(req.params.num)); + if (!build || !build.patch) { + res.sendStatus(404); + return; + } + res.set('Content-Type', 'text/plain').send(build.patch); + }); + app.get('/healthcheck', (_, res) => { res.send('Healthy'); }); diff --git a/views/footer.ejs b/views/footer.ejs index bc19c7f..afcc86d 100644 --- a/views/footer.ejs +++ b/views/footer.ejs @@ -2,7 +2,7 @@ \ No newline at end of file