【发布时间】:2021-10-28 22:38:14
【问题描述】:
当我们创建项目时,它部署在 Staging dev 上(参考下面使用的 yaml 模板)。现在,无论何时我们提交它都会这样做。现在我们的问题是我们需要从登台到生产的手动审批阶段的开发和生产环境。 我们根据下图添加了两个阶段(批准和生产)
有人可以帮忙说一下我该如何修改我下面的 YAML 代码:
如果 $CODEBUILD_BUILD_STAGE == 'prod' 目标桶 = $S3_BUCKET_PROD 别的 target_bucket = $S3_BUCKET_DEV
这是我未经批准和生产阶段的代码:
version: 0.2
env:
variables:
S3_BUCKET: "s3-frontend"
phases:
install:
runtime-versions:
nodejs: 10
pre_build:
commands:
- echo Installing source NPM dependencies
- cd project
# Install node dependancies.
- npm install
- npm install -g @angular/cli@"~9.1.1"
build:
commands:
- echo Build started on `date`
- export NODE_OPTIONS=--max_old_space_size=16384
#building
- ng build --aot --configuration=production --build-optimizer --stats-json --output-path=dist/en
post_build:
commands:
#only run frontend update when the build is success
- bash -c "if [ /"$CODEBUILD_BUILD_SUCCEEDING/" == /"0/" ]; then exit 1; fi"
- aws s3 rm s3://$S3_BUCKET --recursive
#generating root language
- aws s3 cp dist/en s3://$S3_BUCKET --recursive
artifacts:
files:
- '**/*'
cache:
paths:
- '/root/.m2/**/*'
- '/root/.npm/**/*'
- 'build/**/*'
- 'node_modules/**/*'
【问题讨论】:
标签: amazon-web-services yaml aws-codepipeline