6

I'm trying to build a basic dotnet core application and deploy it using the default tool available to me in AWS. I currently have the following steps working:

  1. Repository in CodeCommit
  2. Checkin triggers CodeBuild build step on the Ubuntu image "aws/codebuild/dot-net:core-2.1" which runs the yml file(which creates the correct files I need to actually run the web app):

    version: 0.2
    
    phases:
    
    build:
    commands:
      - dotnet restore CMS/CMS.csproj
      - dotnet build CMS/CMS.csproj
      - dotnet publish CMS/CMS.csproj -o site
     artifacts:
      files:
        - CMS/site/**/*
        - CMS/aws-windows-deployment-manifest.json
    

aws-windows-deployment-manifest.json:

{
    "manifestVersion": 1,
    "deployments": {
        "aspNetCoreWeb": [{
                "name": "CMS",
                "parameters": {
                    "appBundle": "./site",
                    "iisPath": "/",
                    "iisWebSite": "Default Web Site"
                }
            }
        ]
    }
}
  1. CodeDeploy takes the artifacts and published them to an elastic beanstalk application configured to use windows. It's currently running the default application.

It runs through each step fine and I get green check marks throughout, but when I navigate to the EB instance the original site is still shown, showing me that my application hasn't been deployed. Is there something I'm missing?

I was really hoping I would be able to deploy an app from check in to finish without needing to modify a build environment, at least right now.

1 Answer 1

8

Here is a buildspec.yml I wrote to create the beanstalk package from CodeBuild.

version: 0.2

phases:

  build:
    commands:
      - dotnet restore EbCiTest/EbCiTest.csproj
      - dotnet build EbCiTest/EbCiTest.csproj
      - dotnet publish EbCiTest/EbCiTest.csproj -o ./staging/app
      - cp ./EbCiTest/aws-windows-deployment-manifest.json ./EbCiTest/staging/.
artifacts:
  files:
    - '**/*'
  base-directory: 'EbCiTest/staging'

I think the trouble you are having is the zip file being created contains the full paths to the files so aws-windows-deployment-manifest.json is not at the root of the zip file. I suggest copying everything to a staging folder and then using that staging folder as the base-directory which will be the root of the zip file.

Sign up to request clarification or add additional context in comments.

1 Comment

This did it. Thank you so much! I was getting very frustrated because it seemed like a few different tutorials had you doing manual work or using the AWS tools on visual studio and I just couldn't get anything to deploy using code pipleline.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.