sh 为非标准acsf环境部署挂钩

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 为非标准acsf环境部署挂钩相关的知识,希望对你有一定的参考价值。

#!/bin/bash
# Common functions for cloud hooks.

status=0

drush_alias=${site}'.'${target_env}

deploy_updates() {

  case $target_env in
    01dev|01test|01live|01pprod)
      acsf_deploy
      ;;
    01devup|01testup|01update|01pprodup)
      ;;
     *)
      deploy_install
      ;;
    *)
      ace_deploy
      ;;
    esac
}

acsf_deploy() {
  sites=()
  # Prep for BLT commands.
  repo_root="/var/www/html/$site.$target_env"
  export PATH=$repo_root/vendor/bin:$PATH
  cd $repo_root

  # Clear drush cache to make sure it can find ACSF tools.
  echo "Clearing Drush cache"
  drush cc drush

  echo "Running updates for environment: $target_env"

  # Generate an array of all site URIs on the Factory from parsed output of Drush utility.
  while IFS=$'\n' read -r line; do
      sites[i++]="$line"
      done < <(drush @"${drush_alias}" --include=./drush acsf-tools-list | grep domains: -A 1 | grep 0: | sed -e 's/^[0: ]*//')
      unset IFS

  # Loop through each available site uri and run BLT deploy updates.
  for uri in "${sites[@]}"; do
  #Override BLT default deploy uri.
  blt deploy:update --define environment=$target_env --define drush.uri="$uri" -v -y
  if [ $? -ne 0 ]; then
      echo "Update errored for site $uri."
      exit 1
  fi

  echo "Finished updates for site: $uri."
  done

  echo "Finished updates for all $target_env sites."
}

ace_deploy() {

  echo "Running updates for environment: $target_env"

  # Prep for BLT commands.
  repo_root="/var/www/html/$site.$target_env"
  export PATH=$repo_root/vendor/bin:$PATH
  cd $repo_root

  blt deploy:update --define environment=$target_env -v -y
  if [ $? -ne 0 ]; then
      echo "Update errored."
      exit 1
  fi

  echo "Finished updates for environment: $target_env"
}

deploy_sync() {

  echo "Running sync refresh for environment: $target_env"

  # Prep for BLT commands.
  repo_root="/var/www/html/$site.$target_env"
  export PATH=$repo_root/vendor/bin:$PATH
  cd $repo_root

  blt deploy:sync:refresh --define environment=$target_env -v -y
  if [ $? -ne 0 ]; then
      echo "Sync errored."
      exit 1
  fi

  echo "Finished sync for environment: $target_env"
}

deploy_install() {

  echo "Installing site for environment: $target_env"

  # Prep for BLT commands.
  repo_root="/var/www/html/$site.$target_env"
  export PATH=$repo_root/vendor/bin:$PATH
  cd $repo_root

  blt deploy:drupal:install --define environment=$target_env -v -y
  if [ $? -ne 0 ]; then
      echo "Install errored."
      exit 1
  fi

  echo "Finished installing for environment: $target_env"
}

以上是关于sh 为非标准acsf环境部署挂钩的主要内容,如果未能解决你的问题,请参考以下文章

通过部署后 Web 挂钩运行的部署和数据库脚本

json acsf工具json配置

json 样本裸骨,composer.json用于acsf迁移

sh Git合并后挂钩到自动安装依赖项

OpsWorks 在部署时运行挂钩

Qt:如何使用 QSignalMapper 为非标准按钮实现 QDialogBu​​ttonBox ?