通过 bitbucket 管道使用 elastic beanstalk CLI (eb cli)

通过 bitbucket 管道使用 elastic beanstalk CLI (eb cli)

我正在尝试使用 bitbucket 代码管道通过 eb cli 部署到 elastic beanstalk。

这是我的bitbucket-pipelines.yml文件,我基于 amazonlinux 映像,因为这是在生产中的 VM 上运行的。

image: amazonlinux

pipelines:
  branches:
    testing:
      - step:
          name: Build & Deploy
          script:
          - curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
          - yum -y install nodejs zip gcc-c++ make
          - curl -O https://bootstrap.pypa.io/get-pip.py
          - python get-pip.py
          - pip install awsebcli
          - npm install
          - export AWS_ACCESS_KEY_ID="$TEST_AWS_ACCESS_KEY_ID"
          - export AWS_DEFAULT_REGION="$TEST_AWS_DEFAULT_REGION"
          - export AWS_SECRET_ACCESS_KEY="$TEST_AWS_SECRET_ACCESS_KEY"
          - echo "deploying to $TEST_BEANSTALK_ENVIRONMENT_NAME"
          - eb --version
          - eb deploy $TEST_BEANSTALK_ENVIRONMENT_NAME

安装似乎运行良好,直到最后eb --version一行。然而,eb deploy ...命令返回了一个非常有用的错误

ERROR: OSError ::

有人对我可以用什么不同的方式来解决这个问题有什么建议吗?

编辑-我从 ubuntu 镜像中运行这个也得到了同样的结果-

image: ubuntu:16.04

pipelines:
  branches:
    testing:
      - step:
          name: Build & Deploy
          script:
          - apt-get update && apt-get install -y software-properties-common
          - add-apt-repository universe
          - apt-get update && apt-get -y upgrade && apt-get install -y python-pip curl build-essential libssl-dev
          - curl -sL https://deb.nodesource.com/setup_8.x | bash
          - apt-get install nodejs
          - pip install awsebcli
          - node -v
          - npm -v
          - npm install
          - export AWS_ACCESS_KEY_ID="$TEST_AWS_ACCESS_KEY_ID"
          - export AWS_DEFAULT_REGION="$TEST_AWS_DEFAULT_REGION"
          - export AWS_SECRET_ACCESS_KEY="$TEST_AWS_SECRET_ACCESS_KEY"
          - echo "deploying to $TEST_BEANSTALK_ENVIRONMENT_NAME"
          - eb --version
          - eb deploy $TEST_BEANSTALK_ENVIRONMENT_NAME

也给了我ERROR: OSError ::

答案1

看起来我缺少git依赖项。错误消息隐藏在--verbosedeploy 命令的输出中。

以下作品 -

image: ubuntu:16.04

pipelines:
  branches:
    testing:
      - step:
          name: Build & Deploy
          script:
          - apt-get update && apt-get -y upgrade && apt-get install -y python-dev python-pip curl build-essential git-all
          - curl -sL https://deb.nodesource.com/setup_8.x | bash
          - apt-get install nodejs
          - pip install awsebcli --ignore-installed setuptools --upgrade
          - node -v
          - npm -v
          - eb --version
          - npm install
          - export AWS_ACCESS_KEY_ID="$TEST_AWS_ACCESS_KEY_ID"
          - export AWS_DEFAULT_REGION="$TEST_AWS_DEFAULT_REGION"
          - export AWS_SECRET_ACCESS_KEY="$TEST_AWS_SECRET_ACCESS_KEY"
          - echo "deploying to $TEST_BEANSTALK_ENVIRONMENT_NAME"
          - eb deploy $TEST_BEANSTALK_ENVIRONMENT_NAME --verbose

相关内容