Commit 13cf4fd7b91c7411df0ebbe2242e546a8df880e4

Authored by George Vlahavas
1 parent 5e20d431fc

Add hetzner_delete script

Showing 2 changed files with 21 additions and 1 deletions

delete_hetzner.sh View file @ 13cf4fd
  1 +#!/bin/bash
  2 +# Stop containers and removes containers, networks, volumes, and images
  3 +docker-compose -f docker-compose-hetzner.yml down
  4 +docker volume ls | \
  5 + grep kea_ | \
  6 + tr -s ' ' | \
  7 + cut -d' ' -f2 | \
  8 + xargs docker volume rm
  9 +
  10 +# Wait a bit
  11 +sleep 5s
  12 +
  13 +# Check that containers were removed succesfully
  14 +res=`docker ps -a | grep "/curex-local/kea_" | wc -l`
  15 +if [ $res -ne 0 ]; then
  16 + echo "ERROR: Some KEA containers have not been removed."
  17 + docker ps -a
  18 + exit 1
  19 +fi
hetzner_delete.groovy View file @ 13cf4fd
... ... @@ -28,7 +28,7 @@
28 28 docker.withRegistry("$PRIVATE_REGISTRY" , 'artifactory') {
29 29  
30 30 //echo 'Stop and remove the specified Docker containers from the DEV server'
31   - sh 'sh delete.sh'
  31 + sh 'sh delete_hetzner.sh'
32 32 }
33 33 }
34 34 }