feat: Fargate
This commit is contained in:
@@ -866,12 +866,18 @@ export function createCloudRoutes(injectedService?: CloudProxyService) {
|
||||
app.post('/:cloud/services/codebuild/resources/:id/builds', async (c) => {
|
||||
if (c.req.param('cloud') !== 'aws') return c.json({error: 'Unknown cloud or service'}, 404)
|
||||
return withRuntime(c, async () => {
|
||||
const body = await jsonBody<{environmentVariablesOverride?: unknown}>(c)
|
||||
const body = await jsonBody<{environmentVariablesOverride?: unknown; buildspecOverride?: unknown}>(c)
|
||||
const overrides = body.environmentVariablesOverride
|
||||
if (overrides !== undefined && (!Array.isArray(overrides) || overrides.some((item) => !item || typeof item !== 'object' || typeof (item as {name?: unknown}).name !== 'string' || typeof (item as {value?: unknown}).value !== 'string' || ((item as {type?: unknown}).type !== undefined && !['PLAINTEXT', 'PARAMETER_STORE', 'SECRETS_MANAGER'].includes((item as {type: string}).type))))) {
|
||||
throw new ValidationError('environmentVariablesOverride must contain name, value, and an optional supported type')
|
||||
}
|
||||
return c.json(await svc(c).startCodeBuild('aws', c.req.param('id'), {environmentVariablesOverride: overrides as never}), 201)
|
||||
if (body.buildspecOverride !== undefined && typeof body.buildspecOverride !== 'string') {
|
||||
throw new ValidationError('buildspecOverride must be a string')
|
||||
}
|
||||
const buildspecOverride = typeof body.buildspecOverride === 'string' && body.buildspecOverride.trim()
|
||||
? body.buildspecOverride
|
||||
: undefined
|
||||
return c.json(await svc(c).startCodeBuild('aws', c.req.param('id'), {environmentVariablesOverride: overrides as never, buildspecOverride}), 201)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user