github.com/dnephin/dobi@v0.15.0/examples/tag-images/test.sh (about)

     1  #!/usr/bin/env bash
     2  # SUMMARY: Test example of tagging images
     3  # LABELS:
     4  # REPEAT:
     5  # AUTHOR:
     6  set -eu -o pipefail
     7  
     8  remove_all_tags() {
     9      local image=$1
    10      docker images -q "$image" | uniq | xargs docker rmi -f
    11  }
    12  
    13  cleanup() {
    14      echo "running cleanup"
    15      rm -f output
    16      remove_all_tags example/tagged-app
    17      remove_all_tags example/tagged-db
    18  }
    19  trap "cleanup" EXIT
    20  
    21  export APP_VERSION=testing
    22  dobi tag-images
    23  
    24  echo "image=app tags 5 images"
    25  [[ $(docker images -q example/tagged-app | wc -l) == 5 ]]
    26  
    27  echo "image=db tags 5 images"
    28  [[ $(docker images -q example/tagged-db | wc -l) == 5 ]]