0

i'm using codepipeline and my codebuild is working correctly, i can see the output of it is an s3 bucket with the 3 files/folders i've specified in buildspec.yml (appspec.yml, the "publish" folder of the .net api, and the "deploy-scripts" folder + its contents).

Now when it goes to the next phase, codedeploy, the codedeploy agent complains that the appspec.yml cannot find the script mentioned (which lives in the deploy-scripts folder) and the deploy fails.

i've looked into the ec2 instance itself, and i cannot see the the "deploy-scripts" folder, although I can see the publish folder and appspec.yml. this is when i'm in the /home/ec2-usr/api folder.

this is my buildspec.yml (which seems to be working, as the s3 output has all the artifacts):

version: 0.2

phases:
  install:
    runtime-versions:
      dotnet: 6.0
  build:
    commands:
      - cd Todolendar.API
      - dotnet restore
      - dotnet build -c Release
      - dotnet publish -c Release -r linux-x64 -o ./publish
artifacts:
  files:
    - ./appspec.yml
    - ./deploy-scripts/*
    - ./Todolendar.API/publish/**/*

this is my appspec.yml (i was under the impression the files source refers to the s3 bucket, and the destination refers to where it gets placed in the ec2 instance):

version: 0.0
os: linux
files:
  - source: /
    destination: /home/ec2-user/api
permissions:
  - object: /
    pattern: "**"
    owner: ec2-user
    group: ec2-user
hooks:
  AfterInstall:
    - location: deploy-scripts/before_install.sh
      timeout: 1200
      runas: ec2-user
  ApplicationStart:
    - location: deploy-scripts/start_server.sh
      timeout: 300
      runas: ec2-user
  ApplicationStop:
    - location: deploy-scripts/stop_server.sh
      timeout: 300
      runas: ec2-user

i was expecting to see my "deploy-scripts" folder on the ec2 instance, considering it was there in the s3 bucket. i was under the impression the codedeploy agent would copy from the files files source being the s3 bucket, and the destination referring to where it gets placed in the ec2 instance (in the api folder, where the publish folder and appspec.yml file is - it seems to have worked for these two).

Rykke
  • 1

0 Answers0