Commit 7f7c0e4f authored by Rachel Lancelin's avatar Rachel Lancelin Committed by Yann D'Isanto
Browse files

feat(hooks): support post bluegreen hook

parent dd64febb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -211,6 +211,8 @@ The following hook scripts are supported on **deployment jobs**:
  to wait & check for the application to be ready (if not found, the template assumes the application was successfully started),
* `cf-post-push.sh` is executed **at the end** of the deploy operation, to perform specific environment post-initialization
  (for e.g. run tasks or schedule job).
* `cf-post-bluegreen.sh` is executed **at the end** of the bluegreen deployment, to perform specific environment post-initialization
  (for e.g. run tasks or schedule job).

Deployment hook scripts may use the following environment variables:

+14 −0
Original line number Diff line number Diff line
@@ -384,6 +384,18 @@ stages:
    fi
  }

  function post_bluegreen() {
    # maybe execute post bluegreen script
    postscript="$CF_SCRIPTS_DIR/cf-post-bluegreen.sh"
    if [[ -f "$postscript" ]]
    then
      log_info "--- \\e[32mpost-bluegreen hook\\e[0m (\\e[33;1m${postscript}\\e[0m) found: execute"
      bash "$postscript"
    else
      log_info "--- \\e[32mpost-bluegreen hook\\e[0m (\\e[33;1m${postscript}\\e[0m) not found: skip"
    fi
  }

  function simple_deploy() {
    export env=$1
    # for backward compatibility
@@ -522,6 +534,8 @@ stages:
    log_info "--- \\e[32mblue-green [5/5]\\e[0m: rename app \\e[33;1m${app_tmp}\\e[0m to \\e[33;1m${app_target}\\e[0m..."
    cf rename "$app_tmp" "$app_target"
    echo

    post_bluegreen
  }

  function deploy() {