【问题标题】:CodePipeline does not upload buildspec artifacts like CodeBuild doesCodePipeline 不会像 CodeBuild 那样上传构建规范工件
【发布时间】:2020-12-05 21:15:20
【问题描述】:

我从 buildspec.yml 文件中摘录了以下内容:

version: 0.2
phases:
  install:
    runtime-versions:
      nodejs: 12
  build:
    commands:
      - npm install
      - cd e2e
      - npm install
  post_build:
    commands:
      - CHOKIDAR_USEPOLLING=true npm run e2e:$APP_MODULE
    finally:
      - FILENAME="${APP_MODULE}_out.json"
      - echo ${FILENAME}
      - mv .nyc_output/out.json ${FILENAME}
artifacts:
  base-directory: e2e
  files:
    - '${FILENAME}'
  secondary-artifacts:
    videos:
      base-directory: e2e/cypress/videos
      files: 
        - '**/*'

当我单独运行此 CodeBuild 时,主要和次要工件都会上传到 S3。

[Container] 2020/08/16 15:18:18 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2020/08/16 15:18:18 Phase context status code:  Message: 
[Container] 2020/08/16 15:18:18 Expanding base directory path: e2e
[Container] 2020/08/16 15:18:18 Assembling file list
[Container] 2020/08/16 15:18:18 Expanding e2e
[Container] 2020/08/16 15:18:18 Expanding file paths for base directory e2e
[Container] 2020/08/16 15:18:18 Assembling file list
[Container] 2020/08/16 15:18:18 Expanding ${FILENAME}
[Container] 2020/08/16 15:18:18 Expanded to layout_out.json
[Container] 2020/08/16 15:18:18 Found 1 file(s)
[Container] 2020/08/16 15:18:18 Preparing to copy secondary artifacts videos
[Container] 2020/08/16 15:18:18 Expanding base directory path: e2e/cypress/videos
[Container] 2020/08/16 15:18:18 Assembling file list
[Container] 2020/08/16 15:18:18 Expanding e2e/cypress/videos
[Container] 2020/08/16 15:18:18 Expanding file paths for base directory e2e/cypress/videos
[Container] 2020/08/16 15:18:18 Assembling file list
[Container] 2020/08/16 15:18:18 Expanding **/*
[Container] 2020/08/16 15:18:18 Found 4 file(s)
[Container] 2020/08/16 15:18:19 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED

通过 CodePipeline 运行时,仅上传辅助工件!

[Container] 2020/08/16 15:33:00 Uploading S3 cache...
[Container] 2020/08/16 15:34:53 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2020/08/16 15:34:53 Phase context status code:  Message: 
[Container] 2020/08/16 15:34:53 Preparing to copy secondary artifacts videos
[Container] 2020/08/16 15:34:53 Expanding base directory path: e2e/cypress/videos
[Container] 2020/08/16 15:34:53 Assembling file list
[Container] 2020/08/16 15:34:53 Expanding e2e/cypress/videos
[Container] 2020/08/16 15:34:53 Expanding file paths for base directory e2e/cypress/videos
[Container] 2020/08/16 15:34:53 Assembling file list
[Container] 2020/08/16 15:34:53 Expanding **/*
[Container] 2020/08/16 15:34:53 Found 4 file(s)
[Container] 2020/08/16 15:34:54 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED

仅供参考 CodePipeline 配置为运行运行相同 CodeBuild 的并行构建操作

【问题讨论】:

    标签: aws-codepipeline aws-codebuild


    【解决方案1】:

    找到一种解决方法:在 CodeBuild 配置和构建规范中将两个工件指定为次要。

    artifacts:
      secondary-artifacts:
        artifact1:
          base-directory: $CODEBUILD_SRC_DIR
          files:
            - source1_file
        artifact2:
          base-directory: $CODEBUILD_SRC_DIR_source2
          files:
            - source2_file
    

    名称需要与 CodeBuild 的 Artifacts 配置中的名称相匹配 - 使用 Add Artifact 按钮添加更多次要工件。

    【讨论】:

      猜你喜欢
      • 2019-05-17
      • 2023-03-28
      • 2020-07-14
      • 2020-05-22
      • 1970-01-01
      • 2017-05-28
      • 2017-12-25
      • 1970-01-01
      • 2013-04-12
      相关资源
      最近更新 更多