Commit 64220ca8 authored by Cédric OLIVIER's avatar Cédric OLIVIER
Browse files

Merge branch '13-fix-execute-hook-scripts-with-shebang-shell' into 'master'

Resolve "fix: execute hook scripts with shebang shell"

Closes #13

See merge request to-be-continuous/cloud-foundry!17
parents d591039c c3f290c3
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -265,7 +265,8 @@ stages:
    if [[ -f "$prescript" ]]
    then
      log_info "--- \\e[32mpre-push hook\\e[0m (\\e[33;1m${prescript}\\e[0m) found: execute"
      bash "$prescript"
      chmod +x "$prescript"
      "$prescript"
    else
      log_info "--- \\e[32mpre-push hook\\e[0m (\\e[33;1m${prescript}\\e[0m) not found: skip"
    fi
@@ -345,7 +346,8 @@ stages:
      cf_push_args+=("--no-start")
      cf push "${cf_push_args[@]}"
      log_info "--- \\e[32mpre-start hook\\e[0m (\\e[33;1m${pre_start}\\e[0m) found: execute"
      bash "$pre_start"
      chmod +x "$pre_start"
      "$pre_start"
      cf start "$tmpappname"
    else
      log_info "--- auto-start: \\e[94;1myes\\e[0m"
@@ -366,7 +368,8 @@ stages:
    if [[ -f "$readycheck" ]]
    then
      log_info "--- \\e[32mreadiness-check hook\\e[0m (\\e[33;1m${readycheck}\\e[0m) found: execute"
      bash "$readycheck" || exit 2
      chmod +x "$readycheck"
      "$readycheck" || exit 2
    else
      log_info "--- \\e[32mreadiness-check hook\\e[0m (\\e[33;1m${readycheck}\\e[0m) not found: assume app is ready"
    fi
@@ -378,7 +381,8 @@ stages:
    if [[ -f "$postscript" ]]
    then
      log_info "--- \\e[32mpost-push hook\\e[0m (\\e[33;1m${postscript}\\e[0m) found: execute"
      bash "$postscript"
      chmod +x "$postscript"
      "$postscript"
    else
      log_info "--- \\e[32mpost-push hook\\e[0m (\\e[33;1m${postscript}\\e[0m) not found: skip"
    fi
@@ -390,7 +394,8 @@ stages:
    if [[ -f "$postscript" ]]
    then
      log_info "--- \\e[32mpost-bluegreen hook\\e[0m (\\e[33;1m${postscript}\\e[0m) found: execute"
      bash "$postscript"
      chmod +x "$postscript"
      "$postscript"
    else
      log_info "--- \\e[32mpost-bluegreen hook\\e[0m (\\e[33;1m${postscript}\\e[0m) not found: skip"
    fi
@@ -568,7 +573,8 @@ stages:
    if [[ -f "$prescript" ]]
    then
      log_info "--- \\e[32mpre-cleanup hook\\e[0m (\\e[33;1m${prescript}\\e[0m) found: execute"
      bash "$prescript"
      chmod +x "$prescript"
      "$prescript"
    else
      log_info "--- \\e[32mpre-cleanup hook\\e[0m (\\e[33;1m${prescript}\\e[0m) not found: skip"
    fi
@@ -580,7 +586,8 @@ stages:
    if [[ -f "$postscript" ]]
    then
      log_info "--- \\e[32mpost-cleanup hook\\e[0m (\\e[33;1m${postscript}\\e[0m) found: execute"
      bash "$postscript"
      chmod +x "$postscript"
      "$postscript"
    else
      log_info "--- \\e[32mpost-cleanup hook\\e[0m (\\e[33;1m${postscript}\\e[0m) not found: skip"
    fi

test/fixtures/cf-pre-push.sh

100644 → 100755
+1 −1
Original line number Diff line number Diff line
#!/bin/bash
#!/usr/bin/env bash
if [[ -z "$appname" ]]
then
  echo "[ERROR] appname env not passed"

test/fixtures/cf-pre-start.sh

100644 → 100755
+1 −1
Original line number Diff line number Diff line
#!/bin/bash
#!/usr/bin/env bash
if [[ -z "$appname" ]]
then
  echo "[ERROR] appname env not passed"
+1 −1
Original line number Diff line number Diff line
#!/bin/bash
#!/usr/bin/env bash
echo "[ERROR] ready check failed"
exit 1
+1 −1
Original line number Diff line number Diff line
#!/bin/bash
#!/usr/bin/env bash
if [[ -z "$hostname" ]]
then
  echo "[ERROR] hostname env not passed"