Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(scope: Construct, id: string, props: BuildJobProps) {
super(scope, id)
this.task = new Task(this, `${id} build`, {
resource: props.runCodeBuildFunction,
parameters: {
codeBuildProjectArn: props.codeBuildProjectArn,
'sourceLocation.$': props.sourceLocationPath
},
inputPath: '$',
resultPath: `$.runBuildResult.${id}`,
outputPath: '$' // Pass all input to the output
})
const checkBuildTask = new Task(this, `Check ${id} status`, {
resource: props.checkCodeBuildFunction,
parameters: {
'build.$': `$.runBuildResult.${id}.build`
},
inputPath: `$`,
resultPath: `$.buildStatus.${id}`,
outputPath: '$'
})
const waitForBuild = new Wait(this, `Wait for ${id}`, {
duration: WaitDuration.seconds(10)
})
this.task.next(waitForBuild)
waitForBuild.next(checkBuildTask)
checkBuildTask.next(
constructor(scope: Construct, id: string, props: BuildJobProps) {
super(scope, id)
this.task = new Task(this, `${id} build`, {
resource: props.runCodeBuildFunction,
parameters: {
codeBuildProjectArn: props.codeBuildProjectArn,
'sourceLocation.$': props.sourceLocationPath
},
inputPath: '$',
resultPath: `$.runBuildResult.${id}`,
outputPath: '$' // Pass all input to the output
})
const checkBuildTask = new Task(this, `Check ${id} status`, {
resource: props.checkCodeBuildFunction,
parameters: {
'build.$': `$.runBuildResult.${id}.build`
},
inputPath: `$`,
export const task = (
scope: cdk.Construct,
name: string,
desc: string,
{ retry, ...lambdaParams }: Params,
environment?: { [key: string]: string },
overrides?: Partial,
) => {
const lambda = taskLambda(scope, name, lambdaParams, environment, overrides)
const task = new sfn.Task(scope, [name, desc].join(': '), {
task: new tasks.InvokeFunction(lambda),
})
if (retry == true) {
task.addRetry(retry === true ? {} : retry)
}
return { lambda, task }
}
private createTask(handler: lambda.Function) {
return new sfn.Task(this, `${handler.node.id}-task`, {
task: new tasks.InvokeFunction(handler),
});
}
}