Code build artifacts are not packed correctly

Dragos Stoica

I am using AWS Pipeline to deploy a .NET Framework application but I am stuck while trying to create the zip file for Code Deploy. The source and build steps are passing but when trying to create the package for Code Deploy, something odd is happening.

Here is my folder structure:

Project
    -Source
        -Base
            -CoreAPI
                -Api        
                    - bin
                    - scripts
                    - appspec.yml
                    - ...
            -Database
                - ...
    -Nuget
        - ...

After the build, I want to create a zip file with all files and folders within "Project\Source\Base\CoreAPI\Api"

Here is a part of the buildspec.yml which relates to artifacts:

artifacts:
  files:   
    - '**/*'
name: "api-build-artifact"
base-directory: .\Source\Api\CoreAPI\Api

As a result code build creates a zip file with all the files and folders within "Source", basically it discards the "base-directory".

I tried some variations like these:

artifacts:
  files:   
    - '.\Source\Base\CoreAPI\Api\**\*'

But then I get a zip with the folder structure Source\Base\CoreAPI\Api + all files and folders and obviously, Code Deploy fails because the "appspec.yml" file is not in the root folder.

Any idea what might be wrong here?

shariqmaws

Your indentation under artifacts is wrong. Try this:

artifacts:
  files:   
    - '**/*'
  name: "api-build-artifact"
  base-directory: .\Source\Api\CoreAPI\Api
  discard-paths: yes

Ref: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related