Skip to content

Instantly share code, notes, and snippets.

@GuyPaddock
Last active March 30, 2024 23:31
Show Gist options
  • Save GuyPaddock/b260026169e86c6538f38e6e8cd9ba09 to your computer and use it in GitHub Desktop.
Save GuyPaddock/b260026169e86c6538f38e6e8cd9ba09 to your computer and use it in GitHub Desktop.
Clean-up Multidevs on Pantheon with Terminus
#!/usr/bin/env bash
set -euo pipefail
if [[ "$#" -eq 0 ]]; then
{
echo "Usage: ${0} <multi-dev 1> [multi-dev 2]... etc."
echo
echo "For example:"
echo " ${0} mr-819 mr-815 mr-814"
echo
} >&2
exit 1
fi
if [[ ! -d ".git" ]]; then
{
echo "This must be run inside a checked-out copy of the pantheon-d8-prototype site."
echo
} >&2
exit 2
fi
echo "## Refreshing Tags"
git fetch origin --tags
echo
if ! git rev-parse -q --verify "refs/tags/pantheon_live_1" >/dev/null; then
{
echo "This must be run inside a checked-out copy of the pantheon-d8-prototype site."
echo
} >&2
exit 2
fi
site_id="e450db97-5017-4aef-b21b-26f9f64da921"
multidevs=("$@")
for multidev in "${multidevs[@]}"; do
echo "## Removing '${site_id}.${multidev}'"
echo "### Deleting Multi-Dev"
(
set -x
terminus multidev:delete "${site_id}.${multidev}" --delete-branch --yes
)
echo ""
echo "### Cleaning Up Tag"
(
set -x
git push origin ":pantheon_${multidev}_1"
git tag -d "pantheon_${multidev}_1"
)
echo ""
done
# Or, clean-up all tags:
# git tag | grep pantheon_mr | while read tag; do
# git push origin ":${tag}"
# git tag -d "${tag}"
# done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment