From d4b49d995584d0ddeded429d18b6aaaf8e68e0e2 Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Fri, 29 Mar 2024 18:24:09 +0100 Subject: [PATCH] chore: various things, preparing for mpv tasks --- src/client/Deploy.jsx | 2 +- src/client/NewDeployForm.jsx | 4 ++-- src/config.ts | 2 +- src/forms.ts | 4 ++-- src/pages/api/webhook.ts | 10 +++++++--- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/client/Deploy.jsx b/src/client/Deploy.jsx index 86504db..417bbd4 100644 --- a/src/client/Deploy.jsx +++ b/src/client/Deploy.jsx @@ -29,7 +29,7 @@ export const Deploy = ({ deploy }) => { {deploy.name}
{deploy.type}
- {deploy.type === 'docker' ? ( + {deploy.type === 'docker-image' ? (
{deploy.options.image}
) : ( <> diff --git a/src/client/NewDeployForm.jsx b/src/client/NewDeployForm.jsx index 56bd7dc..aa39a45 100644 --- a/src/client/NewDeployForm.jsx +++ b/src/client/NewDeployForm.jsx @@ -18,7 +18,7 @@ export const NewDeployForm = () => { - + @@ -74,7 +74,7 @@ const DeployRefOptions = ({}) => { const DeployOptions = ({ type }) => { switch (type) { - case 'docker': + case 'docker-image': return case 'dockerfile': return diff --git a/src/config.ts b/src/config.ts index 8c06f93..857da68 100644 --- a/src/config.ts +++ b/src/config.ts @@ -31,7 +31,7 @@ const DockerRunOptions = z.object({ export const DockerDeploy = z.object({ name: z.string(), - type: z.literal('docker'), + type: z.literal('docker-image'), options: DockerRunOptions.extend({ image: z.string(), }), diff --git a/src/forms.ts b/src/forms.ts index 66b364a..3504f85 100644 --- a/src/forms.ts +++ b/src/forms.ts @@ -33,7 +33,7 @@ export function parseDeploy(form: Record): Deploy { const name = form['deploy-name'] const type = form['deploy-type'] - if (type === 'docker') { + if (type === 'docker-image') { // const url = notEmpty(form['deploy-url'], 'must provide an url') const containerName = form['deploy-options-name'] as string const image = notEmpty(form['deploy-options-image'], 'must provide an image name') @@ -43,7 +43,7 @@ export function parseDeploy(form: Record): Deploy { return { name, - type: 'docker', + type: 'docker-image', options: { image, name: containerName, diff --git a/src/pages/api/webhook.ts b/src/pages/api/webhook.ts index 1458bdb..948737f 100644 --- a/src/pages/api/webhook.ts +++ b/src/pages/api/webhook.ts @@ -17,11 +17,15 @@ export const POST: APIRoute = async ({ request }) => { const { deploys } = await loadConfig() for (const deploy of deploys) { - if (deploy.type !== 'docker') { + if (deploy.type !== 'docker-image') { if (URLS.includes(normalizeURL(deploy.url))) { debug(`[Webhook] Triggering deploy for "${deploy.url}"`) - - const [jobBase, deployFn] = createDeployJob(deploy, { event: 'webhook', url: deploy.url }) + + const [jobBase, deployFn] = createDeployJob(deploy, { + event: 'webhook', + url: deploy.url, + }) + await enqueueJob(jobBase, deployFn) } }