Skip to content
Snippets Groups Projects
Verified Commit 1d4115a8 authored by Varac's avatar Varac
Browse files

Check for merge commit more resiliently

parent e0abd56d
No related branches found
No related tags found
No related merge requests found
......@@ -175,9 +175,11 @@ behave-grafana:
terminate_droplet_after_merge:
stage: cleanup
script: |
if [ "$(git cat-file -p HEAD | grep -c '^parent')" -gt 1 ]
if [ "$(git show -s --pretty=%p HEAD | wc -w)" -gt 1 ]
then
pipeline=$(git cat-file -p 893aed0e1f1ce02a77b8f2a66ad03c24f09915d9 | grep 'Merge branch' | tr -dc '0-9')
subject="$(git show -s --format=%s)"
tmp="${subject#*\'}"
pipeline="${tmp%%\-*}"
echo "Current HEAD is a merge commit, removing droplet from related merge request pipeline #${pipeline}."
python3 -c "import greenhost_cloud; greenhost_cloud.terminate_droplets_by_name(\"^ci-${pipeline}\.\")"
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment