Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
installCmds.push('npm i -g npm')
installCmds.push('npm ci')
buildCmds.push('npm run build')
postBuildCmds.push('npm run test')
const deployEnv = `BRANCH_NAME=${this.branchName} DEPLOY_MODE=${this.mode}`
postBuildCmds.push(`${deployEnv} NO_PROFILE_CHECK=true npm run deploy`)
const install = { commands: installCmds }
const build = { commands: buildCmds }
const postBuild = { commands: postBuildCmds }
const phases = { build, install, post_build: postBuild }
const buildSpec = { phases, version: '0.2' }
const role = this.role
const projectConfig = { buildSpec, environment, role }
const project = new CB.PipelineProject(this, 'BuildProject', projectConfig)
const stage = this.pipeline.addStage('BuildStage', { placement })
const buildProps = { project, stage }
// tslint:disable-next-line:no-unused-expression
new CB.PipelineBuildAction(this, 'CodeBuild', buildProps)
}
super(parent, name, props);
const repository = new Repository(this, 'Repository', {
repositoryName: 'MyRepositoryName',
description: 'Some description.', // optional property
});
const sourceArtifact = new Artifact();
const sourceAction = new CodeCommitSourceAction({
actionName: 'CodeCommit',
repository,
output: sourceArtifact,
});
const project = new PipelineProject(this, 'MyProject');
const buildAction = new CodeBuildAction({
actionName: 'CodeBuild',
project,
input: sourceArtifact,
});
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,
constructor(scope: Construct, resources: any) {
super(scope, 'checkChanges')
resources.checkChangesProject = new PipelineProject(
scope,
'CheckChangesProject',
{
buildSpec: {
version: '0.2',
phases: {
build: {
commands: [
`bash ./build-scripts/check-changes.sh https://github.com/${
config.sourceRepoOwner
}/${
config.sourceRepoName
}.git $CODEBUILD_RESOLVED_SOURCE_VERSION`
]
}
},
addBuildActionStage(name: string, config: BuildStageConfig) {
const stageName = name
const projectName = `${this.id}-project-${name}`
const { atIndex, pipeline } = config
const projectConfig = this.createProjectConfig(config)
const additionalOutputArtifactNames = this.getAdditionalOutputArtifactNames(
name,
config
)
const project = new CB.PipelineProject(this, projectName, projectConfig)
const stage = pipeline.addStage(stageName, { placement: { atIndex } })
const stageConfig = {
additionalInputArtifacts: config.additionalInputArtifacts,
additionalOutputArtifactNames,
inputArtifact: config.inputArtifact,
outputArtifactName: name,
project,
stage,
}
return new CB.PipelineBuildAction(this, name, stageConfig)
}