CodeDeploy - BeforeInstall ScriptMissing

0

I'm trying to deploy my spring boot application with AWS CodeDeploy in a EC2 linux machine but the process is stoping in BeforeInstall and throwing the message error: Script does not exist at specified location: /opt/codedeploy-agent/deployment-root/eb41ddde-ad23-492e-b3a0-203e1f77fb93/d-JIGRR5O5J/deployment-archive/server_clear.sh

my appspec.yml

version: 0.0
os: linux
files:
  - source: /
    destination: /home/ec2-user/server
permissions:
  - object: /
    pattern: "**"
    owner: ec2-user
    group: ec2-user
hooks:
  BeforeInstall:
    - location: script/server_clear.sh
      timeout: 300
      runas: ec2-user
  AfterInstall:
    - location: fix_privileges.sh
      timeout: 300
      runas: ec2-user
  ApplicationStart:
    - location: server_start.sh
      timeout: 20
      runas: ec2-user
  ApplicationStop:
    - location: server_stop.sh
      timeout: 20
      runas: ec2-user

buildspec.yml

version: 0.2
phases:
  install:
    runtime-versions:
      java: corretto11
  build:
    commands:
      - mvn clean install
  post_build:
    commands:
      - echo Build completed
artifacts:
  files:
    - target/*.jar
    - scripts/*.sh
    - appspec.yml
  discard-paths: yes

1개 답변
0

Hello,

Please make sure that your are using the correct relative path. In AppSpec.yaml, I noticed that server_clear.sh path is prefixed with script/ which is not the case of the remaining scripts. The location of scripts you specify in the hooks section is relative to the root of the application revision bundle.

Please check the references below:

https://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-appspec-file.html

https://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-plan.html

profile pictureAWS
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠