如何在通过 jenkins 将 war 文件部署到 AWS beanstalk 时包含 .ebextensions 目录?

How to include .ebextensions directory while deploying war file to AWS beanstalk through jenkins?

我正在尝试通过包含 ebextension 配置文件的 jenkins 部署 Spring 引导应用程序 war。

然而,beanstalk 或 jenkins 忽略了 exextension 文件并在没有 ebextension 文件的情况下更早地部署 war。作业未在 S3 存储桶中上传最新的源 zip(我可以看到最后上传的 zip 版本为 201,而当前版本为 204)。

我什至尝试通过 AWS UI 控制台上传 war。我在“/usr/share/tomcat8/webapps/ROOT/”处看不到“.ebextensions”目录。

我需要执行哪些步骤来确保我拥有有效的 ebextension 配置并放置在有效的路径中。

编辑 1: 我不是 war 认为 aws 会在执行后删除 ebextension 配置文件。但是我在“/var/log/cfn-init.log”文件中没有看到任何相关的命令执行日志。

2017-05-12 14:42:30,946 [INFO] -----------------------Build complete-----------------------
2017-05-13 12:15:58,540 [INFO] -----------------------Starting build-----------------------
2017-05-13 12:15:58,554 [INFO] Running configSets: Infra-EmbeddedPreBuild
2017-05-13 12:15:58,554 [INFO] Running configSet Infra-EmbeddedPreBuild
2017-05-13 12:15:58,554 [INFO] ConfigSets completed
2017-05-13 12:15:58,557 [INFO] -----------------------Build complete-----------------------
2017-05-13 12:16:00,702 [INFO] -----------------------Starting build-----------------------
2017-05-13 12:16:00,719 [INFO] Running configSets: Infra-EmbeddedPostBuild
2017-05-13 12:16:00,719 [INFO] Running configSet Infra-EmbeddedPostBuild
2017-05-13 12:16:00,720 [INFO] ConfigSets completed

以下是我在.ebextension配置中的配置

filebeat:
 "/etc/filebeat/filebeat.yml":
     mode: "000755"
     owner: root
     group: root
     content: |
       filebeat.prospectors:
       - input_type: log
         paths:
           - "/var/log/tomcat8/*.log"
       output.logstash:
         hosts: ["10.0.0.149:5044"]

commands:
  1_command:
    command: "curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-5.2.0-x86_64.rpm"
    cwd: /home/ec2-user
  2_command:
    command: "rpm -ivh --replacepkgs filebeat-5.2.0-x86_64.rpm"
    cwd: /home/ec2-user
  3_command:
    command: "/etc/init.d/filebeat start"

您的第一部分应该是 files:,而不是 filebeat:,并且您应该一次只缩进一个级别 - YAML 对空格非常敏感。