如何在AWS Codepipeline中运行shell脚本?

Fel*_*ira 5 shell amazon-web-services amazon-elastic-beanstalk aws-code-deploy aws-codepipeline

我在 Github 上托管了一个 PHP 项目,我尝试使用 AWS Codepipeline 和 ElasticBeanstalk 设置持续集成。

到目前为止,我能够从 github 获取存储库内容并将其部署到 ElasticBeanstalk。但我需要在部署之前运行 shell 脚本,该脚本将更新 config.json 文件并更新环境变量。

这就是我试图在管道中实现的目标:

  1. 从Github获取项目文件(完成)
  2. 运行 shell 脚本来更新项目中的 config.json 文件
  3. 运行将在 ElasticBeanstalk 中设置环境变量的 shell 脚本
  4. 部署到 ElasticBeanstalk(完成)

我有什么想法可以让它发挥作用吗?

谢谢

zhn*_*gha 1

CodePipeline 不支持在操作中运行 shell,但您可能需要使用 CodeBuild,它可以执行 shell 命令来构建或仅更新文件。

http://docs.aws.amazon.com/codebuild/latest/userguide/sample-elastic-beanstalk.html#sample-elastic-beanstalk-codepipeline

要在 ElasticBeanstalk 中设置环境变量,您可以将配置文件 (.ebextensions/environmentvariables.config) 放入源文件夹中。

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-configuration-methods-after.html#configuration-options-after-console-ebextensions