0
votes

I am trying to implement CI/CD pipeline in aws using CodePipeLine & CodeBuild for .Net Core project.

The build is getting executed successfully however, I am getting below errors when artifacts are being uploaded.

This might related to path issue, have tried changing the path with different way, still getting the error.

Buildspec.yml file

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/**/*

Error Log

[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

I have tried with other ways but doesn't seems to be working. Can anyone let me know where I am doing wrong ?

Any help on this appreciated !

2

2 Answers

1
votes

Run the following command as last command in 'build' phase to confirm the files you are trying to artifact exists:

- pwd
- tree /F

Secondly, try changing the artifacts section as follows (use Windows style path)

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

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

0
votes

I tried solving the error by making below changes in buildspec file. It is working fine for me.

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'