Skip to content

Instantly share code, notes, and snippets.

@jtrobman
Created May 20, 2014 19:43
Show Gist options
  • Save jtrobman/771e46ec0f3f5bc31468 to your computer and use it in GitHub Desktop.
Save jtrobman/771e46ec0f3f5bc31468 to your computer and use it in GitHub Desktop.
CI with Jenkins, Github and Acquia
#!/bin/bash
if [ -z $acquia_dev_server ]; then
acquia_dev_server="dev"
fi
echo "***********************************************"
echo "Configuration"
echo "***********************************************"
echo "site = $site"
echo "acquia_site_name = $acquia_site_name"
echo "drupal_version = $drupal_version"
echo "drupal_core_branch = $drupal_core_branch"
echo "drupal_common_branch = $drupal_common_branch"
echo "drupal_site_branch = $drupal_site_branch"
echo "acquia_dev_server = $acquia_dev_server"
# Update the Acquia repo.
echo ""
echo "***********************************************"
echo "Update the local Acquia repo (reset/pull)"
echo "***********************************************"
acquia_repo_dir="~/build_acquia/acquia_repos/$site/$drupal_site_branch"
cd $acquia_repo_dir
git reset --hard && git pull
# Update the local Drupal core repo.
echo ""
echo "***********************************************"
echo "Update the local Drupal core repo (reset/pull/rsync)"
echo "***********************************************"
cd ~/build_acquia/ami_repos/drupal$drupal_version-core/$drupal_core_branch
git reset --hard && git pull
source_core="~/build_acquia/ami_repos/drupal$drupal_version-core/$drupal_core_branch/docroot"
destination_core="~/build_acquia/acquia_repos/$site/$drupal_site_branch"
rsync -za --delete --exclude .git $source_core $destination_core
echo "Drupal core rsync complete!"
# Update the local Drupal site repo.
echo ""
echo "***********************************************"
echo "Update the local Drupal site repo (reset/pull/rsync)"
echo "***********************************************"
cd ~/build_acquia/ami_repos/$site/$drupal_site_branch
git reset --hard && git pull
source_site="~/build_acquia/ami_repos/$site/$drupal_site_branch/"
destination_site="~/build_acquia/acquia_repos/$site/$drupal_site_branch/docroot/sites/$site"
rsync -za --delete --exclude .git $source_site $destination_site
echo "Drupal site rsync complete!"
# Add, commit and push changes to Acquia git repo.
echo ""
echo "***********************************************"
echo "Add, commit and push changes to Acquia git repo"
echo "***********************************************"
cd $acquia_repo_dir
git add .
git commit . -m "Jenkins build"
git push
# Checkout the $drupal_site_branch branch on Acquia.
echo ""
echo "***********************************************"
echo "Checkout the $drupal_site_branch branch on Acquia"
echo "***********************************************"
echo "curl -s -u *****:***** -X POST https://cloudapi.acquia.com/v1/sites/prod:$acquia_site_name/envs/$acquia_dev_server/code-deploy.json?path=$drupal_site_branch"
curl -s -u [email_address]:[token] -X POST https://cloudapi.acquia.com/v1/sites/prod:$acquia_site_name/envs/$acquia_dev_server/code-deploy.json?path=$drupal_site_branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment