我尝试构建一个AWS CodeBuild,但是失败了

时间:2019-01-31 08:14:50

标签: aws-codebuild

https://github.com/chenjianAgain/codestar_web.git

我在AWS控制台中设置了一个代码构建。但是,当我开始执行构建时,遇到了一些错误。 似乎AWS cli的安装有问题。 我不知道为什么awscli无法正确安装。 (pip install --upgrade awscli)

有人可以帮忙吗?非常感谢。

version: 0.2

phases:
  install:
    commands:
      # Install dependencies needed for running tests
      - npm install

      # Upgrade AWS CLI to the latest version
      - pip install --upgrade awscli
  pre_build:
    commands:
      # Discover and run unit tests in the 'tests' directory
      - npm test
  post_build:
    commands:
      # Remove existing node_modules to clear dev dependencies
      - rm -r node_modules

      # Install runtime dependencies
      - npm install --production
artifacts:
  type: zip
  files:
    - template.yml
    - README.md
    - package.json
    - app.js
    - appspec.yml
    - scripts/*
    - node_modules/**/*
    - public/**/*

[Container] 2019/01/31 08:07:25 Waiting for agent ping
[Container] 2019/01/31 08:07:26 Waiting for DOWNLOAD_SOURCE
[Container] 2019/01/31 08:07:26 Phase is DOWNLOAD_SOURCE
[Container] 2019/01/31 08:07:26 CODEBUILD_SRC_DIR=/codebuild/output/src414370097/src/github.com/chenjianAgain/codestar_web
[Container] 2019/01/31 08:07:26 YAML location is /codebuild/output/src414370097/src/github.com/chenjianAgain/codestar_web/buildspec.yml
[Container] 2019/01/31 08:07:26 Processing environment variables
[Container] 2019/01/31 08:07:26 Moving to directory /codebuild/output/src414370097/src/github.com/chenjianAgain/codestar_web
[Container] 2019/01/31 08:07:26 Registering with agent
[Container] 2019/01/31 08:07:26 Phases found in YAML: 3
[Container] 2019/01/31 08:07:26  INSTALL: 2 commands
[Container] 2019/01/31 08:07:26  PRE_BUILD: 1 commands
[Container] 2019/01/31 08:07:26  POST_BUILD: 2 commands
[Container] 2019/01/31 08:07:26 Phase complete: DOWNLOAD_SOURCE Success: true
[Container] 2019/01/31 08:07:26 Phase context status code:  Message: 
[Container] 2019/01/31 08:07:26 Entering phase INSTALL
[Container] 2019/01/31 08:07:26 Running command npm install
npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN deprecated samsam@1.1.2: This package has been deprecated in favour of @sinonjs/samsam
npm WARN deprecated samsam@1.1.3: This package has been deprecated in favour of @sinonjs/samsam
npm notice created a lockfile as package-lock.json. You should commit this file.
added 79 packages from 478 contributors and audited 96 packages in 2.83s
found 4 vulnerabilities (2 low, 2 moderate)
  run `npm audit fix` to fix them, or `npm audit` for details

[Container] 2019/01/31 08:07:33 Running command pip install --upgrade awscli
/codebuild/output/tmp/script.sh: 4: /codebuild/output/tmp/script.sh: pip: not found

[Container] 2019/01/31 08:07:33 Command did not exit successfully pip install --upgrade awscli exit status 127
[Container] 2019/01/31 08:07:33 Phase complete: INSTALL Success: false
[Container] 2019/01/31 08:07:33 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: pip install --upgrade awscli. Reason: exit status 127

1 个答案:

答案 0 :(得分:1)

您的构建环境似乎未安装pip。尝试将pip安装行添加到您的buildspec文件中

version: 0.2

phases:
  install:
    commands:
      # Install pip
      - sudo apt-get install python-pip

      # Install dependencies needed for running tests
      - npm install

      # Upgrade AWS CLI to the latest version
      - pip install --upgrade awscli