我的应用程序有一个流程,我有一个实例名为Staging,另一个实例为QA,然后有一个Production实例。我们从暂存创建分支,并进行验证,然后将它们合并到暂存中,然后再进行质量检查,再经过完全验证,再合并到母版中。 我是管道新手,我想实现以下流程
我将Bitbucket与AWS CodeDeploy服务一起使用,并且存储库托管在Bitbucket上 目前,我能够在1个实例上部署master分支。我该如何实现? 我的appspec.yml如下
image: php:7.2.13
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
- sh bitbucket-pipelines-codedeploy.sh
develop:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
custom:
just-test-without-cache:
- step:
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
答案 0 :(得分:0)
如果代码部署脚本正在从环境中提取AWS变量,则可以创建一个bash脚本以在该步骤之前运行,该步骤根据分支(即分支)来设置环境变量。
#!/bin/bash
if [ "$BITBUCKET_BRANCH" = "master" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Development"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "staging" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Staging"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "production" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Production"
export S3_BUCKET=""..."
fi
答案 1 :(得分:0)
我相信您可以使用Deployments
所以你会有类似的东西:
image: php:7.2.13
pipelines:
branches:
master:
- step:
deployment: production
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
- sh bitbucket-pipelines-codedeploy.sh
develop:
- step:
deployment: development
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit