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
preguntada hace 2 años2302 visualizaciones
1 Respuesta
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
respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas