Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
grantPrincipal: (fargatesvc.service.taskDefinition.executionRole as iam.IRole)
})
// reduce the default deregistration delay timeout from 300 to 30 to accelerate the rolling update
fargatesvc.targetGroup.setAttribute('deregistration_delay.timeout_seconds', '30')
// customize the healthcheck to speed up the ecs rolling update
fargatesvc.targetGroup.configureHealthCheck({
interval: Duration.seconds(5),
healthyHttpCodes: '200',
healthyThresholdCount: 2,
unhealthyThresholdCount: 3,
timeout: Duration.seconds(4),
})
// CodePipeline
const codePipeline = new codepipeline.Pipeline(this, 'CoffeeShopPipeline', {
pipelineName: 'CoffeeShopPipeline',
});
const sourceOutputEcr = new codepipeline.Artifact();
const sourceOutputCodeCommit = new codepipeline.Artifact();
const sourceActionECR = new codepipeline_actions.EcrSourceAction({
actionName: 'ECR',
repository: this.ecrRepository,
imageTag: 'latest', // optional, default: 'latest'
output: sourceOutputEcr,
});
const codecommitRepo = new codecommit.Repository(this, 'GitRepo', {
repositoryName: CODECOMMIT_REPO_NAME
});
const slackBotToken = process.env.SLACK_BOT_TOKEN as string;
const slackSigningSecret = process.env.SLACK_SIGNING_SECRET as string;
const slackChannel = process.env.SLACK_CHANNEL as string;
const approvalAction = new SlackApprovalAction({
actionName: 'SlackApproval',
slackBotToken,
slackSigningSecret,
slackChannel,
externalEntityLink: 'http://cloudcomponents.org',
additionalInformation:
'Would you like to promote the build to production?',
});
new Pipeline(this, 'MyPipeline', {
pipelineName: 'MyPipeline',
stages: [
{
stageName: 'Source',
actions: [sourceAction],
},
{
stageName: 'Build',
actions: [buildAction],
},
{
stageName: 'Approval',
actions: [approvalAction],
},
],
});
addPipeline(pipelineName: string) {
const name = `${this.id}-${pipelineName}`
return new Pipeline(this, name, { pipelineName: name })
}
constructor(parent: App, pipelineName: string, props: ProjectStackProps) {
super(parent, pipelineName, props)
this.branchName = props.branchName
this.mode = props.mode
this.pipelineName = pipelineName
this.pipeline = new Pipeline(this, pipelineName, { pipelineName })
this.appPath = props.env.path
this.addIAMRole()
this.addSourceStage()
this.addBuildStage()
}
const sourceAction = new CodeCommitSourceAction({
actionName: 'CodeCommit',
repository,
output: sourceArtifact,
branch: 'master',
});
const checkAction = new CodepipelineCheckParameterAction({
actionName: 'Check',
parameterName: '/test',
regExp: /^The.*Spain$/,
logParameter: true,
});
new Pipeline(this, 'MyPipeline', {
pipelineName: 'MyPipeline',
stages: [
{
stageName: 'Source',
actions: [sourceAction],
},
{
stageName: 'Check',
actions: [checkAction],
},
],
});
}
}