Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
// Allow access to secret environment variables in Parameter Store required for tests
role.addToPolicy(
new iam.PolicyStatement({
actions: ['ssm:GetParameters'],
resources: [
`arn:aws:ssm:${config.region}:${
config.accountIds.cicd
}:parameter/test/*`
]
})
)
super(scope, id, {
projectName: `${props.stageName}IntegrationTest`,
environment: {
buildImage: LinuxBuildImage.STANDARD_2_0
},
environmentVariables: {
SLIC_STAGE: {
type: BuildEnvironmentVariableType.PLAINTEXT,
value: props.stageName
},
CROSS_ACCOUNT_ID: {
type: BuildEnvironmentVariableType.PLAINTEXT,
value: `${config.accountIds[props.stageName]}`
},
MAILOSAUR_API_KEY: {
type: BuildEnvironmentVariableType.PARAMETER_STORE,
value: '/test/mailosaur/apiKey'
},
MAILOSAUR_SERVER_ID: {
type: BuildEnvironmentVariableType.PARAMETER_STORE,
// Allow access to secret environment variables in Parameter Store required for tests
role.addToPolicy(
new iam.PolicyStatement({
actions: ['ssm:GetParameters'],
resources: [
`arn:aws:ssm:${config.region}:${
config.accountIds.cicd
}:parameter/test/*`
]
})
)
super(scope, id, {
projectName: `${props.stageName}E2ETest`,
environment: {
buildImage: LinuxBuildImage.STANDARD_2_0
},
environmentVariables: {
SLIC_STAGE: {
type: BuildEnvironmentVariableType.PLAINTEXT,
value: props.stageName
},
CROSS_ACCOUNT_ID: {
type: BuildEnvironmentVariableType.PLAINTEXT,
value: `${config.accountIds[props.stageName]}`
},
MAILOSAUR_API_KEY: {
type: BuildEnvironmentVariableType.PARAMETER_STORE,
value: '/test/mailosaur/apiKey'
},
MAILOSAUR_SERVER_ID: {
type: BuildEnvironmentVariableType.PARAMETER_STORE,
import { ComputeType, LinuxBuildImage } from '@aws-cdk/aws-codebuild'
export const defaultEnvironment = {
buildImage: LinuxBuildImage.STANDARD_2_0,
computeType: ComputeType.SMALL,
privileged: false
}
export const defaultRuntimes = {
'runtime-versions': {
nodejs: 10,
python: 3.7
}
}
public constructor(
scope: Construct,
id: string,
props: PullRequestCheckProps,
) {
super(scope, id);
const {
repository,
buildSpec,
buildImage = LinuxBuildImage.STANDARD_2_0,
computeType = buildImage.defaultComputeType,
} = props;
const lambdaRole = new Role(this, 'LambdaRole', {
assumedBy: new ServicePrincipal('lambda.amazonaws.com'),
});
lambdaRole.addToPolicy(
new PolicyStatement({
resources: ['*'],
actions: [
'codebuild:*',
'codecommit:*',
'logs:CreateLogGroup',
'logs:CreateLogStream',
'logs:PutLogEvents',
super(scope, 'pipeline');
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',