Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let project = new Project(this, 'deploy-site', {
description: 'Deploys website at scaleyourcloudformation.com',
timeout: Duration.minutes(30),
badge: true,
source: Source.gitHub({
cloneDepth: 1,
owner: 'jeshan',
repo: 'scale-your-cloudformation',
webhookFilters: [
FilterGroup.inEventOf([EventAction.PUSH]).andBranchIs(
'master',
),
],
}),
environment: { buildImage: LinuxBuildImage.STANDARD_2_0 },
buildSpec: BuildSpec.fromObject({
version: '0.2',
phases: {
install: {
'runtime-versions': {
nodejs: '10',
},
},
pre_build: {
commands: ['npm i -g aws-cdk@1.16.3', 'npm i'],
},
build: {
commands: [
'cdk bootstrap',
'cdk diff || true',
'cdk deploy',
],
constructor(scope: Construct, id: string, props: ModuleBuildProjectProps) {
super(scope, id, {
projectName: id,
environment: defaultEnvironment,
environmentVariables: projectEnvironmentVars,
buildSpec: BuildSpec.fromObject({
version: '0.2',
phases: {
install: {
...defaultRuntimes
},
pre_build: {
commands: ['bash ./build-scripts/audit-module.sh']
},
build: {
commands: ['bash ./build-scripts/build-module.sh']
},
post_build: {
commands: ['bash ./build-scripts/package-module.sh']
}
},
artifacts: moduleArtifacts
repo: config.sourceRepoName,
webhook: true,
webhookFilters: [
FilterGroup.inEventOf(EventAction.PUSH).andBranchIs(config.sourceBranch)
]
})
const artifacts = Artifacts.s3({
bucket: props.bucket,
name: SLIC_PIPELINE_SOURCE_ARTIFACT,
includeBuildId: false,
packageZip: true
})
super(scope, id, {
buildSpec: BuildSpec.fromObject({
version: '0.2',
phases: {
install: {
...defaultRuntimes,
commands: ['npm install']
},
build: {
commands: [
`bash ./build-scripts/source-kickoff.sh https://github.com/${config.sourceRepoOwner}/${config.sourceRepoName}.git $CODEBUILD_RESOLVED_SOURCE_VERSION`
]
}
},
artifacts: {
files: '**/*'
}
}),
projectName: `${props.stageName}DeployProject`,
environmentVariables: {
SLIC_STAGE: {
type: BuildEnvironmentVariableType.PLAINTEXT,
value: props.stageName
},
CROSS_ACCOUNT_ID: {
type: BuildEnvironmentVariableType.PLAINTEXT,
value: `${config.accountIds[props.stageName]}`
},
MODULE_NAMES: {
type: BuildEnvironmentVariableType.PLAINTEXT,
value: modules.moduleNames.join(' ')
}
},
buildSpec: BuildSpec.fromObject({
version: '0.2',
phases: {
build: {
commands: ['bash ./build-scripts/orchestrator-stage-deploy.sh']
}
}
}),
...rest
})
}
}
constructor(scope: Construct, id: string, props: ModuleDeployProjectProps) {
super(scope, id, {
projectName: id,
role: props.role,
environment: defaultEnvironment,
environmentVariables: projectEnvironmentVars,
buildSpec: BuildSpec.fromObject({
version: '0.2',
phases: {
install: {
...defaultRuntimes
},
build: {
commands: ['bash ./build-scripts/deploy-module.sh']
}
},
artifacts: moduleArtifacts
})
})
}
}