Skip to content

Instantly share code, notes, and snippets.

@Julian88Tex
Last active February 7, 2020 00:03
Show Gist options
  • Save Julian88Tex/d0b7b61b38573f6055727c659a4bab60 to your computer and use it in GitHub Desktop.
Save Julian88Tex/d0b7b61b38573f6055727c659a4bab60 to your computer and use it in GitHub Desktop.
Shell script for rebuilding an NPSP QA org created with CumulusCI with latest branch changes
#!/usr/bin/env bash
# Script to be used by qa to rebuild a scratch environment.
echo
echo ***WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING***
echo
echo This script is to be used by qa to rebuild a scratch environment.
echo This script will rollback any modifications to files and delete a scratch org with the same name given.
echo Please save and stage any file changes before running this script or they will be undone.
echo
echo ***WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING******WARNING***
echo
# Prompt for conifrmation
read -p "Are you sure? [Y/n]" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Request branch name
read -p "What branch would you like to pull most recent changes from?? [example: feature/julian-qa-rebuild-script] " -r branch_name
# Request org name
read -p "What would you like to name your org? [example: W-123456] " org_name
# Remove any existing modified files so a pull can take place
git checkout -- .
# Pull most recent changes
git pull
# Switch to desired branch
git checkout $branch_name
# Delete exisiting scratch org if one exists with provided name
cci org scratch_delete $org_name
# Create Scratch
cci org scratch dev $org_name
# Rebuild org with qa flow
cci flow run qa_org --org $org_name
# Mark org as default
cci org default $org_name
# Open newly created org
cci org browser $org_name
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment