首页 > 解决方案 > 使用 bitbucket CI/CD 在 Elastic beanstalk 环境中发布部署命令

问题描述

我使用 bitbucket 作为我的 CI/CD 来部署到弹性 bean 环境。我的示例配置文件如下所示



image: atlassian/default-image:2

pipelines:
  branches:
   dev:
    - step:
        name: "Zip File"
        script:
          - apt-get update && apt-get install zip
          - apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
          - zip app.zip -r .
        artifacts: 
          - app.zip
    - step:
        name: "Deploy to dev env"
        deployment: dev
        caches:
          - node
        script: # Modify the commands below to build your repository.
        - pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.5
          variables:
            AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
            AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
            AWS_DEFAULT_REGION: 'ap-xxxxx-1'
            APPLICATION_NAME: 'exxxxs-xxxx-xxx'
            ENVIRONMENT_NAME: 'xxx-xxx-x-xxxxxx'
            S3_BUCKET: 'xxxxxxxxx'
            ZIP_FILE: "app.zip"

现在我需要在弹性 bean 环境创建的 EC2 实例之后使用 Curl 安装 Google chrome。我怎样才能添加这样的命令。我尝试在我的部署步骤之后向我的 bitbucket yaml 文件添加一个步骤,但出现错误

    - step:
        name: "Install Google Chrome"
        script:
          - apt update && apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget 
          - curl https://intoli.com/install-google-chrome.sh | bash

添加命令的正确方法是什么?

标签: amazon-elastic-beanstalkbitbucket

解决方案


推荐阅读