AWS EC2 Bitbucket Pipeline 未执行部署的最新代码
AWS EC2 Bitbucket Pipeline is not executing the latest code deployed
我遵循了实施 Bitbucket 管道的所有步骤,以便在 AWS EC2 中进行持续开发。我已经使用代码部署应用程序工具以及需要在 AWS 中完成的所有配置。我正在使用 EC2,Ubuntu 并且正在尝试部署 MEAN 应用程序。
根据 bitbucket,我在 "Repository variables" 下添加了变量,包括:
- S3_BUCKET
- DEPLOYMENT_GROUP_NAME
- DEPLOYMENT_CONFIG
- AWS_DEFAULT_REGION
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
我还添加了三个必需的文件:
codedeploy_deploy.py - 我从这个 link: https://bitbucket.org/awslabs/aws-codedeploy-bitbucket-pipelines-python/src/73b7c31b0a72a038ea0a9b46e457392c45ce76da/codedeploy_deploy.py?at=master&fileviewer=file-view-default
appspec.yml -
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu/aok
permissions:
- object: /home/ubuntu/aok
owner: ubuntu
group: ubuntu
hooks:
AfterInstall:
- location: scripts/install_dependencies
timeout: 300
runas: root
- location: scripts/start_server
timeout: 300
runas: root
3. **bitbucket-pipelines.yml**
mage: node:10.15.1
pipelines:
default:
- step:
script:
- apt-get update && apt-get install -y python-dev
- curl -O https://bootstrap.pypa.io/get-pip.py
- python get-pip.py
- pip install awscli
- python codedeploy_deploy.py
- aws deploy push --application-name $APPLICATION_NAME --s3-location s3://$S3_BUCKET/aok.zip --ignore-hidden-files
- aws deploy create-deployment --application-name $APPLICATION_NAME --s3-location bucket=$S3_BUCKET,key=aok.zip,bundleType=zip --deployment-group-name $DEPLOYMENT_GROUP_NAME
当我推送代码时,在 Bitbucket 的管道选项卡上显示成功消息,当我下载最新版本时,在 S3 中,我推送的更改也在那里。问题是网站没有显示新的更改,仍然存在我在实施 PIPELINE 之前克隆的初始版本。
此 codedeploy_deploy.py
脚本不再受支持。推荐的方法是从 CodeDeploy 插件迁移到 aws-code-deploy Bitbucket Pipe. There is a deployment guide from Atlassian that will help you to get started with the pipe: https://confluence.atlassian.com/bitbucket/deploy-to-aws-with-codedeploy-976773337.html
我遵循了实施 Bitbucket 管道的所有步骤,以便在 AWS EC2 中进行持续开发。我已经使用代码部署应用程序工具以及需要在 AWS 中完成的所有配置。我正在使用 EC2,Ubuntu 并且正在尝试部署 MEAN 应用程序。
根据 bitbucket,我在 "Repository variables" 下添加了变量,包括:
- S3_BUCKET
- DEPLOYMENT_GROUP_NAME
- DEPLOYMENT_CONFIG
- AWS_DEFAULT_REGION
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
我还添加了三个必需的文件:
codedeploy_deploy.py - 我从这个 link: https://bitbucket.org/awslabs/aws-codedeploy-bitbucket-pipelines-python/src/73b7c31b0a72a038ea0a9b46e457392c45ce76da/codedeploy_deploy.py?at=master&fileviewer=file-view-default
appspec.yml -
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu/aok
permissions:
- object: /home/ubuntu/aok
owner: ubuntu
group: ubuntu
hooks:
AfterInstall:
- location: scripts/install_dependencies
timeout: 300
runas: root
- location: scripts/start_server
timeout: 300
runas: root
3. **bitbucket-pipelines.yml**
mage: node:10.15.1
pipelines:
default:
- step:
script:
- apt-get update && apt-get install -y python-dev
- curl -O https://bootstrap.pypa.io/get-pip.py
- python get-pip.py
- pip install awscli
- python codedeploy_deploy.py
- aws deploy push --application-name $APPLICATION_NAME --s3-location s3://$S3_BUCKET/aok.zip --ignore-hidden-files
- aws deploy create-deployment --application-name $APPLICATION_NAME --s3-location bucket=$S3_BUCKET,key=aok.zip,bundleType=zip --deployment-group-name $DEPLOYMENT_GROUP_NAME
当我推送代码时,在 Bitbucket 的管道选项卡上显示成功消息,当我下载最新版本时,在 S3 中,我推送的更改也在那里。问题是网站没有显示新的更改,仍然存在我在实施 PIPELINE 之前克隆的初始版本。
此 codedeploy_deploy.py
脚本不再受支持。推荐的方法是从 CodeDeploy 插件迁移到 aws-code-deploy Bitbucket Pipe. There is a deployment guide from Atlassian that will help you to get started with the pipe: https://confluence.atlassian.com/bitbucket/deploy-to-aws-with-codedeploy-976773337.html