AWS Ci/Cd 具有代码管道和代码构建的管道

AWS Ci/Cd pipeline with codepipeline and code build

我正在尝试使用 CodePipeLine 和 CodeBuild 为 .Net Core 项目在 aws 中实施 CI/CD 管道。

构建已成功执行,但是,上传工件时出现以下错误。

这可能与路径问题有关,已尝试用不同的方式更改路径,仍然出现错误。

Buildspec.yml 文件

version: 0.2

phases:
  pre_build:
    commands:
      - echo Restore started on `date`
      - dotnet restore MVCApplication/MVCApplication.csproj
  build:
    commands:
      - echo Build started on `date`
      - dotnet publish -c release -o ./build_output MVCApplication/MVCApplication.csproj
artifacts:
  files:
    - MVCApplication/build_output/**/*
    - scripts/**/*

错误日志

[Container] 2020/04/06 15:22:42 Expanding base directory path: .
[Container] 2020/04/06 15:22:45 Assembling file list
[Container] 2020/04/06 15:22:45 Expanding .
[Container] 2020/04/06 15:22:48 Expanding file paths for base directory .
[Container] 2020/04/06 15:22:48 Assembling file list
[Container] 2020/04/06 15:22:48 Expanding MVCApplication/build_output/**/*
[Container] 2020/04/06 15:22:52 Expanding scripts/**/*
[Container] 2020/04/06 15:22:55 Phase complete: UPLOAD_ARTIFACTS State: FAILED
[Container] 2020/04/06 15:22:55 Phase context status code: CLIENT_ERROR Message: no matching artifact paths found

我尝试过其他方法,但似乎没有用。谁能告诉我哪里做错了?

感谢任何帮助!

运行 以下命令作为 'build' 阶段的最后一个命令,用于确认您尝试制作的文件是否存在:

- pwd
- tree /F

其次,尝试如下更改工件部分(使用 Windows 样式路径)

artifacts:
  files:
    - .\MVCApplication\build_output\*
    - .\scripts\*

https://docs.aws.amazon.com/codebuild/latest/userguide/sample-windows.html

我尝试通过在构建规范文件中进行以下更改来解决错误。它对我来说很好用。

version: 0.2

phases:
  pre_build:
    commands:
      - echo Restore started on `date`
      - dotnet restore MVCApplication/MVCApplication.csproj
  build:
    commands:
      - echo Build started on `date`
      - dotnet publish -c release -o ./build_output MVCApplication/MVCApplication.csproj
      - 'dir ./build_output'
artifacts:
  files:
    - '**/*'
  base-directory: '../src/build_output'