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

Lucena
已提問 2 年前檢視次數 2302 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南