AWS Code Deploy - event script(groovy) excute fail

128 views Asked by At

I failed deploy when groovy script executed an event hook.

The message is:

Error Code
ScriptFailed 

Script Name
uploadLogsToS3.sh 

Message
Script at specified location: uploadLogsToS3.sh run as user root failed with exit code 127 

Log Tail
LifecycleEvent - AfterInstall
Script - uploadLogsToS3.sh
[stderr]/usr/bin/env: groovy: No such file or directory

uploadLogsToS3.sh is a groovy shell script. I installed groovy as SDKMan. What is this solution to this problem?

1

There are 1 answers

0
See young On

I solved this problem as below.

  1. Uninstall groovy sdk uninstall groovy
  2. Uninstall sdkman - I referrenced http://sdkman.io/install.html
  3. Install sdkman - $ export SDKMAN_DIR="/usr/local/sdkman" && curl -s "https://get.sdkman.io" | bash
  4. Install groovy - sdk install groovy
  5. Make symbolic link - ln -s /usr/local/sdkman/candidates/groovy/current/bin/groovy /usr/bin/groovy
  6. Add "JAVA_HOME=/usr/lib/jvm/jre" in /usr/bin/groovy script